Program: 49038
Project: 49038
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addNetworks(@RequestBody final NetworkAdd na){
  if (CommonUtil.isBlank(na.getName()) || !CommonUtil.validateName(na.getName())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",na.getName());
  }
  if (CommonUtil.isBlank(na.getPortGroup()) || !CommonUtil.validateName(na.getPortGroup())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",na.getPortGroup());
  }
  if (na.isDhcp()) {
    networkManager.addDhcpNetwork(na.getName(),na.getPortGroup());
  }
 else {
    if (!IpAddressUtil.isValidNetmask(na.getNetmask())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getNetmask());
    }
    long netmask=IpAddressUtil.getAddressAsLong(na.getNetmask());
    if (!IpAddressUtil.isValidIp(netmask,IpAddressUtil.getAddressAsLong(na.getGateway()))) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getGateway());
    }
    if (na.getDns1() != null && !IpAddressUtil.isValidIp(na.getDns1())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getDns1());
    }
    if (na.getDns2() != null && !IpAddressUtil.isValidIp(na.getDns2())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getDns2());
    }
    AuAssert.check(na.getIp() != null,"String_Node_Str");
    for (    IpBlock blk : na.getIp()) {
      Long begin=IpAddressUtil.getAddressAsLong(blk.getBeginIp());
      Long end=IpAddressUtil.getAddressAsLong(blk.getEndIp());
      if (begin == null || end == null || begin > end || !IpAddressUtil.isValidIp(netmask,begin) || !IpAddressUtil.isValidIp(netmask,end)) {
        throw BddException.INVALID_PARAMETER("String_Node_Str","String_Node_Str" + blk.getBeginIp() + "String_Node_Str"+ blk.getEndIp()+ "String_Node_Str");
      }
    }
    networkManager.addIpPoolNetwork(na.getName(),na.getPortGroup(),na.getNetmask(),na.getGateway(),na.getDns1(),na.getDns2(),na.getIp());
  }
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addNetworks(@RequestBody final NetworkAdd na){
  if (CommonUtil.isBlank(na.getName()) || !CommonUtil.validateName(na.getName())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",na.getName());
  }
  if (CommonUtil.isBlank(na.getPortGroup()) || !CommonUtil.validatePortGroupName(na.getPortGroup())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",na.getPortGroup());
  }
  if (na.isDhcp()) {
    networkManager.addDhcpNetwork(na.getName(),na.getPortGroup());
  }
 else {
    if (!IpAddressUtil.isValidNetmask(na.getNetmask())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getNetmask());
    }
    long netmask=IpAddressUtil.getAddressAsLong(na.getNetmask());
    if (!IpAddressUtil.isValidIp(netmask,IpAddressUtil.getAddressAsLong(na.getGateway()))) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getGateway());
    }
    if (na.getDns1() != null && !IpAddressUtil.isValidIp(na.getDns1())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getDns1());
    }
    if (na.getDns2() != null && !IpAddressUtil.isValidIp(na.getDns2())) {
      throw BddException.INVALID_PARAMETER("String_Node_Str",na.getDns2());
    }
    AuAssert.check(na.getIp() != null,"String_Node_Str");
    for (    IpBlock blk : na.getIp()) {
      Long begin=IpAddressUtil.getAddressAsLong(blk.getBeginIp());
      Long end=IpAddressUtil.getAddressAsLong(blk.getEndIp());
      if (begin == null || end == null || begin > end || !IpAddressUtil.isValidIp(netmask,begin) || !IpAddressUtil.isValidIp(netmask,end)) {
        throw BddException.INVALID_PARAMETER("String_Node_Str","String_Node_Str" + blk.getBeginIp() + "String_Node_Str"+ blk.getEndIp()+ "String_Node_Str");
      }
    }
    networkManager.addIpPoolNetwork(na.getName(),na.getPortGroup(),na.getNetmask(),na.getGateway(),na.getDns1(),na.getDns2(),na.getIp());
  }
}