nus-yam/ex-repair huggingface dataset:
Program: 80281
Project: 80281
Buggy source:
protected String param2String(Object obj){
  if (obj == null)   return "String_Node_Str";
 else {
    if (obj instanceof Blob) {
      Blob blob=(Blob)obj;
      return "String_Node_Str" + blob.hashCode() + "String_Node_Str";
    }
 else     if (obj instanceof Clob) {
      Clob clob=(Clob)obj;
      return "String_Node_Str" + clob.hashCode() + "String_Node_Str";
    }
 else     if (obj instanceof byte[] || obj instanceof char[]) {
      if (Array.getLength(obj) > 10240)       return "String_Node_Str" + Array.getLength(obj) + "String_Node_Str";
    }
 else     if (obj instanceof InputStream) {
      try {
        obj="String_Node_Str" + ((InputStream)obj).available() + "String_Node_Str";
      }
 catch (      IOException e) {
      }
    }
 else     if (obj instanceof Reader) {
      obj="String_Node_Str" + obj.hashCode();
    }
    return Castors.me().castToString(obj);
  }
}

Fixed version (ground truth):
protected String param2String(Object obj){
  if (obj == null)   return "String_Node_Str";
 else {
    if (obj instanceof Blob) {
      Blob blob=(Blob)obj;
      if (blob instanceof SimpleBlob) {
        try {
          return "String_Node_Str" + blob.length() + "String_Node_Str";
        }
 catch (        SQLException e) {
        }
      }
      return "String_Node_Str" + blob.hashCode() + "String_Node_Str";
    }
 else     if (obj instanceof Clob) {
      Clob clob=(Clob)obj;
      if (clob instanceof SimpleClob) {
        try {
          return "String_Node_Str" + clob.length() + "String_Node_Str";
        }
 catch (        SQLException e) {
        }
      }
      return "String_Node_Str" + clob.hashCode() + "String_Node_Str";
    }
 else     if (obj instanceof byte[] || obj instanceof char[]) {
      if (Array.getLength(obj) > 10240)       return "String_Node_Str" + Array.getLength(obj) + "String_Node_Str";
    }
 else     if (obj instanceof InputStream) {
      try {
        obj="String_Node_Str" + ((InputStream)obj).available() + "String_Node_Str";
      }
 catch (      IOException e) {
      }
    }
 else     if (obj instanceof Reader) {
      obj="String_Node_Str" + obj.hashCode();
    }
    return Castors.me().castToString(obj);
  }
}
Program: 80282
Project: 80282
Buggy source:
@Test public void test_insert_with_id(){
  dao.clear(Pet.class);
  Pet pet=Pet.create("String_Node_Str");
  pet.setId(9090);
  Dao dao=Daos.ext(this.dao,FieldFilter.create(Pet.class,FieldMatcher.make(null,null,true).setIgnoreId(false)));
  dao.insert(pet);
  pet=dao.fetch(Pet.class);
  assertEquals(9090,pet.getId());
  dao.clear(Pet.class);
  pet=Pet.create("String_Node_Str");
  pet.setId(9090);
  dao.insert(pet,FieldFilter.create(Pet.class,FieldMatcher.create(false)));
  pet=dao.fetch(Pet.class);
  assertEquals(9090,pet.getId());
}

Fixed version (ground truth):
@Test public void test_insert_with_id(){
  dao.clear(Pet.class);
  Pet pet=Pet.create("String_Node_Str");
  pet.setId(9090);
  Dao dao=Daos.ext(this.dao,FieldFilter.create(Pet.class,FieldMatcher.make(null,null,true).setIgnoreId(false)));
  dao.fastInsert(pet);
  pet=dao.fetch(Pet.class);
  assertEquals(9090,pet.getId());
  if (dao.meta().isPostgresql()) {
    System.out.println("String_Node_Str");
    return;
  }
  dao.clear(Pet.class);
  pet=Pet.create("String_Node_Str");
  pet.setId(9090);
  dao.insert(pet,FieldFilter.create(Pet.class,FieldMatcher.create(false)));
  pet=dao.fetch(Pet.class);
  assertEquals(9090,pet.getId());
}
Program: 80283
Project: 80283
Buggy source:
public AnnotationIocLoader(String... packages){
  for (  String packageZ : packages) {
    if (packageZ.equals("String_Node_Str")) {
      String[] pkgs=Strings.splitIgnoreBlank(Mvcs.dynamic_ann_paths,"String_Node_Str");
      if (null != pkgs)       for (      String pkg : pkgs)       for (      Class<?> classZ : Scans.me().scanPackage(pkg))       addClass(classZ);
    }
 else {
      for (      Class<?> classZ : Scans.me().scanPackage(packageZ))       addClass(classZ);
    }
  }
  if (map.size() > 0) {
    if (log.isInfoEnabled())     log.infof("String_Node_Str",map.size(),packages.length,Castors.me().castToString(map.keySet()));
  }
 else {
    log.warn("String_Node_Str" + Arrays.toString(packages));
  }
}

Fixed version (ground truth):
public AnnotationIocLoader(String... packages){
  for (  String packageZ : packages) {
    for (    Class<?> classZ : Scans.me().scanPackage(packageZ))     addClass(classZ);
  }
  if (map.size() > 0) {
    if (log.isInfoEnabled())     log.infof("String_Node_Str",map.size(),packages.length,Castors.me().castToString(map.keySet()));
  }
 else {
    log.warn("String_Node_Str" + Arrays.toString(packages));
  }
}
Program: 80285
Project: 80285
Buggy source:
protected UrlMapping evalUrlMapping(NutConfig config,Class<?> mainModule,Ioc ioc) throws Exception {
  UrlMapping mapping=createUrlMapping(config);
  if (log.isInfoEnabled())   log.infof("String_Node_Str",mapping.getClass().getName());
  ViewMaker[] makers=createViewMakers(mainModule,ioc);
  ActionChainMaker maker=createChainMaker(config,mainModule);
  ActionInfo mainInfo=Loadings.createInfo(mainModule);
  Set<Class<?>> modules=Loadings.scanModules(mainModule);
  if (modules.isEmpty()) {
    if (log.isWarnEnabled())     log.warn("String_Node_Str");
  }
  int atMethods=0;
  for (  Class<?> module : modules) {
    ActionInfo moduleInfo=Loadings.createInfo(module).mergeWith(mainInfo);
    for (    Method method : module.getMethods()) {
      if (!Modifier.isPublic(method.getModifiers()) || !method.isAnnotationPresent(At.class))       continue;
      ActionInfo info=Loadings.createInfo(method).mergeWith(moduleInfo);
      info.setViewMakers(makers);
      mapping.add(maker,info,config);
      atMethods++;
    }
    if (null != moduleInfo.getPathMap()) {
      for (      Entry<String,String> en : moduleInfo.getPathMap().entrySet()) {
        config.getAtMap().add(en.getKey(),en.getValue());
      }
    }
  }
  if (atMethods == 0) {
    if (log.isWarnEnabled())     log.warn("String_Node_Str");
  }
 else {
    log.infof("String_Node_Str",atMethods);
  }
  return mapping;
}

