nus-yam/ex-repair huggingface dataset:
Program: 43480
Project: 43480
Buggy source:
public void doFilter(ServletRequest req,ServletResponse resp,FilterChain chain) throws IOException, ServletException {
  Mvcs.updateRequestAttributes((HttpServletRequest)req);
  if (null != urls) {
    RequestPath path=Mvcs.getRequestPathObject((HttpServletRequest)req);
    if (null == ignorePtn || !ignorePtn.matcher(path.getUrl()).find()) {
      ActionInvoking ing=urls.get(path.getPath());
      if (null != ing && null != ing.getInvoker()) {
        if (log.isInfoEnabled())         log.info(path);
        ing.invoke(config.getServletContext(),(HttpServletRequest)req,(HttpServletResponse)resp);
        return;
      }
    }
  }
  chain.doFilter(req,resp);
}

Fixed version (ground truth):
public void doFilter(ServletRequest req,ServletResponse resp,FilterChain chain) throws IOException, ServletException {
  Mvcs.updateRequestAttributes((HttpServletRequest)req);
  RequestPath path=Mvcs.getRequestPathObject((HttpServletRequest)req);
  if (null == ignorePtn || !ignorePtn.matcher(path.getUrl()).find()) {
    try {
      if (nutMvc.handle((HttpServletRequest)req,(HttpServletResponse)resp)) {
        return;
      }
    }
 catch (    InitException e) {
    }
  }
  chain.doFilter(req,resp);
}
Program: 43481
Project: 43481
Buggy source:
public void destroy(){
  if (null != urls)   Inits.destroy(config);
}

Fixed version (ground truth):
public void destroy(){
  nutMvc.destroy();
}
Program: 43482
Project: 43482
Buggy source:
@Override public void init() throws ServletException {
  if (log.isInfoEnabled()) {
    URL me=Thread.currentThread().getContextClassLoader().getResource(NutServlet.class.getName().replace('.','/') + "String_Node_Str");
    log.infof("String_Node_Str",Nutz.version(),me);
  }
  config=new ServletNutConfig(getServletConfig());
  Loading ing=Inits.init(config,false);
  urls=ing.getUrls();
  ok=true;
}

Fixed version (ground truth):
@Override public void init() throws ServletException {
  nutMvc.init(new ServletNutConfig(getServletConfig()));
  ok=true;
}
Program: 43483
Project: 43483
Buggy source:
@Override protected void service(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  if (null == urls) {
    if (log.isErrorEnabled())     log.error("String_Node_Str");
    return;
  }
  Mvcs.updateRequestAttributes(req);
  String path=Mvcs.getRequestPath(req);
  if (log.isInfoEnabled())   log.info("String_Node_Str" + path);
  ActionInvoking ing=urls.get(path);
  if (null == ing || null == ing.getInvoker())   resp.setStatus(404);
 else   ing.invoke(config.getServletContext(),req,resp);
}

Fixed version (ground truth):
@Override protected void service(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  try {
    if (!nutMvc.handle(req,resp)) {
      resp.setStatus(404);
    }
  }
 catch (  InitException e) {
    return;
  }
}
Program: 43484
Project: 43484
Buggy source:
public void destroy(){
  if (config.getMainModule() != null)   Inits.destroy(config);
}

Fixed version (ground truth):
public void destroy(){
  nutMvc.destroy();
}
Program: 43485
Project: 43485
Buggy source:
private void pojo2Json(Object obj) throws IOException {
  if (null == obj)   return;
  Class<? extends Object> type=obj.getClass();
  ToJson tj=type.getAnnotation(ToJson.class);
  String myMethodName=Strings.sNull(null == tj ? null : tj.value(),"String_Node_Str");
  Method myMethod;
  try {
    myMethod=type.getMethod(myMethodName);
    Object re=myMethod.invoke(obj);
    writer.append(String.valueOf(re));
    return;
  }
 catch (  Exception e1) {
    try {
      myMethod=type.getMethod(myMethodName,JsonFormat.class);
      Object re=myMethod.invoke(obj,format);
      writer.append(String.valueOf(re));
      return;
    }
 catch (    Exception e) {
    }
  }
  Mirror<?> me=Mirror.me(type);
  Field[] fields=me.getFields();
  appendBraceBegin();
  increaseFormatIndent();
  ArrayList<Pair> list=new ArrayList<Pair>(fields.length);
  for (  Field f : fields) {
    String name=f.getName();
    try {
      Object value=me.getValue(obj,name);
      if (!this.isIgnore(name,value))       list.add(new Pair(name,value));
    }
 catch (    FailToGetValueException e) {
    }
  }
  for (Iterator<Pair> it=list.iterator(); it.hasNext(); ) {
    Pair p=it.next();
    this.appendPair(p.name,p.value);
    if (it.hasNext())     this.appendPairEnd();
  }
  decreaseFormatIndent();
  appendBraceEnd();
}

Fixed version (ground truth):
private void pojo2Json(Object obj) throws IOException {
  if (null == obj)   return;
  Class<? extends Object> type=obj.getClass();
  ToJson tj=type.getAnnotation(ToJson.class);
  String myMethodName=Strings.sNull(null == tj ? null : tj.value(),"String_Node_Str");
  try {
    Method myMethod=type.getMethod(myMethodName);
    if (!myMethod.isAccessible())     myMethod.setAccessible(true);
    Object re=myMethod.invoke(obj);
    writer.append(String.valueOf(re));
    return;
  }
 catch (  Exception e1) {
    try {
      Method myMethod=type.getMethod(myMethodName,JsonFormat.class);
      if (!myMethod.isAccessible())       myMethod.setAccessible(true);
      Object re=myMethod.invoke(obj,format);
      writer.append(String.valueOf(re));
      return;
    }
 catch (    Exception e) {
    }
  }
  Mirror<?> me=Mirror.me(type);
  Field[] fields=me.getFields();
  appendBraceBegin();
  increaseFormatIndent();
  ArrayList<Pair> list=new ArrayList<Pair>(fields.length);
  for (  Field f : fields) {
    String name=f.getName();
    try {
      Object value=me.getValue(obj,name);
      if (!this.isIgnore(name,value))       list.add(new Pair(name,value));
    }
 catch (    FailToGetValueException e) {
    }
  }
  for (Iterator<Pair> it=list.iterator(); it.hasNext(); ) {
    Pair p=it.next();
    this.appendPair(p.name,p.value);
    if (it.hasNext())     this.appendPairEnd();
  }
  decreaseFormatIndent();
  appendBraceEnd();
}
Program: 43486
Project: 43486
Buggy source:
protected Object getValue(IocMaking ing,Object obj) throws Exception {
  if (null == args || args.length == 0) {
    return method.invoke(obj);
  }
  Object[] fas=new Object[args.length];
  for (int i=0; i < args.length; i++)   fas[i]=args[i].getValue(ing,null);
  return method.invoke(obj,fas);
}

