nus-yam/ex-repair huggingface dataset:
Program: 37458
Project: 37458
Buggy source:
/** 
 * query domain by domain name.
 * @param domainName is a fully-qualified (relative to the root) domain name [RFC1594] in either the in-addr.arpa or ip6.arpa zones (for RIRs) or a fully-qualified domain name in a zone administered by the server operator (for DNRs).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam);
}

Fixed version (ground truth):
/** 
 * query domain by domain name.
 * @param domainName is a fully-qualified (relative to the root) domain name [RFC1594] in either the in-addr.arpa or ip6.arpa zones (for RIRs) or a fully-qualified domain name in a zone administered by the server operator (for DNRs).
 * @return JSON formated result,with HTTP code.
 */
@RequestMapping(value={"String_Node_Str"},method=RequestMethod.GET) @ResponseBody public ResponseEntity queryDomain(@PathVariable String domainName){
  String decodeDomain=domainName;
  String punyDomainName=decodeDomain;
  try {
    decodeDomain=DomainUtil.decodeAndTrimAndReplaceAsciiToLowercase(domainName);
    punyDomainName=DomainUtil.geneDomainPunyName(decodeDomain);
  }
 catch (  Exception e) {
    return RestResponseUtil.createResponse400();
  }
  if (!DomainUtil.validateDomainNameIsValidIdna(decodeDomain)) {
    return RestResponseUtil.createResponse400();
  }
  decodeDomain=DomainUtil.deleteLastPoint(decodeDomain);
  decodeDomain=StringUtils.lowerCase(decodeDomain);
  QueryParam queryParam=queryParser.parseDomainQueryParam(decodeDomain,punyDomainName);
  if (queryService.tldInThisRegistry(queryParam)) {
    return queryDomainInThisRegistry(queryParam);
  }
  return queryRedirectDomainOrNs(queryParam,domainName);
}
Program: 37459
Project: 37459
Buggy source:
/** 
 * write 429 error.
 * @param response response.
 * @throws IOException IOException.
 */
private void writeError429Response(HttpServletResponse response) throws IOException {
  ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse401();
  FilterHelper.writeResponse(responseEntity,response);
}

Fixed version (ground truth):
/** 
 * write 429 error.
 * @param response response.
 * @throws IOException IOException.
 */
private void writeError429Response(HttpServletResponse response) throws IOException {
  ResponseEntity<ErrorMessage> responseEntity=RestResponseUtil.createResponse429();
  FilterHelper.writeResponse(responseEntity,response);
}
Program: 37460
Project: 37460
Buggy source:
/** 
 * test executeSqlScript.
 */
@Test public void testExecuteSqlScript(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitContext initContext=(InitContext)ctx.getBean("String_Node_Str");
  JdbcTemplate jdbcTemplate=(JdbcTemplate)ctx.getBean("String_Node_Str");
  initContext.executeSqlScript(jdbcTemplate,"String_Node_Str","String_Node_Str",true);
}

Fixed version (ground truth):
/** 
 * test executeSqlScript.
 */
public void testExecuteSqlScript(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitContext initContext=(InitContext)ctx.getBean("String_Node_Str");
  JdbcTemplate jdbcTemplate=(JdbcTemplate)ctx.getBean("String_Node_Str");
  initContext.executeSqlScript(jdbcTemplate,"String_Node_Str","String_Node_Str",true);
}
Program: 37461
Project: 37461
Buggy source:
@Test public void testMain(){
  Init.main(null);
}

Fixed version (ground truth):
public void testMain(){
  Init.main(null);
}
Program: 37462
Project: 37462
Buggy source:
/** 
 * test initSchema and initData.
 */
@Test public void testInitSchemaAndData(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
}

Fixed version (ground truth):
/** 
 * test initSchema and initData.
 */
public void testInitSchemaAndData(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
}
Program: 37463
Project: 37463
Buggy source:
/** 
 * test executeSqlScript.
 */
@Test public void testExecuteSqlScript(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitContext initContext=(InitContext)ctx.getBean("String_Node_Str");
  JdbcTemplate jdbcTemplate=(JdbcTemplate)ctx.getBean("String_Node_Str");
  initContext.executeSqlScript(jdbcTemplate,"String_Node_Str","String_Node_Str",true);
}

Fixed version (ground truth):
/** 
 * test executeSqlScript.
 */
public void testExecuteSqlScript(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitContext initContext=(InitContext)ctx.getBean("String_Node_Str");
  JdbcTemplate jdbcTemplate=(JdbcTemplate)ctx.getBean("String_Node_Str");
  initContext.executeSqlScript(jdbcTemplate,"String_Node_Str","String_Node_Str",true);
}
Program: 37464
Project: 37464
Buggy source:
@Test public void testMain(){
  Init.main(null);
}

Fixed version (ground truth):
public void testMain(){
  Init.main(null);
}
Program: 37465
Project: 37465
Buggy source:
/** 
 * test initSchema and initData.
 */
@Test public void testInitSchemaAndData(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
}