Fixed version (ground truth):
protected UrlMapping evalUrlMapping(NutConfig config,Class<?> mainModule,Ioc ioc) throws Exception {
  UrlMapping mapping=createUrlMapping(config);
  if (log.isInfoEnabled())   log.infof("String_Node_Str",mapping.getClass().getName());
  ViewMaker[] makers=createViewMakers(mainModule,ioc);
  ActionChainMaker maker=createChainMaker(config,mainModule);
  ActionInfo mainInfo=Loadings.createInfo(mainModule);
  Set<Class<?>> modules=Loadings.scanModules(ioc,mainModule);
  if (modules.isEmpty()) {
    if (log.isWarnEnabled())     log.warn("String_Node_Str");
  }
  int atMethods=0;
  for (  Class<?> module : modules) {
    ActionInfo moduleInfo=Loadings.createInfo(module).mergeWith(mainInfo);
    for (    Method method : module.getMethods()) {
      if (!Modifier.isPublic(method.getModifiers()) || !method.isAnnotationPresent(At.class))       continue;
      ActionInfo info=Loadings.createInfo(method).mergeWith(moduleInfo);
      info.setViewMakers(makers);
      mapping.add(maker,info,config);
      atMethods++;
    }
    if (null != moduleInfo.getPathMap()) {
      for (      Entry<String,String> en : moduleInfo.getPathMap().entrySet()) {
        config.getAtMap().add(en.getKey(),en.getValue());
      }
    }
  }
  if (atMethods == 0) {
    if (log.isWarnEnabled())     log.warn("String_Node_Str");
  }
 else {
    log.infof("String_Node_Str",atMethods);
  }
  return mapping;
}
Program: 80286
Project: 80286
Buggy source:
protected ParamInjector evalInjector(Type type,Param param){
  if (param == null || "String_Node_Str".equals(param.value()))   return new JsonInjector(type,null);
  return super.evalInjector(type,param);
}

Fixed version (ground truth):
protected ParamInjector evalInjector(Type type,Param param){
  if (param == null || "String_Node_Str".equals(param.value())) {
    Class<?> clazz=Lang.getTypeClass(type);
    if (clazz != null && AdaptorErrorContext.class.isAssignableFrom(clazz))     return new VoidInjector();
    return new JsonInjector(type,null);
  }
  return super.evalInjector(type,param);
}
Program: 80287
Project: 80287
Buggy source:
/** 
 * 对一个图像进行旋转
 * @param image 图像
 * @param degree 旋转角度, 90 为顺时针九十度， -90 为逆时针九十度
 * @return 旋转后得图像对象
 */