Fixed version (ground truth):
protected Object getValue(IocMaking ing,Object obj) throws Exception {
  if (method != null) {
    if (null == args || args.length == 0)     return method.invoke(obj);
    Object[] fas=new Object[args.length];
    for (int i=0; i < args.length; i++)     fas[i]=args[i].getValue(ing,null);
    return method.invoke(obj,fas);
  }
  return field.get(null);
}
Program: 43487
Project: 43487
Buggy source:
public StaticFunctionNode(String className,String name,ChainNode[] args){
  try {
    Mirror<?> mirror=Mirror.me((Class<?>)Lang.loadClass(className));
    if (null == args || args.length == 0) {
      try {
        method=mirror.getGetter(name);
      }
 catch (      NoSuchMethodException e) {
        throw Lang.makeThrow("String_Node_Str",name,mirror);
      }
    }
 else {
      Method[] ms=mirror.findMethods(name,args.length);
      if (0 == ms.length)       throw Lang.makeThrow("String_Node_Str",name,mirror);
      this.args=args;
      this.method=ms[0];
    }
    if (!Modifier.isStatic(method.getModifiers()))     throw Lang.makeThrow("String_Node_Str",name,mirror);
  }
 catch (  ClassNotFoundException e) {
    throw Lang.wrapThrow(e);
  }
}

Fixed version (ground truth):
public StaticFunctionNode(String className,String name,ChainNode[] args){
  try {
    Mirror<?> mirror=Mirror.me(Lang.loadClass(className));
    if (null == args || args.length == 0) {
      try {
        method=mirror.getGetter(name);
      }
 catch (      NoSuchMethodException e) {
        try {
          field=mirror.getField(name);
          if (!Modifier.isStatic(field.getModifiers()))           throw Lang.makeThrow("String_Node_Str",name,mirror);
          return;
        }
 catch (        NoSuchFieldException e1) {
          throw Lang.makeThrow("String_Node_Str",name,mirror);
        }
      }
    }
 else {
      Method[] ms=mirror.findMethods(name,args.length);
      if (0 == ms.length)       throw Lang.makeThrow("String_Node_Str",name,mirror);
      this.args=args;
      this.method=ms[0];
    }
    if (!Modifier.isStatic(method.getModifiers()))     throw Lang.makeThrow("String_Node_Str",name,mirror);
  }
 catch (  ClassNotFoundException e) {
    throw Lang.wrapThrow(e);
  }
}
Program: 43488
Project: 43488
Buggy source:
protected String asString(){
  StringBuilder sb=new StringBuilder();
  if (null != args && args.length > 0) {
    sb.append(args[0].toString());
    for (int i=1; i < args.length; i++)     sb.append("String_Node_Str").append(args[i].toString());
  }
  return String.format("String_Node_Str",method.getDeclaringClass().getName(),method.getName(),sb);
}

Fixed version (ground truth):
protected String asString(){
  StringBuilder sb=new StringBuilder();
  if (null != args && args.length > 0) {
    sb.append(args[0].toString());
    for (int i=1; i < args.length; i++)     sb.append("String_Node_Str").append(args[i].toString());
  }
  if (method != null)   return String.format("String_Node_Str",method.getDeclaringClass().getName(),method.getName(),sb);
 else   return String.format("String_Node_Str",field.getDeclaringClass().getName(),field.getName(),sb);
}
Program: 43489
Project: 43489
Buggy source:
/** 
 * @param path 全路径
 * @return 文件或者目录名
 */
public static String getName(String path){
  if (!Strings.isBlank(path)) {
    int pos=path.replace('\\','/').lastIndexOf('/');
    if (pos > 0)     return path.substring(pos);
  }
  return path;
}

Fixed version (ground truth):
/** 
 * @param path 全路径
 * @return 文件或者目录名
 */
public static String getName(String path){
  if (!Strings.isBlank(path)) {
    int pos=path.replace('\\','/').lastIndexOf('/');
    if (pos > 0)     return path.substring(pos + 1);
  }
  return path;
}
Program: 43490
Project: 43490
Buggy source:
public static StringGenerator sg(int min,int max){
  return new StringGenerator(min,max);
}

Fixed version (ground truth):
public static StringGenerator sg(int len){
  return new StringGenerator(len,len);
}
Program: 43491
Project: 43491
Buggy source:
public E next(){
  return stack.innerGet(i++);
}

Fixed version (ground truth):
public E next(){
  if (i >= stack.offset && i < stack.cursor)   return stack.innerGet(i++);
  return null;
}
Program: 43492
Project: 43492
Buggy source:
LinkedArrayIterator(LinkedArray<E> stack){
  this.stack=stack;
  i=0;
}

Fixed version (ground truth):
LinkedArrayIterator(LinkedArray<E> stack){
  this.stack=stack;
  i=stack.offset;
}
Program: 43493
Project: 43493
Buggy source:
public boolean hasNext(){
  return (stack.cursor - i + stack.offset) > 0;
}

Fixed version (ground truth):
public boolean hasNext(){
  return i < stack.cursor;
}
Program: 43494
Project: 43494
Buggy source:
public LinkedArray(Class<T> eleType,int size){
  this.eleType=eleType;
  if (size < 0)   Lang.makeThrow("String_Node_Str");
  this.width=size;
  cache=new ArrayList<T[]>();
}

Fixed version (ground truth):
public LinkedArray(Class<T> eleType,int size){
  this.eleType=eleType;
  if (size <= 0)   Lang.makeThrow("String_Node_Str");
  this.width=size;
  cache=new ArrayList<T[]>();
}
Program: 43495
Project: 43495
Buggy source:
public LinkedIntArray(int size){
  if (size < 0)   Lang.makeThrow("String_Node_Str");
  this.width=size;
  cache=new ArrayList<int[]>();
}

Fixed version (ground truth):
public LinkedIntArray(int size){
  if (size <= 0)   Lang.makeThrow("String_Node_Str");
  this.width=size;
  cache=new ArrayList<int[]>();
}
Program: 43496
Project: 43496
Buggy source:
private void parseArgs(Element beanElement,IocObject iocObject) throws Throwable {
  NodeList argsNodeList=beanElement.getElementsByTagName(TAG_ARGS);
  if (argsNodeList.getLength() > 0) {
    Element argsElement=(Element)argsNodeList.item(0);
    NodeList argNodeList=argsElement.getChildNodes();
    for (int i=0; i < argNodeList.getLength(); i++) {
      if (argNodeList.item(i) instanceof Element)       iocObject.addArg(parseX((Element)argNodeList.item(i)));
    }
  }
}