Fixed version (ground truth):
/** 
 * test initSchema and initData.
 */
public void testInitSchemaAndData(){
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
}
Program: 37466
Project: 37466
Buggy source:
/** 
 * get parameter from request,get first if has more than one param.
 * @param request HttpServletRequest.
 * @param strParamOrg the final String array for url params.
 * @return first right url param.
 */
public String getFirstParameter(HttpServletRequest request,final String[] strParamOrg){
  String strQuery=request.getQueryString();
  int pos=strQuery.indexOf("String_Node_Str");
  if (-1 != pos) {
    try {
      strQuery=strQuery.substring(0,pos);
    }
 catch (    Exception e) {
      return null;
    }
  }
  final String strSplit="String_Node_Str";
  String[] strParam=strQuery.split(strSplit);
  final String strEqual="String_Node_Str";
  for (int k=0; k < strParam.length; ++k) {
    String[] strParamName=strParam[k].split(strEqual);
    if (strParamName != null) {
      for (int j=0; j < strParamOrg.length; ++j) {
        if (strParamName[0].compareTo(strParamOrg[j]) == 0) {
          return strParamName[0];
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * get parameter from request,get first if has more than one param.
 * @param request HttpServletRequest.
 * @param strParamOrg the final String array for url params.
 * @return first right url param.
 */
public String getFirstParameter(HttpServletRequest request,final String[] strParamOrg){
  String strQuery=request.getQueryString();
  if (StringUtils.isBlank(strQuery)) {
    return null;
  }
  int pos=strQuery.indexOf("String_Node_Str");
  if (-1 != pos) {
    try {
      strQuery=strQuery.substring(0,pos);
    }
 catch (    Exception e) {
      return null;
    }
  }
  final String strSplit="String_Node_Str";
  String[] strParam=strQuery.split(strSplit);
  final String strEqual="String_Node_Str";
  for (int k=0; k < strParam.length; ++k) {
    String[] strParamName=strParam[k].split(strEqual);
    if (strParamName != null) {
      for (int j=0; j < strParamOrg.length; ++j) {
        if (strParamName[0].compareTo(strParamOrg[j]) == 0) {
          return strParamName[0];
        }
      }
    }
  }
  return null;
}
Program: 37467
Project: 37467
Buggy source:
/** 
 * query network for arpa.
 * @param outerObjectId object related to network
 * @param outerModelType object type related to network                     
 * @return network list.
 */
@Override public List<Network> queryAsInnerObjects(Long outerObjectId,ModelType outerModelType){
  if (!ModelType.ENTITY.equals(outerModelType)) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  List<Network> networks=queryWithoutInnerObjectsForEntity(outerObjectId);
  queryAndSetInnerObjects(networks);
  return networks;
}

Fixed version (ground truth):
/** 
 * query network for arpa.
 * @param outerObjectId object related to network
 * @param outerModelType object type related to network
 * @return network list.
 */
@Override public List<Network> queryAsInnerObjects(Long outerObjectId,ModelType outerModelType){
  if (!ModelType.ENTITY.equals(outerModelType)) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  List<Network> networks=queryWithoutInnerObjectsForEntity(outerObjectId);
  queryAndSetInnerObjects(networks);
  return networks;
}
Program: 37468
Project: 37468
Buggy source:
/** 
 * set ip version,and start/end address.
 * @param rs ResultSet.
 * @param objIp Ip.
 * @throws SQLException SQLException.
 */
private void setIpVersionAndStartEndAddress(ResultSet rs,Network objIp) throws SQLException {
  String ipVersionStr=rs.getString("String_Node_Str");
  String startHighAddress=rs.getString("String_Node_Str");
  String startLowAddress=rs.getString("String_Node_Str");
  String endHighAddress=rs.getString("String_Node_Str");
  String endLowAddress=rs.getString("String_Node_Str");
  String startAddress="String_Node_Str";
  String endAddress="String_Node_Str";
  if (IpVersion.isV6(ipVersionStr)) {
    objIp.setIpVersion(IpVersion.V6);
    startAddress=IpUtil.longToIpV6(StringUtil.parseUnsignedLong(startHighAddress),StringUtil.parseUnsignedLong(startLowAddress));
    endAddress=IpUtil.longToIpV6(StringUtil.parseUnsignedLong(endHighAddress),StringUtil.parseUnsignedLong(endLowAddress));
  }
 else   if (IpVersion.isV4(ipVersionStr)) {
    objIp.setIpVersion(IpVersion.V4);
    startAddress=IpUtil.longToIpV4(StringUtil.parseUnsignedLong(startLowAddress));
    endAddress=IpUtil.longToIpV4(StringUtil.parseUnsignedLong(endLowAddress));
  }
  objIp.setStartAddress(startAddress);
  objIp.setEndAddress(endAddress);
}

Fixed version (ground truth):
/** 
 * set ip version,and start/end address.
 * @param rs ResultSet.
 * @param objIp Ip.
 * @throws SQLException SQLException.
 */
private void setIpVersionAndStartEndAddress(ResultSet rs,Network objIp) throws SQLException {
  String ipVersionStr=rs.getString("String_Node_Str");
  String startHighAddress=rs.getString("String_Node_Str");
  String startLowAddress=rs.getString("String_Node_Str");
  String endHighAddress=rs.getString("String_Node_Str");
  String endLowAddress=rs.getString("String_Node_Str");
  String startAddress="String_Node_Str";
  String endAddress="String_Node_Str";
  if (IpVersion.isV6(ipVersionStr)) {
    objIp.setIpVersion(IpVersion.V6);
    long longHighStart=StringUtil.parseUnsignedLong(startHighAddress);
    long longLowStart=StringUtil.parseUnsignedLong(startLowAddress);
    startAddress=IpUtil.longToIpV6(longHighStart,longLowStart);
    long longHighEnd=StringUtil.parseUnsignedLong(endHighAddress);
    long longLowEnd=StringUtil.parseUnsignedLong(endLowAddress);
    endAddress=IpUtil.longToIpV6(longHighEnd,longLowEnd);
  }
 else   if (IpVersion.isV4(ipVersionStr)) {
    objIp.setIpVersion(IpVersion.V4);
    startAddress=IpUtil.longToIpV4(StringUtil.parseUnsignedLong(startLowAddress));
    endAddress=IpUtil.longToIpV4(StringUtil.parseUnsignedLong(endLowAddress));
  }
  objIp.setStartAddress(startAddress);
  objIp.setEndAddress(endAddress);
}
Program: 37469
Project: 37469
Buggy source:
/** 
 * search entity by handle or name.
 * @param fn fn.
 * @param handle handle.
 * @param request request.
 * @return ResponseEntity.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity searchEntity(@RequestParam(required=false) String fn,@RequestParam(required=false) String handle,HttpServletRequest request){
  LOGGER.info("String_Node_Str",fn,handle);
  final String fnParamName="String_Node_Str";
  final String handleParamName="String_Node_Str";
  String paramName=queryParser.getFirstParameter(request,new String[]{fnParamName,handleParamName});
  if (StringUtils.isBlank(paramName)) {
    return RestResponseUtil.createResponse400();
  }
  String paramValue=queryParser.getParameter(request,paramName);
  paramValue=StringUtils.trim(paramValue);
  if (!StringUtil.isValidEntityHandleOrName(paramValue)) {
    return RestResponseUtil.createResponse400();
  }
  if (!StringUtil.checkIsValidSearchPattern(paramValue)) {
    return RestResponseUtil.createResponse422();
  }
  QueryParam queryParam=queryParser.parseEntityQueryParam(paramValue,paramName);
  LOGGER.info("String_Node_Str",queryParam);
  EntitySearch result=searchService.searchEntity(queryParam);
  if (null != result) {
    if (result.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}

Fixed version (ground truth):
/** 
 * search entity by handle or name.
 * @param fn fn.
 * @param handle handle.
 * @param request request.
 * @return ResponseEntity.
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ResponseEntity searchEntity(@RequestParam(required=false) String fn,@RequestParam(required=false) String handle,HttpServletRequest request){
  LOGGER.info("String_Node_Str",fn,handle);
  final String fnParamName="String_Node_Str";
  final String handleParamName="String_Node_Str";
  String paramName=queryParser.getFirstParameter(request,new String[]{fnParamName,handleParamName});
  if (StringUtils.isBlank(paramName)) {
    return RestResponseUtil.createResponse400();
  }
  String paramValue=queryParser.getParameter(request,paramName);
  paramValue=DomainUtil.iso8859Decode(paramValue);
  paramValue=StringUtils.trim(paramValue);
  if (!StringUtil.isValidEntityHandleOrName(paramValue)) {
    return RestResponseUtil.createResponse400();
  }
  if (!StringUtil.checkIsValidSearchPattern(paramValue)) {
    return RestResponseUtil.createResponse422();
  }
  QueryParam queryParam=queryParser.parseEntityQueryParam(paramValue,paramName);
  LOGGER.info("String_Node_Str",queryParam);
  EntitySearch result=searchService.searchEntity(queryParam);
  if (null != result) {
    if (result.getHasNoAuthForAllObjects()) {
      return RestResponseUtil.createResponse403();
    }
    responseDecorator.decorateResponse(result);
    return RestResponseUtil.createResponse200(result);
  }
  return RestResponseUtil.createResponse404();
}
Program: 37470
Project: 37470
Buggy source:
/** 
 * test query exist.
 * @throws Exception Exception.
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExist() throws Exception {
  String entityHandle="String_Node_Str";
  mockMvc.perform(get("String_Node_Str" + entityHandle).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isOk()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(entityHandle)).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * test query exist.
 * @throws Exception Exception.
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryExist() throws Exception {
  String entityHandle="String_Node_Str";
  mockMvc.perform(get("String_Node_Str" + entityHandle).accept(MediaType.parseMediaType("String_Node_Str"))).andExpect(status().isOk()).andExpect(content().contentType("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value(CoreMatchers.hasItem("String_Node_Str"))).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").isArray()).andExpect(jsonPath("String_Node_Str",Matchers.hasItem(Matchers.hasKey("String_Node_Str")))).andExpect(jsonPath("String_Node_Str",Matchers.hasItem(Matchers.hasValue("String_Node_Str")))).andExpect(jsonPath("String_Node_Str",Matchers.hasItem(Matchers.hasValue("String_Node_Str")))).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").isArray()).andExpect(jsonPath("String_Node_Str").exists()).andExpect(jsonPath("String_Node_Str").value("String_Node_Str")).andExpect(jsonPath("String_Node_Str").value("String_Node_Str"));
}
Program: 37473
Project: 37473
Buggy source:
/** 
 * add addresses to vcard.
 * @param vcard vcard.
 * @param entity entity.
 */
private static void addAddressToVcard(VCard vcard,Entity entity){
  List<EntityAddress> addressList=entity.getAddresses();
  if (null == addressList) {
    return;
  }
  for (  EntityAddress entityAddress : addressList) {
    Address address=new Address();
    address.setPoBox(entityAddress.getPoBox());
    address.setExtendedAddress(entityAddress.getExtendedAddress());
    address.setStreetAddress(entityAddress.getStreetAddress());
    address.setLocality(entityAddress.getLocality());
    address.setRegion(entityAddress.getRegion());
    address.setPostalCode(entityAddress.getPostalCode());
    address.setCountry(entityAddress.getCountry());
    addAddressTypes(entityAddress.getTypes(),address);
    vcard.addAddress(address);
  }
}

Fixed version (ground truth):
/** 
 * add addresses to vcard.
 * @param vcard vcard.
 * @param entity entity.
 */
private static void addAddressToVcard(VCard vcard,Entity entity){
  List<EntityAddress> addressList=entity.getAddresses();
  if (null == addressList) {
    return;
  }
  for (  EntityAddress entityAddress : addressList) {
    Address address=new Address();
    address.setPoBox(entityAddress.getPoBox());
    address.setExtendedAddress(entityAddress.getExtendedAddress());
    address.setStreetAddress(entityAddress.getStreetAddress());
    address.setLocality(entityAddress.getLocality());
    address.setRegion(entityAddress.getRegion());
    address.setPostalCode(entityAddress.getPostalCode());
    address.setCountry(entityAddress.getCountry());
    addAddressTypes(entityAddress.getTypes(),address);
    setAddressPref(entityAddress,address);
    vcard.addAddress(address);
  }
}
Program: 37474
Project: 37474
Buggy source:
/** 
 * main method.
 * @param args
 */
public static void main(String[] args){
  LOGGER.info("String_Node_Str");
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * main method.
 * @param args args.
 */
public static void main(String[] args){
  LOGGER.info("String_Node_Str");
  ApplicationContext ctx=new ClassPathXmlApplicationContext("String_Node_Str");
  InitDao initDao=(InitDao)ctx.getBean("String_Node_Str");
  initDao.initSchema();
  initDao.initData();
  LOGGER.info("String_Node_Str");
}
Program: 37476
Project: 37476
Buggy source:
/** 
 * initData.
 */
public void initData(){
  LOGGER.info("String_Node_Str");
  LOGGER.info("String_Node_Str" + SQL_RESOURCE_DATA_PATH);
  initContext.executeSqlScript(jdbcTemplate,SQL_RESOURCE_DATA_PATH,databaseName,false);
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * initData.
 */
public void initData(){
  LOGGER.info("String_Node_Str");
  LOGGER.info("String_Node_Str",SQL_RESOURCE_DATA_PATH,databaseName);
  initContext.executeSqlScript(jdbcTemplate,SQL_RESOURCE_DATA_PATH,databaseName,false);
  LOGGER.info("String_Node_Str");
}
Program: 37477
Project: 37477
Buggy source:
public void setDatabaseName(String databaseName){
  this.databaseName=databaseName;
}

Fixed version (ground truth):
/** 
 * set databaseName.
 * @param databaseName databaseName.
 */
public void setDatabaseName(String databaseName){
  this.databaseName=databaseName;
}
Program: 37478
Project: 37478
Buggy source:
/** 
 * initSchema.
 */
public void initSchema(){
  LOGGER.info("String_Node_Str");
  LOGGER.info("String_Node_Str" + SQL_RESOURCE_SCHEMA_PATH);
  initContext.executeSqlScript(jdbcTemplate,SQL_RESOURCE_SCHEMA_PATH,databaseName,false);
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * init schema.
 */
public void initSchema(){
  LOGGER.info("String_Node_Str");
  LOGGER.info("String_Node_Str",SQL_RESOURCE_SCHEMA_PATH,databaseName);
  initContext.executeSqlScript(jdbcTemplate,SQL_RESOURCE_SCHEMA_PATH,databaseName,false);
  LOGGER.info("String_Node_Str");
}
Program: 37479
Project: 37479
Buggy source:
public void setInitContext(InitContext initContext){
  this.initContext=initContext;
}

Fixed version (ground truth):
/** 
 * set initContext.
 * @param initContext initContext.
 */
public void setInitContext(InitContext initContext){
  this.initContext=initContext;
}
Program: 37480
Project: 37480
Buggy source:
public void setJdbcTemplate(JdbcTemplate jdbcTemplate){
  this.jdbcTemplate=jdbcTemplate;
}

Fixed version (ground truth):
/** 
 * set jdbcTemplate.
 * @param jdbcTemplate jdbcTemplate
 */
public void setJdbcTemplate(JdbcTemplate jdbcTemplate){
  this.jdbcTemplate=jdbcTemplate;
}
Program: 37481
Project: 37481
Buggy source:
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setStartAddressForIp6(byte[] sections){
  byte[] byteStart={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  System.arraycopy(sections,0,byteStart,0,sections.length);
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  System.arraycopy(byteStart,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=highSecs[i << 1] << HIGH_BYTE + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.startHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteStart,lowSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.startLowAddress=new BigInteger(1,lowBytes);
}

Fixed version (ground truth):
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setStartAddressForIp6(byte[] sections){
  byte[] byteStart={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  System.arraycopy(sections,0,byteStart,0,sections.length);
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  System.arraycopy(byteStart,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=(highSecs[i << 1] << HIGH_BYTE) + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.startHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteStart,lowSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.startLowAddress=new BigInteger(1,lowBytes);
}
Program: 37482
Project: 37482
Buggy source:
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setEndAddressForIp6(byte[] sections){
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] byteEnd={MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F};
  System.arraycopy(sections,0,byteEnd,0,sections.length);
  System.arraycopy(byteEnd,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=highSecs[i << 1] << HIGH_BYTE + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.endHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteEnd,highSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.endLowAddress=new BigInteger(1,lowBytes);
}

Fixed version (ground truth):
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setEndAddressForIp6(byte[] sections){
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] byteEnd={MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F};
  System.arraycopy(sections,0,byteEnd,0,sections.length);
  System.arraycopy(byteEnd,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=(highSecs[i << 1] << HIGH_BYTE) + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.endHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteEnd,highSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.endLowAddress=new BigInteger(1,lowBytes);
}
Program: 37483
Project: 37483
Buggy source:
/** 
 * query and set roles.
 * @param models model list.
 */
private void queryAndSetRoles(List<Entity> models){
  List<Long> entityIds=getModelIds(models);
  List<ModelStatus> statusList=queryStatus(entityIds);
  for (  ModelStatus status : statusList) {
    BaseModel obj=BaseModel.findObjectFromListById(models,status.getId());
    if (null == obj) {
      continue;
    }
    Entity entity=(Entity)obj;
    entity.addStatus(status.getStatus());
  }
}

Fixed version (ground truth):
/** 
 * query and set roles.
 * @param models model list.
 */
private void queryAndSetRoles(List<Entity> models){
  List<Long> entityIds=getModelIds(models);
  List<EntityRole> roleList=queryRoles(entityIds);
  for (  EntityRole role : roleList) {
    BaseModel obj=BaseModel.findObjectFromListById(models,role.getId());
    if (null == obj) {
      continue;
    }
    Entity entity=(Entity)obj;
    entity.addRole(role.getRole());
  }
}
Program: 37484
Project: 37484
Buggy source:
@Override public Nameserver query(QueryParam queryParam){
  Nameserver nameserver=queryWithoutInnerObjects(queryParam);
  queryAndSetInnerObjectsWithoutNotice(nameserver);
  queryAndSetInnerNotice(nameserver);
  return nameserver;
}

Fixed version (ground truth):
@Override public Nameserver query(QueryParam queryParam){
  Nameserver nameserver=queryWithoutInnerObjects(queryParam);
  queryAndSetInnerObjects(nameserver);
  queryAndSetEntities(nameserver);
  return nameserver;
}
Program: 37485
Project: 37485
Buggy source:
@Override public List<Nameserver> search(QueryParam queryParam){
  List<Nameserver> listNS=searchWithoutInnerObjects(queryParam);
  queryAndSetNameserverStatus(listNS);
  queryAndSetInnerObjectsWithoutNotice(listNS);
  return listNS;
}

Fixed version (ground truth):
@Override public List<Nameserver> search(QueryParam queryParam){
  List<Nameserver> nameservers=searchWithoutInnerObjects(queryParam);
  queryAndSetNameserverStatus(nameservers);
  queryAndSetInnerObjects(nameservers);
  queryAndSetEntities(nameservers);
  return nameservers;
}
Program: 37486
Project: 37486
Buggy source:
/** 
 * query inner objects of nameserver,and set object value to them.
 * @param ns nameserver which inner objects value will be filled.
 */
private void queryAndSetInnerObjects(Nameserver ns){
  if (null == ns) {
    return;
  }
  Long nsID=ns.getId();
  List<IPAddress> listIPAddress=ipAddressQueryDao.queryAsInnerObjects(nsID,ModelType.NAMESERVER);
  if (listIPAddress.size() > 0) {
    IPAddress objIPAddress=listIPAddress.get(0);
    ns.setIpAddresses(objIPAddress);
  }
  List<Remark> remarks=remarkQueryDao.queryAsInnerObjects(nsID,ModelType.NAMESERVER);
  ns.setRemarks(remarks);
  List<Link> links=linkQueryDao.queryAsInnerObjects(nsID,ModelType.NAMESERVER);
  ns.setLinks(links);
  List<Event> events=eventQueryDao.queryAsInnerObjects(nsID,ModelType.NAMESERVER);
  ns.setEvents(events);
  List<Entity> entities=entityQueryDao.queryAsInnerObjects(nsID,ModelType.NAMESERVER);
  ns.setEntities(entities);
}

Fixed version (ground truth):
/** 
 * query inner objects of nameserver,and set fill them to nameserver.
 * @param nameservers nameservers list.
 */
private void queryAndSetInnerObjects(List<Nameserver> nameservers){
  if (null == nameservers) {
    return;
  }
  for (  Nameserver nameserver : nameservers) {
    queryAndSetInnerObjects(nameserver);
  }
}
Program: 37487
Project: 37487
Buggy source:
/** 
 * get parameter from request,get first if has more than one value.
 * @param request request.
 * @param name parameter name.
 * @return parameter value.
 */
public String getParameter(HttpServletRequest request,String name){
  String[] values=request.getParameterValues(name);
  if (null == values || values.length < 1) {
    return null;
  }
  String strQuery=values[0];
  int pos=strQuery.indexOf("String_Node_Str");
  if (-1 != pos) {
    try {
      strQuery=strQuery.substring(0,pos);
    }
 catch (    Exception e) {
      return null;
    }
  }
  return strQuery;
}

Fixed version (ground truth):
/** 
 * get parameter from request,get first if has more than one value.
 * @param request request.
 * @param name parameter name.
 * @return parameter value.
 */
public String getParameter(HttpServletRequest request,String name){
  String[] values=request.getParameterValues(name);
  if (null == values || values.length < 1) {
    return null;
  }
  return values[0];
}
Program: 37488
Project: 37488
Buggy source:
/** 
 * query networks for arpa ,then fill them to domain.
 * @param domain networks will be filled.
 */
private void queryAndSetInnerNetwork(Domain domain){
  if (null == domain) {
    return;
  }
  ModelType type=domain.getDomainType();
  if (ModelType.ARPA == type && StringUtils.isNotEmpty(domain.getLdhName())) {
    final Arpa arpa=Arpa.decodeArpa(domain.getLdhName());
    Network network=networkQueryDao.query(arpa.toNetworkQueryParam());
    domain.setNetwork(network);
  }
}

Fixed version (ground truth):
/** 
 * query networks for arpa ,then fill them to domain.
 * @param domain networks will be filled.
 */
private void queryAndSetInnerNetwork(Domain domain){
  if (null == domain) {
    return;
  }
  ModelType type=domain.getDomainType();
  if (ModelType.ARPA == type && StringUtils.isNotEmpty(domain.getLdhName())) {
    List<Network> networks=networkQueryDao.queryAsInnerObjects(domain.getId(),ModelType.ARPA);
    if (null != networks && networks.size() > 0) {
      Network network=networks.get(0);
      domain.setNetwork(network);
    }
  }
}
Program: 37489
Project: 37489
Buggy source:
/** 
 * search entity, without inner objects.
 * @param params query parameter.
 * @return entity list.
 */
private List<Entity> searchWithoutInnerObjects(final QueryParam params){
  EntityQueryParam entityQueryParam=(EntityQueryParam)params;
  final String q=entityQueryParam.getQ();
  final String paramName=entityQueryParam.getSearchParamName();
  final String qLikeClause=super.generateLikeClause(q);
  final String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + paramName + "String_Node_Str"+ "String_Node_Str";
  final PageBean page=params.getPageBean();
  int startPage=page.getCurrentPage() - 1;
  startPage=startPage >= 0 ? startPage : 0;
  final long startRow=startPage * page.getMaxRecords();
  List<Entity> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setString(1,qLikeClause);
      ps.setLong(2,startRow);
      ps.setLong(3,page.getMaxRecords());
      return ps;
    }
  }
,new EntityWithRoleResultSetExtractor());
  return result;
}

Fixed version (ground truth):
/** 
 * search entity, without inner objects.
 * @param params query parameter.
 * @return entity list.
 */
private List<Entity> searchWithoutInnerObjects(final QueryParam params){
  EntityQueryParam entityQueryParam=(EntityQueryParam)params;
  final String q=entityQueryParam.getQ();
  final String paramName=entityQueryParam.getSearchParamName();
  final String qLikeClause=super.generateLikeClause(q);
  final String sql="String_Node_Str" + "String_Node_Str" + paramName + "String_Node_Str"+ "String_Node_Str";
  final PageBean page=params.getPageBean();
  int startPage=page.getCurrentPage() - 1;
  startPage=startPage >= 0 ? startPage : 0;
  final long startRow=startPage * page.getMaxRecords();
  List<Entity> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setString(1,qLikeClause);
      ps.setLong(2,startRow);
      ps.setLong(3,page.getMaxRecords());
      return ps;
    }
  }
,new EntityResultSetExtractor());
  return result;
}
Program: 37490
Project: 37490
Buggy source:
@Override public List<Entity> search(QueryParam queryParam){
  List<Entity> entities=searchWithoutInnerObjects(queryParam);
  queryAndSetInnerObjectsWithoutEntities(entities);
  queryAndSetNetworksAndAs(entities);
  queryAndSetInnerEntities(entities);
  return entities;
}

Fixed version (ground truth):
@Override public List<Entity> search(QueryParam queryParam){
  List<Entity> entities=searchWithoutInnerObjects(queryParam);
  queryAndSetInnerObjectsWithoutEntities(entities);
  queryAndSetRoles(entities);
  queryAndSetNetworksAndAs(entities);
  queryAndSetInnerEntities(entities);
  return entities;
}
Program: 37491
Project: 37491
Buggy source:
@Override public ModelStatus mapRow(ResultSet rs,int rowNum) throws SQLException {
  return new ModelStatus(rs.getLong("String_Node_Str"),rs.getString("String_Node_Str"));
}

Fixed version (ground truth):
@Override public EntityRole mapRow(ResultSet rs,int rowNum) throws SQLException {
  return new EntityRole(rs.getLong("String_Node_Str"),rs.getString("String_Node_Str"));
}
Program: 37492
Project: 37492
Buggy source:
@Override public List<Network> extractData(ResultSet rs) throws SQLException {
  List<Network> result=new ArrayList<Network>();
  while (rs.next()) {
    Long networkId=rs.getLong("String_Node_Str");
    Network network=new Network();
    network.setId(networkId);
    network.setHandle(rs.getString("String_Node_Str"));
    setIpVersionAndStartEndAddress(rs,network);
    network.setName(rs.getString("String_Node_Str"));
    network.setType(rs.getString("String_Node_Str"));
    network.setCountry(rs.getString("String_Node_Str"));
    network.setParentHandle(rs.getString("String_Node_Str"));
    network.setLang(rs.getString("String_Node_Str"));
    network.setPort43(rs.getString("String_Node_Str"));
    result.add(network);
  }
  return result;
}

Fixed version (ground truth):
@Override public List<Network> extractData(ResultSet rs) throws SQLException {
  List<Network> result=new ArrayList<Network>();
  while (rs.next()) {
    Long networkId=rs.getLong("String_Node_Str");
    Network network=extractNetworkFromRs(rs,networkId);
    result.add(network);
  }
  return result;
}
Program: 37493
Project: 37493
Buggy source:
/** 
 * query network, without inner objects.Only support ENTITY!
 * @param outerObjectId entityId.
 * @return network.
 */
private List<Network> queryWithoutInnerObjectsForEntity(final Long outerObjectId){
  final String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  List<Network> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setLong(1,outerObjectId);
      ps.setString(2,ModelType.IP.getName());
      return ps;
    }
  }
,new NetworkResultSetExtractor());
  return result;
}

Fixed version (ground truth):
/** 
 * query network, without inner objects.Only support ENTITY!
 * @param outerObjectId entityId.
 * @return network.
 */
private List<Network> queryWithoutInnerObjectsForEntity(final Long outerObjectId){
  final String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  List<Network> result=jdbcTemplate.query(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    Connection connection) throws SQLException {
      PreparedStatement ps=connection.prepareStatement(sql);
      ps.setLong(1,outerObjectId);
      ps.setString(2,ModelType.IP.getName());
      return ps;
    }
  }
,new NetworkWithStatusResultSetExtractor());
  return result;
}
Program: 37494
Project: 37494
Buggy source:
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setStartAddressForIp6(byte[] sections){
  byte[] byteStart={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  System.arraycopy(sections,0,byteStart,0,sections.length);
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  System.arraycopy(byteStart,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=highSecs[i << 1] << HIGH_BYTE + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.startHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteStart,lowSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.startLowAddress=new BigInteger(1,lowBytes);
}

Fixed version (ground truth):
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setStartAddressForIp6(byte[] sections){
  byte[] byteStart={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  System.arraycopy(sections,0,byteStart,0,sections.length);
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  System.arraycopy(byteStart,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=(highSecs[i << 1] << HIGH_BYTE) + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.startHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteStart,lowSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.startLowAddress=new BigInteger(1,lowBytes);
}
Program: 37495
Project: 37495
Buggy source:
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setEndAddressForIp6(byte[] sections){
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] byteEnd={MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F};
  System.arraycopy(sections,0,byteEnd,0,sections.length);
  System.arraycopy(byteEnd,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=highSecs[i << 1] << HIGH_BYTE + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.endHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteEnd,highSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.endLowAddress=new BigInteger(1,lowBytes);
}

Fixed version (ground truth):
/** 
 * decode a byte array from in-addr.arpa to an Arpa.
 * @param sections a byte array from an arpa string.
 */
private void setEndAddressForIp6(byte[] sections){
  byte[] highSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] lowSecs=new byte[LENGTH_OF_V6_SECTIONS / 2];
  byte[] highBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] lowBytes=new byte[LENGTH_OF_V6_BYTES / 2];
  byte[] byteEnd={MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F,MASK_0F};
  System.arraycopy(sections,0,byteEnd,0,sections.length);
  System.arraycopy(byteEnd,0,highSecs,0,highSecs.length);
  for (int i=0; i < highBytes.length; i++) {
    int hb=(highSecs[i << 1] << HIGH_BYTE) + highSecs[(i << 1) + 1];
    highBytes[i]=(byte)(MASK_FF & hb);
  }
  this.endHighAddress=new BigInteger(1,highBytes);
  System.arraycopy(byteEnd,highSecs.length,lowSecs,0,lowSecs.length);
  for (int i=0; i < lowBytes.length; i++) {
    int lb=(lowSecs[i << 1] << HIGH_BYTE) + lowSecs[(i << 1) + 1];
    lowBytes[i]=(byte)(MASK_FF & lb);
  }
  this.endLowAddress=new BigInteger(1,lowBytes);
}
Program: 37497
Project: 37497
Buggy source:
/** 
 * test query exist domain.
 */
@Test @DatabaseSetup("String_Node_Str") public void testQueryArpa(){
  String domainName="String_Node_Str";
  Domain domain=domainQueryDao.query(queryParser.parseDomainQueryParam(domainName,domainName));
  assertNotNull(domain);
}

Fixed version (ground truth):
/** 
 * test query exist domain.
 */
@Test @DatabaseTearDown("String_Node_Str") @DatabaseSetup("String_Node_Str") public void testQueryArpa(){
  String domainName="String_Node_Str";
  Domain domain=domainQueryDao.query(queryParser.parseDomainQueryParam(domainName,domainName));
  assertNotNull(domain);
}
Program: 37498
Project: 37498
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Autnum query(QueryParam queryParam){
  Autnum autnum=queryWithoutInnerObjects(queryParam);
  queryAndSetInnerObjects(autnum);
  List<Entity> entities=entityQueryDao.queryAsInnerObjects(autnum.getId(),ModelType.AUTNUM);
  autnum.setEntities(entities);
  return autnum;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Autnum query(QueryParam queryParam){
  Autnum autnum=queryWithoutInnerObjects(queryParam);
  queryAndSetInnerObjects(autnum);
  queryAndSetEntities(autnum);
  return autnum;
}
Program: 37499
Project: 37499
Buggy source:
/** 
 * parseQueryIpV4Mask. use the numMask bits to get a ip range.
 * @param strQuery query ip v4 string.
 */
private void parseQueryIpV4Mask(String strQuery){
  final long numBase=2;
  final long numBytes=32;
  BigDecimal[] ipV4=IpUtil.ipV4ToDecimal(strQuery);
  long maskRangeBytes=numBytes - numMask;
  if (maskRangeBytes > 0 && maskRangeBytes <= numBytes) {
    final long maskV4High=(long)(Math.pow(numBase,maskRangeBytes) - 1L);
    final long maskV4Low=(long)Math.pow(numBase,numBytes) - maskV4High - 1L;
    long[] longIpV4=IpUtil.ipToLong(strQuery);
    long ipStart=longIpV4[1] & maskV4Low;
    long ipEnd=longIpV4[1] | maskV4High;
    ipQueryEndLow=BigDecimal.valueOf(ipEnd);
    ipQueryStartLow=BigDecimal.valueOf(ipStart);
  }
 else {
    ipQueryEndLow=ipV4[1];
    ipQueryStartLow=ipV4[1];
  }
}

Fixed version (ground truth):
/** 
 * parseQueryIpV4Mask. use the numMask bits to get a ip range.
 * @param strQuery query ip v4 string.
 */
private void parseQueryIpV4Mask(String strQuery){
  final long numBase=2;
  final long numBytes=32;
  BigDecimal[] ipV4=IpUtil.ipV4ToDecimal(strQuery);
  long maskRangeBytes=0;
  if (numMask > 0) {
    maskRangeBytes=numBytes - numMask;
  }
  if (maskRangeBytes > 0 && maskRangeBytes <= numBytes) {
    final long maskV4High=(long)(Math.pow(numBase,maskRangeBytes) - 1L);
    final long maskV4Low=(long)Math.pow(numBase,numBytes) - maskV4High - 1L;
    long[] longIpV4=IpUtil.ipToLong(strQuery);
    long ipStart=longIpV4[1] & maskV4Low;
    long ipEnd=longIpV4[1] | maskV4High;
    ipQueryEndLow=BigDecimal.valueOf(ipEnd);
    ipQueryStartLow=BigDecimal.valueOf(ipStart);
  }
 else {
    ipQueryEndLow=ipV4[1];
    ipQueryStartLow=ipV4[1];
  }
}