public static BufferedImage rotate(BufferedImage image,int degree){
  int iw=image.getWidth();
  int ih=image.getHeight();
  int w=0;
  int h=0;
  int x=0;
  int y=0;
  degree=degree % 360;
  if (degree < 0)   degree=360 + degree;
  double ang=degree * 0.0174532925;
  if (degree == 180 || degree == 0 || degree == 360) {
    w=iw;
    h=ih;
  }
 else   if (degree == 90 || degree == 270) {
    w=ih;
    h=iw;
  }
 else {
    int d=iw + ih;
    w=(int)(d * Math.abs(Math.cos(ang)));
    h=(int)(d * Math.abs(Math.sin(ang)));
  }
  x=(w / 2) - (iw / 2);
  y=(h / 2) - (ih / 2);
  BufferedImage rotatedImage=new BufferedImage(w,h,image.getType());
  Graphics gs=rotatedImage.getGraphics();
  gs.fillRect(0,0,w,h);
  AffineTransform at=new AffineTransform();
  at.rotate(ang,w / 2,h / 2);
  at.translate(x,y);
  AffineTransformOp op=new AffineTransformOp(at,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
  op.filter(image,rotatedImage);
  image=rotatedImage;
  return image;
}

Fixed version (ground truth):
/** 
 * 对一个图像进行旋转
 * @param image 图像
 * @param degree 旋转角度, 90 为顺时针九十度， -90 为逆时针九十度
 * @return 旋转后得图像对象
 */
public static BufferedImage rotate(BufferedImage image,int degree){
  int iw=image.getWidth();
  int ih=image.getHeight();
  int w=0;
  int h=0;
  int x=0;
  int y=0;
  degree=degree % 360;
  if (degree < 0)   degree=360 + degree;
  double ang=degree * 0.0174532925;
  if (degree == 180 || degree == 0 || degree == 360) {
    w=iw;
    h=ih;
  }
 else   if (degree == 90 || degree == 270) {
    w=ih;
    h=iw;
  }
 else {
    int d=iw + ih;
    w=(int)(d * Math.abs(Math.cos(ang)));
    h=(int)(d * Math.abs(Math.sin(ang)));
  }
  x=(w / 2) - (iw / 2);
  y=(h / 2) - (ih / 2);
  BufferedImage rotatedImage=new BufferedImage(w,h,image.getType());
  Graphics2D gs=rotatedImage.createGraphics();
  gs.fillRect(0,0,w,h);
  AffineTransform at=new AffineTransform();
  at.rotate(ang,w / 2,h / 2);
  at.translate(x,y);
  AffineTransformOp op=new AffineTransformOp(at,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
  op.filter(image,rotatedImage);
  image=rotatedImage;
  return image;
}
Program: 80288
Project: 80288
Buggy source:
/** 
 * 自动等比缩放一个图片
 * @param im 图像对象
 * @param w 宽度
 * @param h 高度
 * @return 被转换后的图像
 */
public static BufferedImage zoomScale(BufferedImage im,int w,int h){
  int oW=im.getWidth();
  int oH=im.getHeight();
  int nW=w, nH=h;
  if (h == -1) {
    nH=(int)((float)w / oW * oH);
  }
 else   if (w == -1) {
    nW=(int)((float)h / oH * oW);
  }
  BufferedImage re=new BufferedImage(nW,nH,ColorSpace.TYPE_RGB);
  re.getGraphics().drawImage(im,0,0,nW,nH,null);
  return re;
}

Fixed version (ground truth):
/** 
 * 自动等比缩放一个图片
 * @param im 图像对象
 * @param w 宽度
 * @param h 高度
 * @return 被转换后的图像
 */
public static BufferedImage zoomScale(BufferedImage im,int w,int h){
  int oW=im.getWidth();
  int oH=im.getHeight();
  int nW=w, nH=h;
  if (h == -1) {
    nH=(int)((float)w / oW * oH);
  }
 else   if (w == -1) {
    nW=(int)((float)h / oH * oW);
  }
  BufferedImage re=new BufferedImage(nW,nH,ColorSpace.TYPE_RGB);
  re.createGraphics().drawImage(im,0,0,nW,nH,null);
  return re;
}
Program: 80289
Project: 80289
Buggy source:
/** 
 * 自动缩放剪切一个图片，令其符合给定的尺寸 <p> 如果图片太大，则将其缩小，如果图片太小，则将其放大，多余的部分被裁减
 * @param im 图像对象
 * @param w 宽度
 * @param h 高度
 * @return 被转换后的图像
 */
public static BufferedImage clipScale(BufferedImage im,int w,int h){
  int oW=im.getWidth();
  int oH=im.getHeight();
  float oR=(float)oW / (float)oH;
  float nR=(float)w / (float)h;
  int nW, nH, x, y;
  if (oR > nR) {
    nW=(h * oW) / oH;
    nH=h;
    x=(w - nW) / 2;
    y=0;
  }
 else   if (oR < nR) {
    nW=w;
    nH=(w * oH) / oW;
    x=0;
    y=(h - nH) / 2;
  }
 else {
    nW=w;
    nH=h;
    x=0;
    y=0;
  }
  BufferedImage re=new BufferedImage(w,h,ColorSpace.TYPE_RGB);
  re.getGraphics().drawImage(im,x,y,nW,nH,Color.black,null);
  return re;
}

Fixed version (ground truth):
/** 
 * 自动缩放剪切一个图片，令其符合给定的尺寸 <p> 如果图片太大，则将其缩小，如果图片太小，则将其放大，多余的部分被裁减
 * @param im 图像对象
 * @param w 宽度
 * @param h 高度
 * @return 被转换后的图像
 */
public static BufferedImage clipScale(BufferedImage im,int w,int h){
  int oW=im.getWidth();
  int oH=im.getHeight();
  float oR=(float)oW / (float)oH;
  float nR=(float)w / (float)h;
  int nW, nH, x, y;
  if (oR > nR) {
    nW=(h * oW) / oH;
    nH=h;
    x=(w - nW) / 2;
    y=0;
  }
 else   if (oR < nR) {
    nW=w;
    nH=(w * oH) / oW;
    x=0;
    y=(h - nH) / 2;
  }
 else {
    nW=w;
    nH=h;
    x=0;
    y=0;
  }
  BufferedImage re=new BufferedImage(w,h,ColorSpace.TYPE_RGB);
  re.createGraphics().drawImage(im,x,y,nW,nH,Color.black,null);
  return re;
}
Program: 80290
Project: 80290
Buggy source:
public JarResourceLocation(String jarPath){
  if (jarPath.startsWith("String_Node_Str"))   jarPath=jarPath.substring(4);
  if (jarPath.startsWith("String_Node_Str"))   jarPath=jarPath.substring("String_Node_Str".length());
  this.jarPath=jarPath;
  try {
    ZipInputStream zis=Scans.makeZipInputStream(jarPath);
    ZipEntry ens=null;
    while (null != (ens=zis.getNextEntry())) {
      if (ens.isDirectory())       continue;
      names.add(ens.getName());
    }
    zis.close();
  }
 catch (  Exception e) {
    throw Lang.wrapThrow(e);
  }
}

Fixed version (ground truth):
public JarResourceLocation(String jarPath){
  if (jarPath.startsWith("String_Node_Str"))   jarPath=jarPath.substring(4);
  if (jarPath.startsWith("String_Node_Str")) {
    jarPath=jarPath.substring("String_Node_Str".length());
    if (!new File(jarPath).exists() && !jarPath.startsWith("String_Node_Str")) {
      jarPath="String_Node_Str" + jarPath;
    }
  }
  this.jarPath=jarPath;
  ZipInputStream zis=null;
  try {
    zis=Scans.makeZipInputStream(jarPath);
    ZipEntry ens=null;
    while (null != (ens=zis.getNextEntry())) {
      if (ens.isDirectory())       continue;
      names.add(ens.getName());
    }
  }
 catch (  Throwable e) {
    throw Lang.wrapThrow(e);
  }
 finally {
    Streams.safeClose(zis);
  }
}
Program: 80291
Project: 80291
Buggy source:
public void addLoader(IocLoader loader){
  iocLoaders.add(loader);
}

Fixed version (ground truth):
public void addLoader(IocLoader loader){
  if (iocLoaders.contains(loader))   return;
  iocLoaders.add(loader);
}
Program: 80292
Project: 80292
Buggy source:
public static List<MappingField> getFieldsForUpdate(Entity<?> en,FieldMatcher fm,Object refer){
  List<MappingField> re=new ArrayList<MappingField>(en.getMappingFields().size());
  for (  MappingField mf : en.getMappingFields()) {
    if (mf.isPk()) {
      if (en.getPkType() == PkType.ID && mf.isId())       continue;
      if (en.getPkType() == PkType.NAME && mf.isName())       continue;
      if (en.getPkType() == PkType.COMPOSITE && mf.isCompositePk())       continue;
    }
    if (mf.isReadonly() || mf.isAutoIncreasement() || !mf.isUpdate())     continue;
 else     if (null != fm && null != refer && fm.isIgnoreNull() && null == mf.getValue(refer))     continue;
    if (null == fm || fm.match(mf.getName()))     re.add(mf);
  }
  if (re.isEmpty() && log.isDebugEnabled())   log.debug("String_Node_Str");
  return re;
}

Fixed version (ground truth):
public static List<MappingField> getFieldsForUpdate(Entity<?> en,FieldMatcher fm,Object refer){
  List<MappingField> re=new ArrayList<MappingField>(en.getMappingFields().size());
  for (  MappingField mf : en.getMappingFields()) {
    if (mf.isPk()) {
      if (en.getPkType() == PkType.ID && mf.isId())       continue;
      if (en.getPkType() == PkType.NAME && mf.isName())       continue;
      if (en.getPkType() == PkType.COMPOSITE && mf.isCompositePk())       continue;
    }
    if (mf.isReadonly() || mf.isAutoIncreasement() || !mf.isUpdate())     continue;
 else     if (null != fm && null != refer && fm.isIgnoreNull() && null == mf.getValue(Lang.first(refer)))     continue;
    if (null == fm || fm.match(mf.getName()))     re.add(mf);
  }
  if (re.isEmpty() && log.isDebugEnabled())   log.debug("String_Node_Str");
  return re;
}
Program: 80293
Project: 80293
Buggy source:
protected ParamInjector evalInjectorBy(Type type,Param param){
  Class<?> clazz=Lang.getTypeClass(type);
  if (clazz == null) {
    if (log.isWarnEnabled())     log.warnf("String_Node_Str",type,param);
    return null;
  }
  Type[] paramTypes=null;
  if (type instanceof ParameterizedType)   paramTypes=((ParameterizedType)type).getActualTypeArguments();
  if (null == param)   return null;
  String defaultValue=null;
  if (param.df() != null && !ParamDefailtTag.equals(param.df()))   defaultValue=param.df();
  String pm=param.value();
  String datefmt=param.dfmt();
  if ("String_Node_Str".equals(pm)) {
    if (Map.class.isAssignableFrom(clazz)) {
      return new MapPairInjector(type);
    }
    return new ObjectPairInjector(null,type);
  }
 else   if (pm.startsWith("String_Node_Str") && pm.length() > 2) {
    return new ObjectNavlPairInjector(pm.substring(2),type);
  }
 else   if (clazz.isArray())   return new ArrayInjector(pm,null,type,paramTypes,defaultValue);
  return getNameInjector(pm,datefmt,type,paramTypes,defaultValue);
}

Fixed version (ground truth):
protected ParamInjector evalInjectorBy(Type type,Param param){
  Class<?> clazz=Lang.getTypeClass(type);
  if (clazz == null) {
    if (log.isWarnEnabled())     log.warnf("String_Node_Str",type,param);
    return null;
  }
  Type[] paramTypes=null;
  if (type instanceof ParameterizedType)   paramTypes=((ParameterizedType)type).getActualTypeArguments();
  if (null == param)   return null;
  String defaultValue=null;
  if (param.df() != null && !ParamDefailtTag.equals(param.df()))   defaultValue=param.df();
  String pm=param.value();
  String datefmt=param.dfmt();
  if ("String_Node_Str".equals(pm)) {
    if (Map.class.isAssignableFrom(clazz)) {
      return new MapPairInjector(type);
    }
    return new ObjectPairInjector(null,type);
  }
 else   if (pm.startsWith("String_Node_Str") && pm.length() > 2) {
    return new ObjectNavlPairInjector(pm.substring(2),type);
  }
 else   if (clazz.isArray()) {
    return new ArrayInjector(pm,null,type,paramTypes,defaultValue,param.array_auto_split());
  }
  return getNameInjector(pm,datefmt,type,paramTypes,defaultValue);
}
Program: 80294
Project: 80294
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Object get(ServletContext sc,HttpServletRequest req,HttpServletResponse resp,Object refer){
  Object value=null;
  if (null != refer) {
    if (refer instanceof Map) {
      value=((Map<String,Object>)refer).get(name);
      if (value != null && value.getClass().isArray())       return Lang.array2array(value,klass.getComponentType());
    }
    if (value != null)     return convertMe(value);
  }
  String[] values=req.getParameterValues(name);
  if (null == values || values.length == 0)   return null;
  if (values.length == 1) {
    return convertMe(values[0]);
  }
  return Lang.array2array(values,klass.getComponentType());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Object get(ServletContext sc,HttpServletRequest req,HttpServletResponse resp,Object refer){
  Object value=null;
  if (null != refer) {
    if (refer instanceof Map) {
      value=((Map<String,Object>)refer).get(name);
      if (value != null && value.getClass().isArray())       return Lang.array2array(value,klass.getComponentType());
    }
    if (value != null)     return convertMe(value);
  }
  String[] values=req.getParameterValues(name);
  if (null == values || values.length == 0)   return null;
  if (values.length == 1 && auto_split) {
    return convertMe(values[0]);
  }
  return Lang.array2array(values,klass.getComponentType());
}
Program: 80295
Project: 80295
Buggy source:
public ArrayInjector(String name,String datefmt,Type type,Type[] paramTypes,String defaultValue){
  super(name,datefmt,type,paramTypes,defaultValue);
}

Fixed version (ground truth):
public ArrayInjector(String name,String datefmt,Type type,Type[] paramTypes,String defaultValue,boolean auto_split){
  super(name,datefmt,type,paramTypes,defaultValue);
  this.auto_split=auto_split;
}
Program: 80296
Project: 80296
Buggy source:
protected Response createResponse(Map<String,String> reHeaders) throws IOException {
  Response rep=null;
  if (reHeaders != null) {
    rep=new Response(conn,reHeaders);
    if (rep.isOK()) {
      InputStream is1=conn.getInputStream();
      InputStream is2=null;
      String encoding=conn.getContentEncoding();
      if (encoding != null && encoding.contains("String_Node_Str")) {
        is2=new GZIPInputStream(is1);
      }
 else       if (encoding != null && encoding.contains("String_Node_Str")) {
        is2=new InflaterInputStream(is1,new Inflater(true));
      }
 else {
        is2=is1;
      }
      BufferedInputStream is=new BufferedInputStream(is2);
      rep.setStream(is);
    }
 else {
      try {
        rep.setStream(conn.getInputStream());
      }
 catch (      IOException e) {
        rep.setStream(new NullInputStream());
      }
    }
  }
  return rep;
}

Fixed version (ground truth):
protected Response createResponse(Map<String,String> reHeaders) throws IOException {
  Response rep=null;
  if (reHeaders != null) {
    rep=new Response(conn,reHeaders);
    if (rep.isOK()) {
      InputStream is1=conn.getInputStream();
      InputStream is2=null;
      String encoding=conn.getContentEncoding();
      if (encoding != null && encoding.contains("String_Node_Str")) {
        is2=new GZIPInputStream(is1);
      }
 else       if (encoding != null && encoding.contains("String_Node_Str")) {
        is2=new InflaterInputStream(is1,new Inflater(true));
      }
 else {
        is2=is1;
      }
      BufferedInputStream is=new BufferedInputStream(is2);
      rep.setStream(is);
    }
 else {
      try {
        rep.setStream(conn.getInputStream());
      }
 catch (      IOException e) {
        try {
          rep.setStream(conn.getErrorStream());
        }
 catch (        Exception e1) {
          rep.setStream(new NullInputStream());
        }
      }
    }
  }
  return rep;
}
Program: 80297
Project: 80297
Buggy source:
public static String fromMillisCN(long mi){
  return _fromMillis(mi,TIME_S_CN,TIME_M_CN,TIME_H_CN,TIME_D_CN);
}

Fixed version (ground truth):
/** 
 * fromMillis的中文版本 1000 -> 1秒 120000 - 2分
 * @param mi 毫秒数
 * @return 可读的文字
 */
public static String fromMillisCN(long mi){
  return _fromMillis(mi,false);
}
Program: 80298
Project: 80298
Buggy source:
public static String _fromMillis(long mi,String S,String M,String H,String D){
  if (mi < T_1S) {
    return "String_Node_Str";
  }
  if (mi < T_1M) {
    return (int)mi / T_1S + S;
  }
  if (mi >= T_1M && mi < T_1H) {
    int m=(int)mi / T_1M;
    return m + M + fromMillis(mi - m * T_1M);
  }
  if (mi >= T_1H && mi < T_1D) {
    int h=(int)mi / T_1H;
    return h + H + fromMillis(mi - h * T_1H);
  }
  int d=(int)mi / T_1D;
  return d + D + fromMillis(mi - d * T_1D);
}

Fixed version (ground truth):
private static String _fromMillis(long mi,boolean useEnglish){
  if (mi <= T_1S) {
    return "String_Node_Str" + (useEnglish ? TIME_S_EN : TIME_S_CN);
  }
  if (mi < T_1M && mi > T_1S) {
    return (int)(mi / T_1S) + (useEnglish ? TIME_S_EN : TIME_S_CN);
  }
  if (mi >= T_1M && mi < T_1H) {
    int m=(int)(mi / T_1M);
    return m + (useEnglish ? TIME_M_EN : TIME_M_CN) + _fromMillis(mi - m * T_1M,useEnglish);
  }
  if (mi >= T_1H && mi < T_1D) {
    int h=(int)(mi / T_1H);
    return h + (useEnglish ? TIME_H_EN : TIME_H_CN) + _fromMillis(mi - h * T_1H,useEnglish);
  }
  if (mi >= T_1D) {
    int d=(int)(mi / T_1D);
    return d + (useEnglish ? TIME_D_EN : TIME_D_CN) + _fromMillis(mi - d * T_1D,useEnglish);
  }
  throw Lang.impossible();
}
Program: 80299
Project: 80299
Buggy source:
/** 
 * 一段时间长度的毫秒数转换为一个时间长度的字符串 1000 -> 1s 120000 - 2m
 * @param mi 毫秒数
 * @return 可以正常识别的文字
 */
public static String fromMillis(long mi){
  return _fromMillis(mi,TIME_S_EN,TIME_M_EN,TIME_H_EN,TIME_D_EN);
}

Fixed version (ground truth):
/** 
 * 一段时间长度的毫秒数转换为一个时间长度的字符串 1000 -> 1S 120000 - 2M
 * @param mi 毫秒数
 * @return 可读的文字
 */
public static String fromMillis(long mi){
  return _fromMillis(mi,true);
}
Program: 80300
Project: 80300
Buggy source:
protected void openConnection() throws IOException {
  ProxySwitcher proxySwitcher=Http.proxySwitcher;
  if (proxySwitcher != null) {
    try {
      Proxy proxy=proxySwitcher.getProxy(request);
      if (proxy != null) {
        if (Http.autoSwitch) {
          Socket socket=null;
          try {
            socket=new Socket();
            socket.connect(proxy.address(),5 * 1000);
          }
  finally {
            if (socket != null)             socket.close();
          }
        }
        conn=(HttpURLConnection)request.getUrl().openConnection(proxy);
        conn.setConnectTimeout(Default_Conn_Timeout);
        if (timeout > 0)         conn.setReadTimeout(timeout);
 else         conn.setReadTimeout(Default_Read_Timeout);
        return;
      }
    }
 catch (    IOException e) {
      if (!Http.autoSwitch) {
        throw e;
      }
      log.info("String_Node_Str",e);
    }
  }
  conn=(HttpURLConnection)request.getUrl().openConnection();
  conn.setConnectTimeout(Default_Conn_Timeout);
  if (timeout > 0)   conn.setReadTimeout(timeout);
 else   conn.setReadTimeout(Default_Read_Timeout);
}

Fixed version (ground truth):
protected void openConnection() throws IOException {
  ProxySwitcher proxySwitcher=Http.proxySwitcher;
  if (proxySwitcher != null) {
    try {
      Proxy proxy=proxySwitcher.getProxy(request);
      if (proxy != null) {
        if (Http.autoSwitch) {
          Socket socket=null;
          try {
            socket=new Socket();
            socket.connect(proxy.address(),5 * 1000);
          }
  finally {
            if (socket != null)             socket.close();
          }
        }
        conn=(HttpURLConnection)request.getUrl().openConnection(proxy);
        conn.setConnectTimeout(Default_Conn_Timeout);
        if (timeout > 0)         conn.setReadTimeout(timeout);
 else         conn.setReadTimeout(Default_Read_Timeout);
        return;
      }
    }
 catch (    IOException e) {
      if (!Http.autoSwitch) {
        throw e;
      }
      log.info("String_Node_Str",e);
    }
  }
  conn=(HttpURLConnection)request.getUrl().openConnection();
  conn.setConnectTimeout(Default_Conn_Timeout);
  conn.setRequestMethod(request.getMethod().name());
  if (timeout > 0)   conn.setReadTimeout(timeout);
 else   conn.setReadTimeout(Default_Read_Timeout);
}
Program: 80301
Project: 80301
Buggy source:
public static Sender create(Request request,int timeout){
  Sender sender=request.isGet() ? new GetSender(request) : new PostSender(request);
  return sender.setTimeout(timeout);
}

Fixed version (ground truth):
public static Sender create(Request request,int timeout){
  Sender sender=request.isGet() || request.isDelete() ? new GetSender(request) : new PostSender(request);
  return sender.setTimeout(timeout);
}
Program: 80302
Project: 80302
Buggy source:
private void insertRecords(int len){
  for (int i=0; i < len; i++) {
    Pet pet=Pet.create("String_Node_Str" + i);
    pet.setNickName("String_Node_Str" + i);
    dao.insert(pet);
  }
}

Fixed version (ground truth):
private void insertRecords(int len){
  for (int i=0; i < len; i++) {
    Pet pet=Pet.create("String_Node_Str" + i);
    pet.setNickName("String_Node_Str" + i);
    pet.setPrice(R.random(30,100) / 3.1415f);
    dao.insert(pet);
  }
}
Program: 80303
Project: 80303
Buggy source:
@Test public void test_escape_char(){
  if (dao.meta().isMySql()) {
    dao.insert(Pet.create("String_Node_Str").setNickName("String_Node_Str"));
    dao.insert(Pet.create("String_Node_Str").setNickName("String_Node_Str"));
    Criteria cri=Cnd.cri();
    cri.where().andLike("String_Node_Str","String_Node_Str");
    List<Pet> pets=dao.query(Pet.class,cri);
    assertEquals(1,pets.size());
    assertEquals("String_Node_Str",pets.get(0).getName());
  }
}

Fixed version (ground truth):
/** 
 * for issue #515 写给 mysql 一个特殊的例子
 */
@Test public void test_escape_char(){
  if (dao.meta().isMySql()) {
    dao.insert(Pet.create("String_Node_Str").setNickName("String_Node_Str"));
    dao.insert(Pet.create("String_Node_Str").setNickName("String_Node_Str"));
    Criteria cri=Cnd.cri();
    cri.where().andLike("String_Node_Str","String_Node_Str");
    List<Pet> pets=dao.query(Pet.class,cri);
    assertEquals(1,pets.size());
    assertEquals("String_Node_Str",pets.get(0).getName());
  }
}
Program: 80305
Project: 80305
Buggy source:
public void doFilter(ServletRequest req,ServletResponse resp,FilterChain chain) throws IOException, ServletException {
  if (proxyFilter != null) {
    proxyFilter.doFilter(req,resp,chain);
    return;
  }
  HttpServletRequest request=(HttpServletRequest)req;
  HttpServletResponse response=(HttpServletResponse)resp;
  RequestPath path=Mvcs.getRequestPathObject(request);
  String matchUrl=path.getUrl();
  String preName=Mvcs.getName();
  Context preContext=Mvcs.resetALL();
  try {
    if (sp != null)     req=sp.filter(request,response,Mvcs.getServletContext());
    Mvcs.set(this.selfName,request,response);
    if (!isExclusion(matchUrl)) {
      if (handler.handle(request,response))       return;
    }
    nextChain(request,response,chain);
  }
  finally {
    Mvcs.resetALL();
    if (null != (request.getAttribute("String_Node_Str"))) {
      if (preName != null)       Mvcs.set(preName,request,response);
      if (preContext != null)       Mvcs.ctx.reqThreadLocal.set(preContext);
    }
  }
}

Fixed version (ground truth):
public void doFilter(final ServletRequest req,final ServletResponse resp,final FilterChain chain) throws IOException, ServletException {
  if (proxyFilter != null) {
    proxyFilter.doFilter(req,resp,chain);
    return;
  }
  HttpServletRequest request=(HttpServletRequest)req;
  HttpServletResponse response=(HttpServletResponse)resp;
  RequestPath path=Mvcs.getRequestPathObject(request);
  String matchUrl=path.getUrl();
  String preName=Mvcs.getName();
  Context preContext=Mvcs.resetALL();
  try {
    if (sp != null)     request=sp.filter(request,response,Mvcs.getServletContext());
    Mvcs.set(this.selfName,request,response);
    if (!isExclusion(matchUrl)) {
      if (handler.handle(request,response))       return;
    }
    nextChain(request,response,chain);
  }
  finally {
    Mvcs.resetALL();
    if (null != (request.getAttribute("String_Node_Str"))) {
      if (preName != null)       Mvcs.set(preName,request,response);
      if (preContext != null)       Mvcs.ctx.reqThreadLocal.set(preContext);
    }
  }
}
Program: 80306
Project: 80306
Buggy source:
public HttpServletRequest filter(final HttpServletRequest req,final HttpServletResponse resp,final ServletContext servletContext){
  return new HttpServletRequestWrapper(req){
    private HttpSession session;
    public HttpSession getSession(    boolean create){
      if (create && session == null) {
synchronized (lock) {
          if (session == null)           session=createSession(req,resp,servletContext);
        }
      }
      return session;
    }
  }
;
}

Fixed version (ground truth):
public HttpServletRequest filter(final HttpServletRequest req,final HttpServletResponse resp,final ServletContext servletContext){
  return new SessionProviderHttpServletRequestWrapper(req,resp,servletContext);
}
Program: 80307
Project: 80307
Buggy source:
public HttpSession getSession(boolean create){
  if (create && session == null) {
synchronized (lock) {
      if (session == null)       session=createSession(req,resp,servletContext);
    }
  }
  return session;
}

Fixed version (ground truth):
public HttpSession getSession(){
  return getSession(true);
}
Program: 80308
Project: 80308
Buggy source:
/** 
 * 在指定的时间点开始以固定的频率运行任务。后续任务的启动时间不受前次任务延时影响。
 * @param task 具体待执行的任务
 * @param startTime 首次运行的时间点
 * @param period 每次执行任务的间隔时间
 * @param unit 时间单位
 */
public static void scheduleAtFixedRate(final Runnable task,Date startTime,final long period,final TimeUnit unit){
  final Timer timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      taskScheduler.scheduleAtFixedRate(task,0,period,unit);
      timer.cancel();
    }
  }
,startTime);
}