Fixed version (ground truth):
protected void parseArgs(Element beanElement,IocObject iocObject) throws Throwable {
  NodeList argsNodeList=beanElement.getElementsByTagName(TAG_ARGS);
  if (argsNodeList.getLength() > 0) {
    Element argsElement=(Element)argsNodeList.item(0);
    NodeList argNodeList=argsElement.getChildNodes();
    for (int i=0; i < argNodeList.getLength(); i++) {
      if (argNodeList.item(i) instanceof Element)       iocObject.addArg(parseX((Element)argNodeList.item(i)));
    }
  }
}
Program: 43497
Project: 43497
Buggy source:
private void parseEvents(Element beanElement,IocObject iocObject){
  NodeList eventsNodeList=beanElement.getElementsByTagName("String_Node_Str");
  if (eventsNodeList.getLength() > 0) {
    Element eventsElement=(Element)eventsNodeList.item(0);
    IocEventSet iocEventSet=new IocEventSet();
    NodeList fetchNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (fetchNodeList.getLength() > 0)     iocEventSet.setFetch(((Element)fetchNodeList.item(0)).getTextContent());
    NodeList createNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (createNodeList.getLength() > 0)     iocEventSet.setCreate(((Element)createNodeList.item(0)).getTextContent());
    NodeList deposeNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (deposeNodeList.getLength() > 0)     iocEventSet.setDepose(((Element)deposeNodeList.item(0)).getTextContent());
    if (iocEventSet.getCreate() == null)     if (iocEventSet.getDepose() == null)     if (iocEventSet.getFetch() == null)     return;
    iocObject.setEvents(iocEventSet);
  }
}

Fixed version (ground truth):
protected void parseEvents(Element beanElement,IocObject iocObject){
  NodeList eventsNodeList=beanElement.getElementsByTagName("String_Node_Str");
  if (eventsNodeList.getLength() > 0) {
    Element eventsElement=(Element)eventsNodeList.item(0);
    IocEventSet iocEventSet=new IocEventSet();
    NodeList fetchNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (fetchNodeList.getLength() > 0)     iocEventSet.setFetch(((Element)fetchNodeList.item(0)).getTextContent());
    NodeList createNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (createNodeList.getLength() > 0)     iocEventSet.setCreate(((Element)createNodeList.item(0)).getTextContent());
    NodeList deposeNodeList=eventsElement.getElementsByTagName("String_Node_Str");
    if (deposeNodeList.getLength() > 0)     iocEventSet.setDepose(((Element)deposeNodeList.item(0)).getTextContent());
    if (iocEventSet.getCreate() == null)     if (iocEventSet.getDepose() == null)     if (iocEventSet.getFetch() == null)     return;
    iocObject.setEvents(iocEventSet);
  }
}
Program: 43498
Project: 43498
Buggy source:
private boolean check(List<String> parentList,String currentBeanId){
  if (parentList.contains(currentBeanId))   return false;
  String parentBeanId=parentMap.get(currentBeanId);
  if (parentBeanId == null)   return true;
  parentList.add(currentBeanId);
  return check(parentList,parentBeanId);
}

Fixed version (ground truth):
protected boolean check(List<String> parentList,String currentBeanId){
  if (parentList.contains(currentBeanId))   return false;
  String parentBeanId=parentMap.get(currentBeanId);
  if (parentBeanId == null)   return true;
  parentList.add(currentBeanId);
  return check(parentList,parentBeanId);
}
Program: 43499
Project: 43499
Buggy source:
public XmlIocLoader(String... fileNames){
  try {
    DocumentBuilder builder=Lang.xmls();
    Document document;
    List<NutResource> list=Scans.me().loadResource("String_Node_Str",fileNames);
    for (    NutResource nr : list) {
      InputStream ins=nr.getInputStream();
      document=builder.parse(ins);
      document.normalizeDocument();
      NodeList nodeListZ=((Element)document.getDocumentElement()).getChildNodes();
      for (int i=0; i < nodeListZ.getLength(); i++) {
        if (nodeListZ.item(i) instanceof Element)         paserBean((Element)nodeListZ.item(i),false);
      }
      Streams.safeClose(ins);
    }
    handleParent();
    if (LOG.isDebugEnabled())     LOG.debugf("String_Node_Str",Json.toJson(iocMap));
  }
 catch (  Throwable e) {
    throw Lang.wrapThrow(e);
  }
}

Fixed version (ground truth):
public XmlIocLoader(String... fileNames){
  try {
    DocumentBuilder builder=Lang.xmls();
    Document document;
    List<NutResource> list=Scans.me().loadResource(getScanPatten(),fileNames);
    for (    NutResource nr : list) {
      InputStream ins=nr.getInputStream();
      document=builder.parse(ins);
      document.normalizeDocument();
      NodeList nodeListZ=((Element)document.getDocumentElement()).getChildNodes();
      for (int i=0; i < nodeListZ.getLength(); i++) {
        if (nodeListZ.item(i) instanceof Element)         paserBean((Element)nodeListZ.item(i),false);
      }
      Streams.safeClose(ins);
    }
    handleParent();
    if (LOG.isDebugEnabled())     LOG.debugf("String_Node_Str",Json.toJson(iocMap));
  }
 catch (  Throwable e) {
    throw Lang.wrapThrow(e);
  }
}
Program: 43500
Project: 43500
Buggy source:
private Map<String,?> paserMap(Element element){
  Map<String,Object> map=new HashMap<String,Object>();
  if (element.hasChildNodes()) {
    NodeList nodeList=element.getElementsByTagName(ITEM_TAG);
    for (int i=0; i < nodeList.getLength(); i++) {
      if (nodeList.item(i) instanceof Element) {
        Element elementItem=(Element)nodeList.item(i);
        String key=elementItem.getAttribute("String_Node_Str");
        if (map.containsKey(key))         throw new IllegalArgumentException("String_Node_Str");
        NodeList list=elementItem.getChildNodes();
        for (int j=0; j < list.getLength(); j++) {
          if (list.item(j) instanceof Element) {
            map.put(key,list.item(j).getTextContent());
            break;
          }
        }
        if (!map.containsKey(key))         map.put(key,null);
      }
    }
  }
  return map;
}