Fixed version (ground truth):
/** 
 * 在指定的时间点开始以固定的频率运行任务。后续任务的启动时间不受前次任务延时影响。
 * @param task 具体待执行的任务
 * @param startTime 首次运行的时间点
 * @param period 每次执行任务的间隔时间
 * @param unit 时间单位
 */
public static void scheduleAtFixedRate(final Runnable task,Date startTime,final long period,final TimeUnit unit){
  final Timer timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      taskScheduler.scheduleAtFixedRate(task,0,period,unit);
      timer.cancel();
      timerList.remove(timer);
    }
  }
,startTime);
  timerList.add(timer);
}
Program: 80309
Project: 80309
Buggy source:
/** 
 * 在指定的时间点启动，两次任务间保持固定的时间间隔
 * @param task 具体待执行的任务
 * @param startTime 首次运行的时间点
 * @param period 两次任务的间隔时间
 * @param unit 时间单位
 */
public static void scheduleWithFixedDelay(final Runnable task,Date startTime,final long period,final TimeUnit unit){
  final Timer timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      taskScheduler.scheduleWithFixedDelay(task,0,period,unit);
      timer.cancel();
    }
  }
,startTime);
}

Fixed version (ground truth):
/** 
 * 在指定的时间点启动，两次任务间保持固定的时间间隔
 * @param task 具体待执行的任务
 * @param startTime 首次运行的时间点
 * @param period 两次任务的间隔时间
 * @param unit 时间单位
 */
public static void scheduleWithFixedDelay(final Runnable task,Date startTime,final long period,final TimeUnit unit){
  final Timer timer=new Timer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      taskScheduler.scheduleWithFixedDelay(task,0,period,unit);
      timer.cancel();
      timerList.remove(timer);
    }
  }
,startTime);
  timerList.add(timer);
}
Program: 80310
Project: 80310
Buggy source:
@Override public void run(){
  taskScheduler.scheduleWithFixedDelay(task,0,period,unit);
  timer.cancel();
}

Fixed version (ground truth):
@Override public void run(){
  taskScheduler.scheduleWithFixedDelay(task,0,period,unit);
  timer.cancel();
  timerList.remove(timer);
}
Program: 80311
Project: 80311
Buggy source:
/** 
 * 关闭定时任务服务 <p>系统关闭时可调用此方法终止正在执行的定时任务，一旦关闭后不允许再向线程池中添加任务，否则会报RejectedExecutionException异常</p>
 */
public static void depose(){
  List<Runnable> awaitingExecution=taskScheduler.shutdownNow();
  logger.infof("String_Node_Str",awaitingExecution.size());
}

Fixed version (ground truth):
/** 
 * 关闭定时任务服务 <p>系统关闭时可调用此方法终止正在执行的定时任务，一旦关闭后不允许再向线程池中添加任务，否则会报RejectedExecutionException异常</p>
 */