Fixed version (ground truth):
protected Map<String,?> paserMap(Element element){
  Map<String,Object> map=new HashMap<String,Object>();
  if (element.hasChildNodes()) {
    NodeList nodeList=element.getElementsByTagName(ITEM_TAG);
    for (int i=0; i < nodeList.getLength(); i++) {
      if (nodeList.item(i) instanceof Element) {
        Element elementItem=(Element)nodeList.item(i);
        String key=elementItem.getAttribute("String_Node_Str");
        if (map.containsKey(key))         throw new IllegalArgumentException("String_Node_Str");
        NodeList list=elementItem.getChildNodes();
        for (int j=0; j < list.getLength(); j++) {
          if (list.item(j) instanceof Element) {
            map.put(key,list.item(j).getTextContent());
            break;
          }
        }
        if (!map.containsKey(key))         map.put(key,null);
      }
    }
  }
  return map;
}
Program: 43501
Project: 43501
Buggy source:
private void parseFields(Element beanElement,IocObject iocObject) throws Throwable {
  NodeList fieldNodeList=beanElement.getElementsByTagName(TAG_FIELD);
  if (fieldNodeList.getLength() > 0) {
    int len=fieldNodeList.getLength();
    for (int i=0; i < len; i++) {
      Element fieldElement=(Element)fieldNodeList.item(i);
      IocField iocField=new IocField();
      iocField.setName(fieldElement.getAttribute("String_Node_Str"));
      if (fieldElement.hasChildNodes()) {
        NodeList nodeList=fieldElement.getChildNodes();
        for (int j=0; j < nodeList.getLength(); j++) {
          if (nodeList.item(j) instanceof Element) {
            iocField.setValue(parseX((Element)nodeList.item(j)));
            break;
          }
        }
      }
      iocObject.addField(iocField);
    }
  }
}

Fixed version (ground truth):
protected void parseFields(Element beanElement,IocObject iocObject) throws Throwable {
  NodeList fieldNodeList=beanElement.getElementsByTagName(TAG_FIELD);
  if (fieldNodeList.getLength() > 0) {
    int len=fieldNodeList.getLength();
    for (int i=0; i < len; i++) {
      Element fieldElement=(Element)fieldNodeList.item(i);
      IocField iocField=new IocField();
      iocField.setName(fieldElement.getAttribute("String_Node_Str"));
      if (fieldElement.hasChildNodes()) {
        NodeList nodeList=fieldElement.getChildNodes();
        for (int j=0; j < nodeList.getLength(); j++) {
          if (nodeList.item(j) instanceof Element) {
            iocField.setValue(parseX((Element)nodeList.item(j)));
            break;
          }
        }
      }
      iocObject.addField(iocField);
    }
  }
}
Program: 43503
Project: 43503
Buggy source:
private IocObject paserBean(Element beanElement,boolean innerBean) throws Throwable {
  String beanId;
  if (innerBean) {
    beanId="String_Node_Str" + innerId;
    innerId++;
  }
 else   beanId=beanElement.getAttribute("String_Node_Str");
  if (beanId == null)   throw Lang.makeThrow("String_Node_Str");
  if (iocMap.containsKey(beanId))   throw Lang.makeThrow("String_Node_Str" + beanId);
  if (LOG.isDebugEnabled())   LOG.debugf("String_Node_Str",beanId);
  IocObject iocObject=new IocObject();
  String beanType=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanType))   iocObject.setType(Lang.loadClass(beanType));
  String beanScope=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanScope))   iocObject.setScope(beanScope);
  String beanParent=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanParent))   parentMap.put(beanId,beanParent);
  parseArgs(beanElement,iocObject);
  parseFields(beanElement,iocObject);
  parseEvents(beanElement,iocObject);
  iocMap.put(beanId,iocObject);
  if (LOG.isDebugEnabled())   LOG.debugf("String_Node_Str",beanId);
  return iocObject;
}

Fixed version (ground truth):
protected IocObject paserBean(Element beanElement,boolean innerBean) throws Throwable {
  String beanId;
  if (innerBean) {
    beanId="String_Node_Str" + innerId;
    innerId++;
  }
 else   beanId=beanElement.getAttribute("String_Node_Str");
  if (beanId == null)   throw Lang.makeThrow("String_Node_Str");
  if (iocMap.containsKey(beanId))   throw Lang.makeThrow("String_Node_Str" + beanId);
  if (LOG.isDebugEnabled())   LOG.debugf("String_Node_Str",beanId);
  IocObject iocObject=new IocObject();
  String beanType=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanType))   iocObject.setType(Lang.loadClass(beanType));
  String beanScope=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanScope))   iocObject.setScope(beanScope);
  String beanParent=beanElement.getAttribute("String_Node_Str");
  if (!Strings.isBlank(beanParent))   parentMap.put(beanId,beanParent);
  parseArgs(beanElement,iocObject);
  parseFields(beanElement,iocObject);
  parseEvents(beanElement,iocObject);
  iocMap.put(beanId,iocObject);
  if (LOG.isDebugEnabled())   LOG.debugf("String_Node_Str",beanId);
  return iocObject;
}
Program: 43504
Project: 43504
Buggy source:
private void handleParent(){
  for (  String parentId : parentMap.values())   if (!iocMap.containsKey(parentId))   throw Lang.makeThrow("String_Node_Str",parentId);
  List<String> parentList=new ArrayList<String>();
  for (  Entry<String,String> entry : parentMap.entrySet()) {
    if (!check(parentList,entry.getKey()))     throw Lang.makeThrow("String_Node_Str",entry.getKey());
    parentList.clear();
  }
  while (parentMap.size() != 0) {
    Iterator<Entry<String,String>> it=parentMap.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String,String> entry=it.next();
      String beanId=entry.getKey();
      String parentId=entry.getValue();
      if (parentMap.get(parentId) == null) {
        IocObject newIocObject=Iocs.mergeWith(iocMap.get(beanId),iocMap.get(parentId));
        iocMap.put(beanId,newIocObject);
        it.remove();
      }
    }
  }
}

Fixed version (ground truth):
protected void handleParent(){
  for (  String parentId : parentMap.values())   if (!iocMap.containsKey(parentId))   throw Lang.makeThrow("String_Node_Str",parentId);
  List<String> parentList=new ArrayList<String>();
  for (  Entry<String,String> entry : parentMap.entrySet()) {
    if (!check(parentList,entry.getKey()))     throw Lang.makeThrow("String_Node_Str",entry.getKey());
    parentList.clear();
  }
  while (parentMap.size() != 0) {
    Iterator<Entry<String,String>> it=parentMap.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String,String> entry=it.next();
      String beanId=entry.getKey();
      String parentId=entry.getValue();
      if (parentMap.get(parentId) == null) {
        IocObject newIocObject=Iocs.mergeWith(iocMap.get(beanId),iocMap.get(parentId));
        iocMap.put(beanId,newIocObject);
        it.remove();
      }
    }
  }
}
Program: 43505
Project: 43505
Buggy source:
private List<IocValue> paserCollection(Element element) throws Throwable {
  List<IocValue> list=new ArrayList<IocValue>();
  if (element.hasChildNodes()) {
    NodeList nodeList=element.getChildNodes();
    for (int i=0; i < nodeList.getLength(); i++) {
      Node node=nodeList.item(i);
      if (node instanceof Element) {
        list.add((IocValue)parseX((Element)node));
      }
    }
  }
  return list;
}

Fixed version (ground truth):
protected List<IocValue> paserCollection(Element element) throws Throwable {
  List<IocValue> list=new ArrayList<IocValue>();
  if (element.hasChildNodes()) {
    NodeList nodeList=element.getChildNodes();
    for (int i=0; i < nodeList.getLength(); i++) {
      Node node=nodeList.item(i);
      if (node instanceof Element) {
        list.add((IocValue)parseX((Element)node));
      }
    }
  }
  return list;
}
Program: 43506
Project: 43506
Buggy source:
/** 
 * 执行过滤
 * @param request 当前的请求对象
 * @param method 即将调用的入口函数
 * @return <ul><li>null - 过滤去通过，可以继续执行后续操作 <li>View 对象实例 - 过滤器认为应该终止操作，用这个视图对象来直接渲染 HTTP响应 </ul>
 */
View match(HttpServletRequest request,Method method);

Fixed version (ground truth):
/** 
 * 执行过滤
 * @param sc Servlet 上下文对象
 * @param request 当前的请求对象
 * @param method 即将调用的入口函数
 * @return <ul><li>null - 过滤去通过，可以继续执行后续操作 <li>View 对象实例 - 过滤器认为应该终止操作，用这个视图对象来直接渲染 HTTP响应 </ul>
 */
View match(ServletContext sc,HttpServletRequest request,Method method);
Program: 43507
Project: 43507
Buggy source:
public View match(HttpServletRequest request,Method method){
  Object obj=request.getSession().getAttribute(name);
  if (null == obj)   return new ServerRedirectView(path);
  return null;
}