public static void depose(){
  int timerNum=timerList.size();
synchronized (timerList) {
    for (    Timer t : timerList)     t.cancel();
    timerList.clear();
  }
  List<Runnable> awaitingExecution=taskScheduler.shutdownNow();
  logger.infof("String_Node_Str",timerNum + awaitingExecution.size());
}
Program: 80312
Project: 80312
Buggy source:
public void add(ActionChainMaker maker,ActionInfo ai,NutConfig config){
  String[] paths=ai.getPaths();
  for (int i=0; i < paths.length; i++) {
    String path=paths[i];
    if (Strings.isBlank(path))     throw new BlankAtException(ai.getModuleType(),ai.getMethod());
    if (path.charAt(0) != '/')     paths[i]='/' + path;
  }
  ActionChain chain=maker.eval(config,ai);
  for (  String path : ai.getPaths()) {
    ActionInvoker invoker=map.get(path);
    if (null == invoker) {
      invoker=new ActionInvoker();
      map.put(path,invoker);
      root.add(path,invoker);
      config.getAtMap().addMethod(path,ai.getMethod());
    }
    if (ai.isForSpecialHttpMethod()) {
      for (      String httpMethod : ai.getHttpMethods())       invoker.addChain(httpMethod,chain);
    }
 else {
      invoker.setDefaultChain(chain);
    }
  }
  printActionMapping(ai);
  if (!Strings.isBlank(ai.getPathKey()))   config.getAtMap().add(ai.getPathKey(),ai.getPaths()[0]);
}

Fixed version (ground truth):
public void add(ActionChainMaker maker,ActionInfo ai,NutConfig config){
  String[] paths=ai.getPaths();
  for (int i=0; i < paths.length; i++) {
    String path=paths[i];
    if (Strings.isBlank(path))     throw new BlankAtException(ai.getModuleType(),ai.getMethod());
    if (path.charAt(0) != '/')     paths[i]='/' + path;
  }
  ActionChain chain=maker.eval(config,ai);
  for (  String path : ai.getPaths()) {
    ActionInvoker invoker=map.get(path);
    if (null == invoker) {
      invoker=new ActionInvoker();
      map.put(path,invoker);
      root.add(path,invoker);
      config.getAtMap().addMethod(path,ai.getMethod());
    }
 else     if (!ai.isForSpecialHttpMethod()) {
      log.debugf("String_Node_Str" + path);
    }
    if (ai.isForSpecialHttpMethod()) {
      for (      String httpMethod : ai.getHttpMethods())       invoker.addChain(httpMethod,chain);
    }
 else {
      invoker.setDefaultChain(chain);
    }
  }
  printActionMapping(ai);
  if (!Strings.isBlank(ai.getPathKey()))   config.getAtMap().add(ai.getPathKey(),ai.getPaths()[0]);
}
Program: 80313
Project: 80313
Buggy source:
/** 
 * 从给定 offs 尽力匹配给出的数组。 <p> 需要注意的是，如果返回的是 >0 的数，内部的标志位将被设置到第一个匹配字符，以便 DUMP 内容。 <br> 所以，如果下一个节点给出的结论是 -1，但是 'l' 并不是0，那么说明这个匹配是失败的，需要将 本节点的 r 置到 max 处。 <p> 返回值 <ul> <li><b>-1</b> - 全部被匹配 <li><b>0</b> - 未发现匹配 <li><b>大于 0</b> - 在缓冲的末尾发现匹配，但是没有匹配全，希望下一个节点继续从这个位置匹配 </ul>
 * @param bs 数组
 * @return -1, 0 或者 +n
 */
int mark(byte[] bs,int[] fails){
  if (!isLoaded)   throw new MarkUnloadedRingItemException();
  byte start=bs[0];
  for (; r < max; r++) {
    if (buffer[r] == start) {
      int re=0;
      int j=r;
      while (true) {
        re++;
        j++;
        if (re == bs.length) {
          nextmark=j;
          return -1;
        }
        if (j == max) {
          nextmark=max;
          if (isStreamEnd) {
            r=max;
            return 0;
          }
          return re;
        }
        if (bs[re] != buffer[j]) {
          re=fails[re];
          if (bs[re] != buffer[j]) {
            break;
          }
 else {
            r+=re == 0 ? 1 : re;
          }
        }
      }
      r=j;
    }
  }
  nextmark=max;
  return 0;
}

Fixed version (ground truth):
/** 
 * 从给定 offs 尽力匹配给出的数组。 <p> 需要注意的是，如果返回的是 >0 的数，内部的标志位将被设置到第一个匹配字符，以便 DUMP 内容。 <br> 所以，如果下一个节点给出的结论是 -1，但是 'l' 并不是0，那么说明这个匹配是失败的，需要将 本节点的 r 置到 max 处。 <p> 返回值 <ul> <li><b>-1</b> - 全部被匹配 <li><b>0</b> - 未发现匹配 <li><b>大于 0</b> - 在缓冲的末尾发现匹配，但是没有匹配全，希望下一个节点继续从这个位置匹配 </ul>
 * @param bs 数组
 * @return -1, 0 或者 +n
 */
int mark(byte[] bs,int[] fails){
  if (!isLoaded)   throw new MarkUnloadedRingItemException();
  byte start=bs[0];
  for (; r < max; r++) {
    if (buffer[r] == start) {
      int re=0;
      int j=r;
      while (true) {
        re++;
        j++;
        if (re == bs.length) {
          nextmark=j;
          return -1;
        }
        if (j == max) {
          nextmark=max;
          if (isStreamEnd) {
            r=max;
            return 0;
          }
          return re;
        }
        if (bs[re] != buffer[j]) {
          re=fails[re];
          if (bs[re] != buffer[j]) {
            break;
          }
 else           if (re == 0) {
            r=j;
          }
 else {
            r+=re == 0 ? 1 : re;
          }
        }
      }
      r=j;
    }
  }
  nextmark=max;
  return 0;
}
Program: 80314
Project: 80314
Buggy source:
/** 
 * 根据字符串得到相对于 "UTC 1970-01-01 00:00:00" 的绝对毫秒数。 本函数假想给定的时间字符串是本地时间。所以计算出来结果后，还需要减去时差 支持的时间格式字符串为: <pre> yyyy-MM-dd HH:mm:ss yyyy-MM-dd HH:mm:ss.SSS yy-MM-dd HH:mm:ss; yy-MM-dd HH:mm:ss.SSS; yyyy-MM-dd; yy-MM-dd; HH:mm:ss; HH:mm:ss.SSS; </pre>
 * @param ds 时间字符串
 * @param tz 你给定的时间字符串是属于哪个时区的
 * @return 时间
 */
public static long ams(String ds,TimeZone tz){
  Matcher m=_P_TIME.matcher(ds);
  if (m.find()) {
    int yy=_int(m,2,1970);
    int MM=_int(m,4,1);
    int dd=_int(m,6,1);
    int HH=_int(m,9,0);
    int mm=_int(m,11,0);
    int ss=_int(m,13,0);
    int ms=_int(m,16,0);
    long day=(long)D1970(yy,MM,dd);
    long MS=day * 86400000L;
    MS+=(((long)HH) * 3600L + ((long)mm) * 60L + ss) * 1000L;
    MS+=(long)ms;
    long tzOffset;
    if (null == tz) {
      if (!Strings.isBlank(m.group(17))) {
        tzOffset=Long.parseLong(m.group(19)) * 3600000L * (m.group(18).charAt(0) == '-' ? -1 : 1);
      }
 else {
        tzOffset=TimeZone.getDefault().getRawOffset();
      }
    }
 else {
      tzOffset=tz.getRawOffset();
    }
    return MS - tzOffset;
  }
  throw Lang.makeThrow("String_Node_Str",ds);
}

Fixed version (ground truth):
/** 
 * 根据字符串得到相对于 "UTC 1970-01-01 00:00:00" 的绝对毫秒数。 本函数假想给定的时间字符串是本地时间。所以计算出来结果后，还需要减去时差 支持的时间格式字符串为: <pre> yyyy-MM-dd HH:mm:ss yyyy-MM-dd HH:mm:ss.SSS yy-MM-dd HH:mm:ss; yy-MM-dd HH:mm:ss.SSS; yyyy-MM-dd; yy-MM-dd; HH:mm:ss; HH:mm:ss.SSS; </pre> 时间字符串后面可以跟 +8 或者 +8:00 表示 GMT+8:00 时区。 同理 -9 或者 -9:00 表示 GMT-9:00 时区
 * @param ds 时间字符串
 * @param tz 你给定的时间字符串是属于哪个时区的
 * @return 时间
 * @see #_P_TIME
 */
public static long ams(String ds,TimeZone tz){
  Matcher m=_P_TIME.matcher(ds);
  if (m.find()) {
    int yy=_int(m,2,1970);
    int MM=_int(m,4,1);
    int dd=_int(m,6,1);
    int HH=_int(m,9,0);
    int mm=_int(m,11,0);
    int ss=_int(m,13,0);
    int ms=_int(m,16,0);
    long day=(long)D1970(yy,MM,dd);
    long MS=day * 86400000L;
    MS+=(((long)HH) * 3600L + ((long)mm) * 60L + ss) * 1000L;
    MS+=(long)ms;
    if (null == tz) {
      if (!Strings.isBlank(m.group(17))) {
        tz=TimeZone.getTimeZone(String.format("String_Node_Str",m.group(18),m.group(19)));
      }
 else {
        tz=TimeZone.getDefault();
      }
    }
    return MS - tz.getRawOffset() - tz.getDSTSavings();
  }
  throw Lang.makeThrow("String_Node_Str",ds);
}
Program: 80315
Project: 80315
Buggy source:
protected void _runExec(Connection conn,DaoStatement st) throws SQLException {
  if (st.getContext().getPager() != null) {
    throw Lang.makeThrow(DaoException.class,"String_Node_Str" + st);
  }
  String sql=st.toPreparedStatement();
  if (log.isDebugEnabled())   log.debug(sql);
  Object[][] paramMatrix=st.getParamMatrix();
  CallableStatement stmt=null;
  ResultSet rs=null;
  try {
    stmt=conn.prepareCall(sql);
    ValueAdaptor[] adaptors=st.getAdaptors();
    if (paramMatrix != null && paramMatrix.length > 0) {
      for (int i=0; i < paramMatrix[0].length; i++) {
        adaptors[i].set((PreparedStatement)stmt,paramMatrix[0][i],i + 1);
      }
    }
    stmt.execute();
    rs=stmt.getResultSet();
    try {
      st.onAfter(conn,rs);
    }
  finally {
      if (rs != null)       rs.close();
    }
    while (true) {
      if (stmt.getMoreResults()) {
        rs=stmt.getResultSet();
        try {
          if (rs != null)           st.onAfter(conn,rs);
        }
  finally {
          if (rs != null)           rs.close();
        }
      }
      break;
    }
  }
  finally {
    stmt.close();
  }
}