Fixed version (ground truth):
public View match(ServletContext sc,HttpServletRequest request,Method method){
  Object obj=request.getSession().getAttribute(name);
  if (null == obj)   return new ServerRedirectView(path);
  return null;
}
Program: 43509
Project: 43509
Buggy source:
@SuppressWarnings("String_Node_Str") public Node<T> add(Node<?>... nodes){
  if (nodes.length == 0) {
    return this;
  }
  if (nodes.length == 1) {
    Node<T> node=(Node<T>)nodes[0];
    node.parent(this);
    if (!this.hasChild()) {
      firstChild=node;
      lastChild=node;
      node.next(null);
      node.prev(null);
    }
 else {
      lastChild.next(node);
      node.prev(lastChild);
      node.next(null);
      lastChild=node;
    }
  }
 else {
    firstChild=(Node<T>)nodes[0];
    firstChild.parent(this);
    firstChild.next((Node<T>)nodes[1]);
    int i=1;
    for (; i < nodes.length - 1; i++) {
      Node<T> node=(Node<T>)nodes[i];
      node.parent(this);
      node.prev((Node<T>)nodes[i - 1]);
      node.next((Node<T>)nodes[i + 1]);
    }
    lastChild=(Node<T>)nodes[i];
    lastChild.parent(this);
    lastChild.prev((Node<T>)nodes[i - 1]);
  }
  return this;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Node<T> add(Node<?>... nodes){
  if (nodes.length == 0) {
    return this;
  }
  if (nodes.length == 1) {
    Node<T> node=(Node<T>)nodes[0];
    node.parent(this);
    if (!this.hasChild()) {
      firstChild=node;
      lastChild=node;
      node.next(null);
      node.prev(null);
    }
 else {
      lastChild.next(node);
      node.prev(lastChild);
      node.next(null);
      lastChild=node;
    }
  }
 else {
    Node<T> theNode=(Node<T>)nodes[0];
    theNode.parent(this);
    theNode.next((Node<T>)nodes[1]);
    if (null == lastChild) {
      firstChild=theNode;
    }
 else {
      lastChild.next(theNode);
    }
    int i=1;
    for (; i < nodes.length - 1; i++) {
      Node<T> node=(Node<T>)nodes[i];
      node.parent(this);
      node.prev((Node<T>)nodes[i - 1]);
      node.next((Node<T>)nodes[i + 1]);
    }
    lastChild=(Node<T>)nodes[i];
    lastChild.parent(this);
    lastChild.prev((Node<T>)nodes[i - 1]);
  }
  return this;
}
Program: 43510
Project: 43510
Buggy source:
private int readTokenName(char[] cs,int i,StringBuilder sb){
  for (++i; i < cs.length; i++) {
    int b=(int)cs[i];
    if (b == '_' || b == '-' || (b >= 48 && b <= 57) || (b >= 65 && b <= 90) || (b >= 97 && b <= 122))     sb.append((char)b);
 else     break;
  }
  return i - 1;
}

Fixed version (ground truth):
private int readTokenName(char[] cs,int i,StringBuilder sb){
  for (++i; i < cs.length; i++) {
    int b=(int)cs[i];
    if (b == 95) {
      sb.append((char)b);
    }
 else     if ((b >= 0 && b <= 47) || (b >= 58 && b <= 64) || (b >= 91 && b <= 96)|| (b >= 123 && b <= 160)) {
      break;
    }
 else {
      sb.append((char)b);
    }
  }
  return i - 1;
}
Program: 43511
Project: 43511
Buggy source:
/** 
 * 初始化NutLog,检查全部Log的可用性,选择可用的Log适配器 <p/><b>加载本类时,该方法已经在静态构造函数中调用,用户无需主动调用.</b> <p/><b>除非迫不得已,请不要调用本方法<b/>
 */
public static void init(){
  try {
    adapter=new SimplePluginManager<LogAdapter>("String_Node_Str","String_Node_Str","String_Node_Str").get();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * 初始化NutLog,检查全部Log的可用性,选择可用的Log适配器 <p/> <b>加载本类时,该方法已经在静态构造函数中调用,用户无需主动调用.</b> <p/> <b>除非迫不得已,请不要调用本方法<b/>
 */
public static void init(){
  try {
    adapter=new SimplePluginManager<LogAdapter>("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").get();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 43512
Project: 43512
Buggy source:
/** 
 * Get a Log by name
 * @param className the name of Log
 * @return Log 
 * @throws NullPointerException when className is null, maybe it will case NPE
 */
public static Log getLog(String className){
  return adapter.getLogger(className);
}

Fixed version (ground truth):
/** 
 * Get a Log by name
 * @param className the name of Log
 * @return Log
 * @throws NullPointerException when className is null, maybe it will case NPE
 */
public static Log getLog(String className){
  return adapter.getLogger(className);
}
Program: 43513
Project: 43513
Buggy source:
public boolean canWork(){
  try {
    Class.forName(LOG4J_CLASS_NAME,true,Thread.currentThread().getContextClassLoader());
  }
 catch (  ClassNotFoundException e) {
    return false;
  }
  return isPropertyFileConfigured();
}

Fixed version (ground truth):
public boolean canWork(){
  try {
    Class.forName("String_Node_Str",false,Thread.currentThread().getContextClassLoader());
    return isPropertyFileConfigured();
  }
 catch (  Throwable e) {
  }
  return false;
}
Program: 43514
Project: 43514
Buggy source:
public SimplePluginManager(Class<? extends T>... classNames) throws PluginException {
  for (  Class<? extends T> pluginClass : classNames)   loadPlugin(pluginClass);
}

Fixed version (ground truth):
public SimplePluginManager(Class<? extends T>... classNames) throws PluginException {
  if (classNames != null)   for (  Class<? extends T> pluginClass : classNames)   loadPlugin(pluginClass);
}
Program: 43515
Project: 43515
Buggy source:
@SuppressWarnings("String_Node_Str") private void loadPlugin(String pluginClassName) throws PluginException {
  try {
    if (pluginClassName != null)     loadPlugin((Class<? extends T>)Lang.loadClass(pluginClassName));
  }
 catch (  ClassNotFoundException e) {
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void loadPlugin(String pluginClassName) throws PluginException {
  try {
    if (pluginClassName != null)     loadPlugin((Class<? extends T>)Lang.loadClass(pluginClassName));
  }
 catch (  Throwable e) {
  }
}
Program: 43516
Project: 43516
Buggy source:
protected IocValue convert(String value){
  IocValue iocValue=new IocValue();
  iocValue.setType(value.substring(0,value.indexOf("String_Node_Str")));
  iocValue.setValue(value.substring(value.indexOf("String_Node_Str") + 1));
  return iocValue;
}

Fixed version (ground truth):
protected IocValue convert(String value){
  IocValue iocValue=new IocValue();
  if (value.indexOf(':') > -1) {
    iocValue.setType(value.substring(0,value.indexOf("String_Node_Str")));
    iocValue.setValue(value.substring(value.indexOf("String_Node_Str") + 1));
  }
 else   iocValue.setValue(value);
  return iocValue;
}
Program: 43518
Project: 43518
Buggy source:
public boolean isFile(){
  return null != getContentType() && null != getFileLocalPath();
}

Fixed version (ground truth):
public boolean isFile(){
  return null != getFileLocalPath();
}
Program: 43519
Project: 43519
Buggy source:
/** 
 * 初始化NutLog,检查全部Log的可用性,选择可用的Log适配器 <p/> <b>加载本类时,该方法已经在静态构造函数中调用,用户无需主动调用.</b> <p/> <b>除非迫不得已,请不要调用本方法<b/>
 */
public static void init(){
  try {
    adapter=new SimplePluginManager<LogAdapter>("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").get();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * 初始化NutLog,检查全部Log的可用性,选择可用的Log适配器 <p/> <b>加载本类时,该方法已经在静态构造函数中调用,用户无需主动调用.</b> <p/> <b>除非迫不得已,请不要调用本方法<b/>
 */
public static void init(){
  try {
    adapter=new SimplePluginManager<LogAdapter>("String_Node_Str","String_Node_Str").get();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 43520
Project: 43520
Buggy source:
@Override protected void log(int level,Object message,Throwable tx){
switch (level) {
case LEVEL_FATAL:
    logger.log(SUPER_FQCN,Level.FATAL,message,tx);
  break;
case LEVEL_ERROR:
logger.log(SUPER_FQCN,Level.ERROR,message,tx);
break;
case LEVEL_WARN:
logger.log(SUPER_FQCN,Level.WARN,message,tx);
break;
case LEVEL_INFO:
logger.log(SUPER_FQCN,Level.INFO,message,tx);
break;
case LEVEL_DEBUG:
logger.log(SUPER_FQCN,Level.DEBUG,message,tx);
break;
case LEVEL_TRACE:
if (hasTrace) logger.log(SUPER_FQCN,Level.TRACE,message,tx);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override protected void log(int level,Object message,Throwable tx){
switch (level) {
case LEVEL_FATAL:
    logger.log(SUPER_FQCN,Level.FATAL,message,tx);
  break;
case LEVEL_ERROR:
logger.log(SUPER_FQCN,Level.ERROR,message,tx);
break;
case LEVEL_WARN:
logger.log(SUPER_FQCN,Level.WARN,message,tx);
break;
case LEVEL_INFO:
logger.log(SUPER_FQCN,Level.INFO,message,tx);
break;
case LEVEL_DEBUG:
logger.log(SUPER_FQCN,Level.DEBUG,message,tx);
break;
case LEVEL_TRACE:
if (hasTrace) logger.log(SUPER_FQCN,Level.TRACE,message,tx);
 else logger.log(SUPER_FQCN,Level.DEBUG,message,tx);
break;
default :
break;
}
}
Program: 43521
Project: 43521
Buggy source:
Log4JLogger(String className){
  logger=LogManager.getLogger(className);
  isFatalEnabled=logger.isEnabledFor(Level.FATAL);
  isErrorEnabled=logger.isEnabledFor(Level.ERROR);
  isWarnEnabled=logger.isEnabledFor(Level.WARN);
  isInfoEnabled=logger.isEnabledFor(Level.INFO);
  isDebugEnabled=logger.isEnabledFor(Level.DEBUG);
  if (hasTrace)   isTraceEnabled=logger.isEnabledFor(Level.TRACE);
}

Fixed version (ground truth):
Log4JLogger(String className){
  logger=Logger.getLogger(className);
  isFatalEnabled=logger.isEnabledFor(Level.FATAL);
  isErrorEnabled=logger.isEnabledFor(Level.ERROR);
  isWarnEnabled=logger.isEnabledFor(Level.WARN);
  isInfoEnabled=logger.isEnabledFor(Level.INFO);
  isDebugEnabled=logger.isEnabledFor(Level.DEBUG);
  if (hasTrace)   isTraceEnabled=logger.isEnabledFor(Level.TRACE);
}
Program: 43522
Project: 43522
Buggy source:
public boolean canWork(){
  try {
    Class.forName("String_Node_Str",false,Thread.currentThread().getContextClassLoader());
    return isPropertyFileConfigured();
  }
 catch (  Throwable e) {
  }
  return false;
}

Fixed version (ground truth):
public boolean canWork(){
  try {
    Class.forName("String_Node_Str",false,Thread.currentThread().getContextClassLoader());
    return true;
  }
 catch (  Throwable e) {
  }
  return false;
}
Program: 43523
Project: 43523
Buggy source:
protected void enhandMethod_Void(){
  mv.visitCode();
  Label l0=new Label();
  Label l1=new Label();
  Label l2=new Label();
  mv.visitTryCatchBlock(l0,l1,l2,"String_Node_Str");
  mv.visitLabel(l0);
  mv.visitTypeInsn(NEW,"String_Node_Str");
  mv.visitInsn(DUP);
  visitX(methodIndex);
  mv.visitVarInsn(ALOAD,0);
  mv.visitFieldInsn(GETSTATIC,myName,"String_Node_Str","String_Node_Str");
  visitX(methodIndex);
  mv.visitInsn(AALOAD);
  mv.visitFieldInsn(GETSTATIC,myName,"String_Node_Str","String_Node_Str");
  visitX(methodIndex);
  mv.visitInsn(AALOAD);
  loadArgsAsArray();
  mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
{
    if (Type.getReturnType(desc).equals(Type.VOID_TYPE)) {
      mv.visitInsn(POP);
    }
 else {
      mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
      AsmHelper.checkCast(returnType,mv);
      returnIt();
    }
  }
  mv.visitLabel(l1);
  Label l3=new Label();
  mv.visitJumpInsn(GOTO,l3);
  mv.visitLabel(l2);
  mv.visitVarInsn(ASTORE,3);
  mv.visitVarInsn(ALOAD,3);
  mv.visitInsn(ATHROW);
  mv.visitLabel(l3);
  mv.visitInsn(RETURN);
  mv.visitMaxs(8,4);
  mv.visitEnd();
}

Fixed version (ground truth):
protected void enhandMethod_Void(){
  mv.visitCode();
  Label l0=new Label();
  Label l1=new Label();
  Label l2=new Label();
  mv.visitTryCatchBlock(l0,l1,l2,"String_Node_Str");
  mv.visitLabel(l0);
  mv.visitTypeInsn(NEW,"String_Node_Str");
  mv.visitInsn(DUP);
  visitX(methodIndex);
  mv.visitVarInsn(ALOAD,0);
  mv.visitFieldInsn(GETSTATIC,myName,AsmClassAgent.MethodArray_FieldName,"String_Node_Str");
  visitX(methodIndex);
  mv.visitInsn(AALOAD);
  mv.visitFieldInsn(GETSTATIC,myName,AsmClassAgent.MethodInterceptorList_FieldName,"String_Node_Str");
  visitX(methodIndex);
  mv.visitInsn(AALOAD);
  loadArgsAsArray();
  mv.visitMethodInsn(INVOKESPECIAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
{
    if (Type.getReturnType(desc).equals(Type.VOID_TYPE)) {
      mv.visitInsn(POP);
    }
 else {
      mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
      AsmHelper.checkCast(returnType,mv);
      returnIt();
    }
  }
  mv.visitLabel(l1);
  Label l3=new Label();
  mv.visitJumpInsn(GOTO,l3);
  mv.visitLabel(l2);
  mv.visitVarInsn(ASTORE,3);
  mv.visitVarInsn(ALOAD,3);
  mv.visitInsn(ATHROW);
  mv.visitLabel(l3);
  mv.visitInsn(RETURN);
  mv.visitMaxs(8,4);
  mv.visitEnd();
}
Program: 43524
Project: 43524
Buggy source:
@SuppressWarnings("String_Node_Str") protected <T>Class<T> generate(ClassDefiner cd,Pair2[] pair2s,String newName,Class<T> klass,Constructor<T>[] constructors){
  try {
    return (Class<T>)cd.load(newName);
  }
 catch (  ClassNotFoundException e) {
  }
  Method[] methodArray=new Method[pair2s.length];
  List<MethodInterceptor>[] methodInterceptorList=new List[pair2s.length];
  for (int i=0; i < pair2s.length; i++) {
    Pair2 pair2=pair2s[i];
    methodArray[i]=pair2.method;
    methodInterceptorList[i]=pair2.listeners;
  }
  byte[] bytes=ClassY.enhandClass(klass,newName,methodArray,constructors);
  if (debug)   Files.write(new File(newName),bytes);
  Class<T> newClass=(Class<T>)cd.define(newName,bytes);
  AopToolKit.injectFieldValue(newClass,methodArray,methodInterceptorList);
  return newClass;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected <T>Class<T> generate(ClassDefiner cd,Pair2[] pair2s,String newName,Class<T> klass,Constructor<T>[] constructors){
  try {
    return (Class<T>)cd.load(newName);
  }
 catch (  ClassNotFoundException e) {
  }
  Method[] methodArray=new Method[pair2s.length];
  List<MethodInterceptor>[] methodInterceptorList=new List[pair2s.length];
  for (int i=0; i < pair2s.length; i++) {
    Pair2 pair2=pair2s[i];
    methodArray[i]=pair2.method;
    methodInterceptorList[i]=pair2.listeners;
  }
  byte[] bytes=ClassY.enhandClass(klass,newName,methodArray,constructors);
  if (debug)   Files.write(new File(newName),bytes);
  Class<T> newClass=(Class<T>)cd.define(newName,bytes);
  try {
    Mirror<T> mirror=Mirror.me(newClass);
    mirror.setValue(null,MethodArray_FieldName,methodArray);
    mirror.setValue(null,MethodInterceptorList_FieldName,methodInterceptorList);
  }
 catch (  Throwable e) {
  }
  return newClass;
}
Program: 43525
Project: 43525
Buggy source:
private void addField(){
  AopToolKit.addFields(cw);
}

Fixed version (ground truth):
private void addField(){
  cw.visitField(ACC_PRIVATE + ACC_STATIC,AsmClassAgent.MethodArray_FieldName,"String_Node_Str",null,null).visitEnd();
  cw.visitField(ACC_PRIVATE + ACC_STATIC,AsmClassAgent.MethodInterceptorList_FieldName,"String_Node_Str","String_Node_Str",null).visitEnd();
}
Program: 43526
Project: 43526
Buggy source:
public static boolean isJDK6(){
  InputStream is=null;
  try {
    String classFileName=Lang.class.getName().replace('.','/') + "String_Node_Str";
    is=Lang.class.getResourceAsStream(classFileName);
    if (is == null)     is=Lang.class.getResourceAsStream("String_Node_Str" + classFileName);
    if (is != null && is.available() > 8) {
      is.skip(7);
switch (is.read()) {
case 50:
        return true;
    }
  }
}
 catch (Throwable e) {
}
 finally {
  Streams.safeClose(is);
}
return false;
}

Fixed version (ground truth):
public static boolean isJDK6(){
  InputStream is=null;
  try {
    String classFileName=Lang.class.getName().replace('.','/') + "String_Node_Str";
    is=Lang.class.getResourceAsStream(classFileName);
    if (is == null)     is=Lang.class.getResourceAsStream("String_Node_Str" + classFileName);
    if (is != null && is.available() > 8) {
      is.skip(7);
      return is.read() > 49;
    }
  }
 catch (  Throwable e) {
  }
 finally {
    Streams.safeClose(is);
  }
  return false;
}
Program: 43527
Project: 43527
Buggy source:
public String getRealPath(String path){
  if (path.startsWith("String_Node_Str"))   return new File("String_Node_Str" + path).getAbsolutePath();
  if (path.startsWith("String_Node_Str"))   path=path.substring("String_Node_Str".length());
  if (path.startsWith("String_Node_Str"))   path=path.substring("String_Node_Str".length());
  return new File(path).getAbsolutePath();
}

Fixed version (ground truth):
public String getRealPath(String path){
  if (path.startsWith("String_Node_Str"))   return new File(path.substring("String_Node_Str".length())).getAbsolutePath();
  if (path.startsWith("String_Node_Str"))   return new File(path.substring("String_Node_Str".length())).getAbsolutePath();
  if (path.startsWith("String_Node_Str"))   return new File("String_Node_Str" + path).getAbsolutePath();
  return new File(path).getAbsolutePath();
}
Program: 43528
Project: 43528
Buggy source:
/** 
 * 将集合编程变成指定类型的列表
 * @param coll 集合对象
 * @param classOfList 列表类型
 * @return 列表对象
 */
public static <E>List<E> collection2list(Collection<E> coll,Class<List<E>> classOfList){
  if (coll instanceof List<?>)   return (List<E>)coll;
  List<E> list;
  try {
    list=(null == classOfList ? new ArrayList<E>(coll.size()) : classOfList.newInstance());
  }
 catch (  Exception e) {
    throw Lang.wrapThrow(e);
  }
  for (Iterator<E> it=coll.iterator(); it.hasNext(); ) {
    list.add(it.next());
  }
  return list;
}

Fixed version (ground truth):
/** 
 * 将集合编程变成指定类型的列表
 * @param col 集合对象
 * @param classOfList 列表类型
 * @return 列表对象
 */
public static <E>List<E> collection2list(Collection<?> col,Class<E> eleType){
  if (null == col)   return null;
  List<E> list=new ArrayList<E>(col.size());
  for (  Object obj : col)   list.add(Castors.me().castTo(obj,eleType));
  return list;
}
Program: 43530
Project: 43530
Buggy source:
/** 
 * 将集合变成指定类型的数组
 * @param coll 集合对象
 * @param eleType 数组元素类型
 * @return 数组
 */
public static Object collection2array(Collection<?> coll,Class<?> eleType){
  if (null == coll)   return null;
  Object re=Array.newInstance(eleType,coll.size());
  int i=0;
  for (Iterator<?> it=coll.iterator(); it.hasNext(); ) {
    Object obj=it.next();
    if (null == obj)     Array.set(re,i++,null);
 else     Array.set(re,i++,Castors.me().castTo(obj,eleType));
  }
  return re;
}

Fixed version (ground truth):
/** 
 * 将集合变成指定类型的数组
 * @param col 集合对象
 * @param eleType 数组元素类型
 * @return 数组
 */
@SuppressWarnings("String_Node_Str") public static <E>E[] collection2array(Collection<?> col,Class<E> eleType){
  if (null == col)   return null;
  Object re=Array.newInstance(eleType,col.size());
  int i=0;
  for (Iterator<?> it=col.iterator(); it.hasNext(); ) {
    Object obj=it.next();
    if (null == obj)     Array.set(re,i++,null);
 else     Array.set(re,i++,Castors.me().castTo(obj,eleType));
  }
  return (E[])re;
}
Program: 43531
Project: 43531
Buggy source:
private <T>T getAs(Class<T> toType,String key,T dft){
  Object obj=get(key);
  if (null == obj)   return dft;
  return Castors.me().castTo(obj,toType);
}

Fixed version (ground truth):
public <T>T getAs(Class<T> toType,String key,T dft){
  Object obj=get(key);
  if (null == obj)   return dft;
  return Castors.me().castTo(obj,toType);
}
Program: 43532
Project: 43532
Buggy source:
public Object[] adapt(ServletContext sc,HttpServletRequest request,HttpServletResponse response,String[] pathArgs){
  String str;
  try {
    str=Lang.readAll(new InputStreamReader(request.getInputStream(),Encoding.CHARSET_UTF8));
  }
 catch (  Exception e) {
    throw Lang.wrapThrow(e);
  }
  Map<String,Object> map=Lang.map(str);
  Object[] args=new Object[injs.length];
  int i=fillPathArgs(request,response,pathArgs,args);
  for (; i < injs.length; i++) {
    args[i]=injs[i].get(sc,request,response,map);
  }
  return args;
}

Fixed version (ground truth):
public Object[] adapt(ServletContext sc,HttpServletRequest request,HttpServletResponse response,String[] pathArgs){
  String str;
  try {
    str=Lang.readAll(new InputStreamReader(request.getInputStream(),Encoding.CHARSET_UTF8));
  }
 catch (  Exception e) {
    throw Lang.wrapThrow(e);
  }
  Object[] args=new Object[injs.length];
  int i=fillPathArgs(request,response,pathArgs,args);
  for (; i < injs.length; i++) {
    args[i]=injs[i].get(sc,request,response,str);
  }
  return args;
}
Program: 43534
Project: 43534
Buggy source:
public View make(Ioc ioc,String type,String value){
  type=type.toLowerCase();
  if (VIEW_JSP.equals(type))   return new JspView(value);
  if (VIEW_JSON.equals(type))   if (Strings.isBlank(value))   return new UTF8JsonView(JsonFormat.compact());
 else   return new UTF8JsonView(Json.fromJson(JsonFormat.class,value));
  if (VIEW_REDIRECT.equals(type) || VIEW_REDIRECT2.equals(type))   return new ServerRedirectView(value);
  if (VIEW_FORWARD.equals(type) || VIEW_FORWARD2.equals(type))   return new ForwardView(value);
  if (VIEW_VOID.equals(type))   return new VoidView();
  if (VIEW_IOC.equals(type))   return ioc.get(View.class,value);
  if (VIEW_HTTP.equals(type))   return new HttpStatusView(Integer.parseInt(value));
  if (VIEW_STRING.equals(type))   return new RawView(value);
  return null;
}

Fixed version (ground truth):
public View make(Ioc ioc,String type,String value){
  type=type.toLowerCase();
  if (VIEW_JSP.equals(type))   return new JspView(value);
  if (VIEW_JSON.equals(type))   if (Strings.isBlank(value))   return new UTF8JsonView(JsonFormat.compact());
 else   return new UTF8JsonView(Json.fromJson(JsonFormat.class,value));
  if (VIEW_REDIRECT.equals(type) || VIEW_REDIRECT2.equals(type))   return new ServerRedirectView(value);
  if (VIEW_FORWARD.equals(type) || VIEW_FORWARD2.equals(type))   return new ForwardView(value);
  if (VIEW_VOID.equals(type))   return new VoidView();
  if (VIEW_IOC.equals(type))   return ioc.get(View.class,value);
  if (VIEW_HTTP.equals(type))   return new HttpStatusView(Integer.parseInt(value));
  if (VIEW_RAW.equals(type))   return new RawView(value);
  return null;
}