Fixed version (ground truth):
protected void _runExec(Connection conn,DaoStatement st) throws SQLException {
  if (st.getContext().getPager() != null) {
    throw Lang.makeThrow(DaoException.class,"String_Node_Str" + st);
  }
  String sql=st.toPreparedStatement();
  if (log.isDebugEnabled())   log.debug(sql);
  Object[][] paramMatrix=st.getParamMatrix();
  CallableStatement stmt=null;
  ResultSet rs=null;
  try {
    stmt=conn.prepareCall(sql);
    ValueAdaptor[] adaptors=st.getAdaptors();
    if (paramMatrix != null && paramMatrix.length > 0) {
      for (int i=0; i < paramMatrix[0].length; i++) {
        adaptors[i].set((PreparedStatement)stmt,paramMatrix[0][i],i + 1);
      }
    }
    stmt.execute();
    rs=stmt.getResultSet();
    try {
      st.onAfter(conn,rs);
    }
  finally {
      if (rs != null)       rs.close();
    }
    while (true) {
      if (stmt.getMoreResults()) {
        rs=stmt.getResultSet();
        try {
          if (rs != null)           st.onAfter(conn,rs);
        }
  finally {
          if (rs != null)           rs.close();
        }
      }
      break;
    }
  }
  finally {
    if (stmt != null)     stmt.close();
  }
}
Program: 80316
Project: 80316
Buggy source:
public Record(){
  map=new HashMap<String,Object>();
  sqlTypeMap=new HashMap<String,Integer>();
}

Fixed version (ground truth):
public Record(){
  map=new LinkedHashMap<String,Object>();
  sqlTypeMap=new HashMap<String,Integer>();
}
Program: 80318
Project: 80318
Buggy source:
/** 
 * 这是最后的大招了,查一下形参的名字,作为@Param("形参名")进行处理
 */
protected ParamInjector paramNameInject(Method method,int index){
  List<String> names=MethodParamNamesScaner.getParamNames(method);
  if (names != null)   return new NameInjector(names.get(index),null,method.getParameterTypes()[index],null);
 else   if (log.isInfoEnabled())   log.infof("String_Node_Str",index,method);
  return new PathArgInjector(method.getParameterTypes()[index]);
}

Fixed version (ground truth):
/** 
 * 这是最后的大招了,查一下形参的名字,作为@Param("形参名")进行处理
 */
protected ParamInjector paramNameInject(Method method,int index){
  if (!Lang.isAndroid) {
    List<String> names=MethodParamNamesScaner.getParamNames(method);
    if (names != null)     return new NameInjector(names.get(index),null,method.getParameterTypes()[index],null);
 else     if (log.isInfoEnabled())     log.infof("String_Node_Str",index,method);
  }
  return new PathArgInjector(method.getParameterTypes()[index]);
}
Program: 80319
Project: 80319
Buggy source:
/** 
 * 测试此字符串是否被指定的左字符串和右字符串所包裹
 * @param str 字符串
 * @param l 左字符串
 * @param r 右字符串
 * @return 字符串是被左字符串和右字符串包裹
 */
public static boolean isQuoteBy(String str,String l,String r){
  if (null == str && null != l && null != r)   return false;
  return str.startsWith(l) && str.endsWith(r);
}

Fixed version (ground truth):
/** 
 * 测试此字符串是否被指定的左字符串和右字符串所包裹
 * @param str 字符串
 * @param l 左字符串
 * @param r 右字符串
 * @return 字符串是被左字符串和右字符串包裹
 */
public static boolean isQuoteBy(String str,String l,String r){
  if (null == str || null == l || null == r)   return false;
  return str.startsWith(l) && str.endsWith(r);
}
Program: 80320
Project: 80320
Buggy source:
/** 
 * 通过普通Java对象为这个 POJO 语句的 SQL 参数赋值 <br> 一个 POJO 实际上是一个 SQL 的语句模板，增加一个 Java 对象，实际上就是增加了一组参数 <br> 因此如果你想为 POJO 里附加一个集合或者数组对象，对象必须是同样类型的，否则会出现不可预知的错误 <p> 接口的实现类会根据你给出的对象类型不同，对你的对象做不通的解释，它考虑的方式为： <ul> <li>集合|数组 : 你打算增加一组对象作为本语句的参数，会为递归调用本函数 <li>迭带器(Iterator) : 你打算增加一组对象作为本语句的参数，会为递归调用本函数 <li>Map : 你打算增加一条记录（将键作为字段名） <li>Chain : 你打算增加一条记录 <li>其他 : 你打算增加一条记录（将对象字段作为字段名） </ul> <p> <b style="color:red">注意:</b><br> 某些 SQL 语句（比如 CREATE|DROP）即使有参数，也是没有意义的，所以 Pojo 执行器会忽略它们
 * @param obj 普通 Java 对象
 * @return 自身
 * @see org.nutz.dao.sql.Pojo#addParamsBy(Object)
 */
Pojo addParamsBy(Object obj);

Fixed version (ground truth):
/** 
 * 通过普通Java对象为这个 POJO 语句的 SQL 参数赋值 <br> 一个 POJO 实际上是一个 SQL 的语句模板，增加一个 Java 对象，实际上就是增加了一组参数 <br> 因此如果你想为 POJO 里附加一个集合或者数组对象，对象必须是同样类型的，否则会出现不可预知的错误 <p> 接口的实现类会根据你给出的对象类型不同，对你的对象做不同的解释，它考虑的方式为： <ul> <li>集合|数组 : 你打算增加一组对象作为本语句的参数，会为递归调用本函数 <li>迭带器(Iterator) : 你打算增加一组对象作为本语句的参数，会为递归调用本函数 <li>Map : 你打算增加一条记录（将键作为字段名） <li>Chain : 你打算增加一条记录 <li>其他 : 你打算增加一条记录（将对象字段作为字段名） </ul> <p> <b style="color:red">注意:</b><br> 某些 SQL 语句（比如 CREATE|DROP）即使有参数，也是没有意义的，所以 Pojo 执行器会忽略它们
 * @param obj 普通 Java 对象
 * @return 自身
 * @see org.nutz.dao.sql.Pojo#addParamsBy(Object)
 */
Pojo addParamsBy(Object obj);
Program: 80321
Project: 80321
Buggy source:
public Map<String,Object> toMap(){
  Map<String,Object> map=new HashMap<String,Object>();
  Entry current=head;
  while (current != null) {
    map.put(current.name,current.value);
    current=current.next;
  }
  return map;
}

Fixed version (ground truth):
public Map<String,Object> toMap(){
  Map<String,Object> map=new LinkedHashMap<String,Object>();
  Entry current=head;
  while (current != null) {
    map.put(current.name,current.value);
    current=current.next;
  }
  return map;
}
Program: 80322
Project: 80322
Buggy source:
public void insert(Class<?> classOfT,Chain chain){
  EntityOperator opt=_opt(classOfT);
  opt.myObj=chain;
  opt.addInsertSelfOnly();
  opt.exec();
}

Fixed version (ground truth):
public void insert(Class<?> classOfT,Chain chain){
  if (chain.isSpecial()) {
    Daos.insertBySpecialChain(this,getEntity(classOfT),null,chain);
    return;
  }
  EntityOperator opt=_opt(classOfT);
  opt.myObj=chain;
  opt.addInsertSelfOnly();
  opt.exec();
}