nus-yam/ex-repair huggingface dataset:
Program: 21623
Project: 21623
Buggy source:
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider) throws Exception {
  Copier copier=new Copier(source.getDatabase(),dest.getDatabase(),orphanDataList,idProvider);
  copier.internalCopyInto(source,dest,maxDepth);
}

Fixed version (ground truth):
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider,OTDataObjectFinder dataObjectFinder) throws Exception {
  Copier copier=new Copier(source.getDatabase(),dest.getDatabase(),orphanDataList,idProvider,dataObjectFinder);
  copier.internalCopyInto(source,dest,maxDepth);
}
Program: 21624
Project: 21624
Buggy source:
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider) throws Exception {
  Copier.copyInto(source,dest,orphanDataList,maxDepth,idProvider);
}

Fixed version (ground truth):
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider,OTDataObjectFinder dataObjectFinder) throws Exception {
  Copier.copyInto(source,dest,orphanDataList,maxDepth,idProvider,dataObjectFinder);
}
Program: 21625
Project: 21625
Buggy source:
public static OTDataObject copy(OTDataObject original,OTDatabase otDb,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider) throws Exception {
  OTDataObject copy=otDb.createDataObject(original.getType());
  copyInto(original,copy,orphanDataList,maxDepth,idProvider);
  return copy;
}

Fixed version (ground truth):
/** 
 * @param original
 * @param otDb
 * @param orphanDataList
 * @param maxDepth if this is -1 then it will copy all the objects
 * @param idProvider
 * @param dataObjectFinder 
 * @return
 * @throws Exception
 */
public static OTDataObject copy(OTDataObject original,OTDatabase otDb,OTDataList orphanDataList,int maxDepth,OTExternalIDProvider idProvider,OTDataObjectFinder dataObjectFinder) throws Exception {
  OTDataObject copy=otDb.createDataObject(original.getType());
  copyInto(original,copy,orphanDataList,maxDepth,idProvider,dataObjectFinder);
  return copy;
}
Program: 21626
Project: 21626
Buggy source:
private OTObject getObjectToInsertFromUser(){
  OTObject otObj=null;
  System.out.println(documentEditConfig);
  otObj=OTObjectListViewer.showDialog(previewComponent,"String_Node_Str",getFrameManager(),getViewFactory(),documentEditConfig.getObjectsToInsert(),otObject.getOTObjectService(),true,true);
  return otObj;
}

Fixed version (ground truth):
private OTObject getObjectToInsertFromUser(){
  OTObject otObj=null;
  otObj=OTObjectListViewer.showDialog(previewComponent,"String_Node_Str",getFrameManager(),getViewFactory(),documentEditConfig.getObjectsToInsert(),otObject.getOTObjectService(),true,true);
  return otObj;
}
Program: 21627
Project: 21627
Buggy source:
public String updateFormatedView(){
  if (pfObject == null)   return null;
  String markupLanguage=pfObject.getMarkupLanguage();
  if (markupLanguage == null) {
    markupLanguage=System.getProperty("String_Node_Str",null);
  }
  String bodyText=pfObject.getDocumentText();
  bodyText=substituteIncludables(bodyText);
  int origCaretPos=0;
  if (markupLanguage == null || markupLanguage.equals(OTDocument.MARKUP_PFHTML) || markupLanguage.equals(OTDocument.MARKUP_PLAIN)) {
    if (editorPane == null) {
      editorPane=new JEditorPane();
      OTHTMLFactory kitViewFactory=new OTHTMLFactory(this);
      editorKit=new OTDocumentEditorKit(kitViewFactory);
      editorPane.setEditorKit(editorKit);
      editorPane.setEditable(true);
      editorPane.addHyperlinkListener(this);
      editorPane.addKeyListener(this);
    }
    origCaretPos=editorPane.getCaretPosition();
    bodyText=htmlizeText(bodyText);
    if (documentConfig != null) {
      String css=getCssText();
      String XHTML_PREFIX=XHTML_PREFIX_START + css + XHTML_PREFIX_END;
      bodyText=XHTML_PREFIX + bodyText + XHTML_SUFFIX;
    }
    removeAllSubViews();
    editorPane.setText(bodyText);
    previewComponent=editorPane;
  }
 else {
    System.err.println("String_Node_Str");
  }
  if (parsedTextArea == null) {
    parsedTextArea=new JTextArea();
  }
  parsedTextArea.setText(bodyText);
  editorPane.setCaretPosition(origCaretPos);
  return bodyText;
}

Fixed version (ground truth):
public String updateFormatedView(){
  if (pfObject == null)   return null;
  String markupLanguage=pfObject.getMarkupLanguage();
  if (markupLanguage == null) {
    markupLanguage=System.getProperty("String_Node_Str",null);
  }
  String bodyText=pfObject.getDocumentText();
  bodyText=substituteIncludables(bodyText);
  int origCaretPos=0;
  if (markupLanguage == null || markupLanguage.equals(OTDocument.MARKUP_PFHTML) || markupLanguage.equals(OTDocument.MARKUP_PLAIN)) {
    if (editorPane == null) {
      editorPane=new MyJEditorPane();
      OTHTMLFactory kitViewFactory=new OTHTMLFactory(this);
      editorKit=new OTDocumentEditorKit(kitViewFactory);
      editorPane.setEditorKit(editorKit);
      editorPane.setEditable(true);
      editorPane.addHyperlinkListener(this);
      editorPane.addKeyListener(this);
    }
    origCaretPos=editorPane.getCaretPosition();
    bodyText=htmlizeText(bodyText);
    if (documentConfig != null) {
      String css=getCssText();
      String XHTML_PREFIX=XHTML_PREFIX_START + css + XHTML_PREFIX_END;
      bodyText=XHTML_PREFIX + bodyText + XHTML_SUFFIX;
    }
    removeAllSubViews();
    editorPane.setText(bodyText);
    previewComponent=editorPane;
  }
 else {
    System.err.println("String_Node_Str");
  }
  if (parsedTextArea == null) {
    parsedTextArea=new JTextArea();
  }
  parsedTextArea.setText(bodyText);
  editorPane.setCaretPosition(origCaretPos);
  return bodyText;
}
Program: 21628
Project: 21628
Buggy source:
public void scrollRectToVisible(Rectangle aRect){
  if (!isScrollingAllowed()) {
    return;
  }
  super.scrollRectToVisible(aRect);
}

Fixed version (ground truth):
public void scrollRectToVisible(Rectangle contentRect){
  if (!isScrollingAllowed()) {
    return;
  }
  super.scrollRectToVisible(contentRect);
}
Program: 21632
Project: 21632
Buggy source:
protected String toStringInternal(){
  if (rootId == null) {
    return relativeId.toString();
  }
  return rootId.toExternalForm() + "String_Node_Str" + relativeId.toExternalForm();
}

Fixed version (ground truth):
protected String toStringInternal(){
  if (rootId == null) {
    return relativeId.toExternalForm();
  }
  return rootId.toExternalForm() + "String_Node_Str" + relativeId.toExternalForm();
}
Program: 21634
Project: 21634
Buggy source:
/** 
 * Check if this id is actually a local id reference.  If it is then return the ${xxx} notation used in the otml files.
 * @param id
 * @return
 */
public static String convertId(OTID id){
  if (id instanceof OTRelativeID) {
    OTRelativeID relId=(OTRelativeID)id;
    OTID relRelId=relId.getRelativeId();
    if (relId.getRootId().equals(otDb.getDatabaseId()) && relRelId instanceof OTPathID && relRelId.toString().startsWith("String_Node_Str")) {
      return "String_Node_Str" + relRelId.toString().substring(1) + "String_Node_Str";
    }
  }
  return id.toString();
}

Fixed version (ground truth):
/** 
 * Check if this id is actually a local id reference.  If it is then return the ${xxx} notation used in the otml files.
 * @param id
 * @return
 */
public static String convertId(OTID id){
  if (id instanceof OTRelativeID) {
    OTRelativeID relId=(OTRelativeID)id;
    OTID relRelId=relId.getRelativeId();
    if (relId.getRootId().equals(otDb.getDatabaseId()) && relRelId instanceof OTPathID && relRelId.toExternalForm().startsWith("String_Node_Str")) {
      return "String_Node_Str" + relRelId.toExternalForm().substring(1) + "String_Node_Str";
    }
  }
  return id.toExternalForm();
}
Program: 21635
Project: 21635
Buggy source:
public static void export(Writer writer,OTDataObject rootObject,OTDatabase db) throws Exception {
  writtenIds=new ArrayList();
  processedClasses=new ArrayList();
  duplicateClasses=new ArrayList();
  containers=new HashMap();
  processedIds=new ArrayList();
  incomingReferenceMap=new HashMap();
  if (db instanceof XMLDatabase) {
    ArrayList importedClasses=((XMLDatabase)db).getImportedOTObjectClasses();
    processedClasses.addAll(importedClasses);
  }
  otDb=db;
  processObject(rootObject);
  Element rootObjectElement=exportObject(rootObject,null,null);
  Element otrunkEl=new Element("String_Node_Str");
  otrunkEl.setAttribute("String_Node_Str",otDb.getDatabaseId().toString());
  Element importsEl=new Element("String_Node_Str");
  otrunkEl.addContent(importsEl);
  for (int i=0; i < processedClasses.size(); i++) {
    Element importEl=new Element("String_Node_Str");
    importsEl.addContent(importEl);
    importEl.setAttribute("String_Node_Str",(String)processedClasses.get(i));
  }
  Element objectsEl=new Element("String_Node_Str");
  otrunkEl.addContent(objectsEl);
  objectsEl.addContent(rootObjectElement);
  Document doc=new Document(otrunkEl);
  Format format=Format.getPrettyFormat();
  XMLOutputter outputter=new XMLOutputter(format);
  outputter.output(doc,writer);
  writer.close();
}

Fixed version (ground truth):
public static void export(Writer writer,OTDataObject rootObject,OTDatabase db) throws Exception {
  writtenIds=new ArrayList();
  processedClasses=new ArrayList();
  duplicateClasses=new ArrayList();
  containers=new HashMap();
  processedIds=new ArrayList();
  incomingReferenceMap=new HashMap();
  if (db instanceof XMLDatabase) {
    ArrayList importedClasses=((XMLDatabase)db).getImportedOTObjectClasses();
    processedClasses.addAll(importedClasses);
  }
  otDb=db;
  processObject(rootObject);
  Element rootObjectElement=null;
  try {
    rootObjectElement=exportObject(rootObject,null,null);
  }
 catch (  Exception e) {
    return;
  }
  Element otrunkEl=new Element("String_Node_Str");
  otrunkEl.setAttribute("String_Node_Str",otDb.getDatabaseId().toString());
  Element importsEl=new Element("String_Node_Str");
  otrunkEl.addContent(importsEl);
  for (int i=0; i < processedClasses.size(); i++) {
    Element importEl=new Element("String_Node_Str");
    importsEl.addContent(importEl);
    importEl.setAttribute("String_Node_Str",(String)processedClasses.get(i));
  }
  Element objectsEl=new Element("String_Node_Str");
  otrunkEl.addContent(objectsEl);
  objectsEl.addContent(rootObjectElement);
  Document doc=new Document(otrunkEl);
  Format format=Format.getPrettyFormat();
  XMLOutputter outputter=new XMLOutputter(format);
  if (saveFile != null) {
    System.out.println("String_Node_Str");
    FileOutputStream outputStream=new FileOutputStream(saveFile);
    OutputStreamWriter outputStreamWriter=new OutputStreamWriter(outputStream,"String_Node_Str");
    outputter.output(doc,outputStreamWriter);
    outputStreamWriter.close();
    writer.close();
  }
 else {
    System.out.println("String_Node_Str");
    outputter.output(doc,writer);
    writer.close();
  }
}
Program: 21639
Project: 21639
Buggy source:
public void put(String key,Object resource){
  OTDataMap userMap=getUserMap();
  userMap.put(key,resource);
}

Fixed version (ground truth):
public void put(String key,Object resource){
  OTDataMap userMap=getUserMap();
  resource=resolveIDResource(resource);
  userMap.put(key,resource);
}
Program: 21642
Project: 21642
Buggy source:
public boolean isResourceSet(String resourceName){
  OTClassProperty property=otClass().getProperty(resourceName);
  return otIsSet(property);
}

Fixed version (ground truth):
public boolean isResourceSet(String resourceName){
  OTClassProperty property=otClass().getProperty(resourceName);
  if (property == null) {
    throw new IllegalStateException("String_Node_Str" + resourceName + "String_Node_Str"+ otClass().getInstanceClass().getName());
  }
  return otIsSet(property);
}
Program: 21643
Project: 21643
Buggy source:
public static void export(Writer writer,OTDataObject rootObject,OTDatabase db) throws Exception {
  writtenIds=new ArrayList();
  processedClasses=new ArrayList();
  duplicateClasses=new ArrayList();
  containers=new HashMap();
  processedIds=new ArrayList();
  incomingReferenceMap=new HashMap();
  if (db instanceof XMLDatabase) {
    ArrayList importedClasses=((XMLDatabase)db).getImportedOTObjectClasses();
    processedClasses.addAll(importedClasses);
  }
  PrintWriter printStream=new PrintWriter(writer);
  otDb=db;
  processObject(rootObject);
  Element rootObjectElement=exportObject(rootObject,null,null);
  Element otrunkEl=new Element("String_Node_Str");
  otrunkEl.setAttribute("String_Node_Str",otDb.getDatabaseId().toString());
  Element importsEl=new Element("String_Node_Str");
  otrunkEl.addContent(importsEl);
  for (int i=0; i < processedClasses.size(); i++) {
    Element importEl=new Element("String_Node_Str");
    importsEl.addContent(importEl);
    importEl.setAttribute("String_Node_Str",(String)processedClasses.get(i));
  }
  Element objectsEl=new Element("String_Node_Str");
  otrunkEl.addContent(objectsEl);
  objectsEl.addContent(rootObjectElement);
  Document doc=new Document(otrunkEl);
  Format format=Format.getPrettyFormat();
  XMLOutputter outputter=new XMLOutputter(format);
  outputter.output(doc,printStream);
  printStream.close();
}

Fixed version (ground truth):
public static void export(Writer writer,OTDataObject rootObject,OTDatabase db) throws Exception {
  writtenIds=new ArrayList();
  processedClasses=new ArrayList();
  duplicateClasses=new ArrayList();
  containers=new HashMap();
  processedIds=new ArrayList();
  incomingReferenceMap=new HashMap();
  if (db instanceof XMLDatabase) {
    ArrayList importedClasses=((XMLDatabase)db).getImportedOTObjectClasses();
    processedClasses.addAll(importedClasses);
  }
  otDb=db;
  processObject(rootObject);
  Element rootObjectElement=exportObject(rootObject,null,null);
  Element otrunkEl=new Element("String_Node_Str");
  otrunkEl.setAttribute("String_Node_Str",otDb.getDatabaseId().toString());
  Element importsEl=new Element("String_Node_Str");
  otrunkEl.addContent(importsEl);
  for (int i=0; i < processedClasses.size(); i++) {
    Element importEl=new Element("String_Node_Str");
    importsEl.addContent(importEl);
    importEl.setAttribute("String_Node_Str",(String)processedClasses.get(i));
  }
  Element objectsEl=new Element("String_Node_Str");
  otrunkEl.addContent(objectsEl);
  objectsEl.addContent(rootObjectElement);
  Document doc=new Document(otrunkEl);
  Format format=Format.getPrettyFormat();
  XMLOutputter outputter=new XMLOutputter(format);
  outputter.output(doc,writer);
  writer.close();
}
Program: 21644
Project: 21644
Buggy source:
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  String methodName=method.getName();
  if (methodName.equals("String_Node_Str")) {
    return dataObject.getGlobalId();
  }
 else   if (methodName.equals("String_Node_Str")) {
    return copyInto(args[0]);
  }
  return null;
}

Fixed version (ground truth):
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  String methodName=method.getName();
  if (methodName.equals("String_Node_Str")) {
    return dataObject.getGlobalId();
  }
  return null;
}
Program: 21645
Project: 21645
Buggy source:
public OTObject copyObject(OTObject original,int maxDepth) throws Exception {
  OTDataObject originalDataObject=getOTDataObject(original.getGlobalId());
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,maxDepth);
  return getOTObject(copyDataObject.getGlobalId());
}

Fixed version (ground truth):
public OTObject copyObject(OTObject original,OTObjectList orphanObjectList,int maxDepth) throws Exception {
  OTDataObject originalDataObject=getOTDataObject(original.getGlobalId());
  OTDataList orphanDataList=((OTObjectListImpl)orphanObjectList).getDataList();
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,orphanDataList,maxDepth);
  return getOTObject(copyDataObject.getGlobalId());
}
Program: 21648
Project: 21648
Buggy source:
private Object handleChild(Object child,int maxDepth) throws Exception {
  if (child instanceof OTID && (maxDepth == -1 || maxDepth > 0)) {
    if (!contains((OTID)child)) {
      OTDataObject itemObj=otDb.getOTDataObject(root,(OTID)child);
      OTDataObject itemCopy=otDb.createDataObject();
      int copyMaxDepth=-1;
      if (maxDepth != -1) {
        copyMaxDepth=maxDepth - 1;
      }
      CopyEntry itemCopyEntry=new CopyEntry(itemObj,copyMaxDepth,itemCopy);
      toBeCopied.add(itemCopyEntry);
      child=itemCopy.getGlobalId();
    }
  }
  return child;
}

Fixed version (ground truth):
private Object handleChild(Object child,int maxDepth) throws Exception {
  if (child instanceof OTID && (maxDepth == -1 || maxDepth > 0)) {
    CopyEntry itemCopyEntry=getCopyEntry((OTID)child);
    if (itemCopyEntry == null) {
      OTDataObject itemObj=otDb.getOTDataObject(root,(OTID)child);
      OTDataObject itemCopy=otDb.createDataObject();
      int copyMaxDepth=-1;
      if (maxDepth != -1) {
        copyMaxDepth=maxDepth - 1;
      }
      itemCopyEntry=new CopyEntry(itemObj,copyMaxDepth,itemCopy);
      toBeCopied.add(itemCopyEntry);
    }
    child=itemCopyEntry.copy.getGlobalId();
  }
  return child;
}
Program: 21649
Project: 21649
Buggy source:
public Copier(OTDatabase otDb){
  this.otDb=otDb;
  this.toBeCopied=new Vector();
}

Fixed version (ground truth):
public Copier(OTDatabase otDb,OTDataList orphanDataList){
  this.otDb=otDb;
  this.toBeCopied=new Vector();
  this.orphanList=orphanDataList;
}
Program: 21650
Project: 21650
Buggy source:
public static void copyInto(OTDataObject source,OTDataObject dest,int maxDepth) throws Exception {
  Copier copier=new Copier(dest.getDatabase());
  copier.internalCopyInto(source,dest,maxDepth);
}

Fixed version (ground truth):
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth) throws Exception {
  Copier copier=new Copier(dest.getDatabase(),orphanDataList);
  copier.internalCopyInto(source,dest,maxDepth);
}
Program: 21652
Project: 21652
Buggy source:
public static void copyInto(OTDataObject source,OTDataObject dest,int maxDepth) throws Exception {
  Copier.copyInto(source,dest,maxDepth);
}

Fixed version (ground truth):
public static void copyInto(OTDataObject source,OTDataObject dest,OTDataList orphanDataList,int maxDepth) throws Exception {
  Copier.copyInto(source,dest,orphanDataList,maxDepth);
}
Program: 21653
Project: 21653
Buggy source:
public static OTDataObject copy(OTDataObject original,OTDatabase otDb,int maxDepth) throws Exception {
  OTDataObject copy=otDb.createDataObject();
  copyInto(original,copy,maxDepth);
  return copy;
}

Fixed version (ground truth):
public static OTDataObject copy(OTDataObject original,OTDatabase otDb,OTDataList orphanDataList,int maxDepth) throws Exception {
  OTDataObject copy=otDb.createDataObject();
  copyInto(original,copy,orphanDataList,maxDepth);
  return copy;
}
Program: 21654
Project: 21654
Buggy source:
/** 
 * This method is needed if you use an object map which uses object ids for its keys.  This is useful if you want to look up one object using another object.  You cannot simply do  OTObject valueObject = map.getObject(keyObject.getGlobalId().toString()); because when running in user mode the keyObject id will not be the same as what is in the map.  It is wrapped with a template/user object so  changes to it can be saved correctly.
 * @param map
 * @param keyObject
 * @return
 */
public static OTObject getObjectFromMapWithIdKeys(OTObjectMap map,OTObject keyObject){
  OTObjectService objectService=keyObject.getOTObjectService();
  Vector keys=map.getObjectKeys();
  for (int i=0; i < keys.size(); i++) {
    String currentKey=(String)keys.get(i);
    OTID currentKeyId=objectService.getOTID(currentKey);
    try {
      OTObject currentKeyObject=objectService.getOTObject(currentKeyId);
      if (currentKeyObject == keyObject) {
        return (OTViewEntry)map.getObject(currentKey);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This method is needed if you use an object map which uses object ids for its keys.  This is useful if you want to look up one object using another object.  You cannot simply do  OTObject valueObject = map.getObject(keyObject.getGlobalId().toString()); because when running in user mode the keyObject id will not be the same as what is in the map.  It is wrapped with a template/user object so  changes to it can be saved correctly.
 * @param map
 * @param keyObject
 * @return
 */
public static OTObject getObjectFromMapWithIdKeys(OTObjectMap map,OTObject keyObject){
  OTObjectService objectService=keyObject.getOTObjectService();
  Vector keys=map.getObjectKeys();
  for (int i=0; i < keys.size(); i++) {
    String currentKey=(String)keys.get(i);
    OTID currentKeyId=objectService.getOTID(currentKey);
    try {
      OTObject currentKeyObject=objectService.getOTObject(currentKeyId);
      if (currentKeyObject == keyObject) {
        return map.getObject(currentKey);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return null;
}
Program: 21655
Project: 21655
Buggy source:
public JComponent getComponent(OTObject otObject,boolean editable){
  OTResourceMap otMap=((OTMapTestObject)otObject).getResourceMap();
  if (otMap.size() == 0) {
    Set entries=map.entrySet();
    Iterator iter=entries.iterator();
    while (iter.hasNext()) {
      Map.Entry entry=(Map.Entry)iter.next();
      map.put((String)entry.getKey(),entry.getValue());
    }
    return new JLabel("String_Node_Str");
  }
  if (otMap.size() != map.size()) {
    return new JLabel("String_Node_Str");
  }
  Set entries=map.entrySet();
  Iterator iter=entries.iterator();
  while (iter.hasNext()) {
    Map.Entry entry=(Map.Entry)iter.next();
    Object value=otMap.get((String)entry.getKey());
    if (value instanceof byte[]) {
      if (!checkBytes(value,entry.getValue())) {
        return new JLabel("String_Node_Str");
      }
    }
 else     if (!value.equals(entry.getValue())) {
      return new JLabel("String_Node_Str");
    }
  }
  return new JLabel("String_Node_Str");
}

Fixed version (ground truth):
public JComponent getComponent(OTObject otObject,boolean editable){
  OTResourceMap otMap=((OTMapTestObject)otObject).getResourceMap();
  if (otMap.size() == 0) {
    Set entries=map.entrySet();
    Iterator iter=entries.iterator();
    while (iter.hasNext()) {
      Map.Entry entry=(Map.Entry)iter.next();
      otMap.put((String)entry.getKey(),entry.getValue());
    }
    return new JLabel("String_Node_Str");
  }
  if (otMap.size() != map.size()) {
    return new JLabel("String_Node_Str");
  }
  Set entries=map.entrySet();
  Iterator iter=entries.iterator();
  while (iter.hasNext()) {
    Map.Entry entry=(Map.Entry)iter.next();
    Object value=otMap.get((String)entry.getKey());
    if (value instanceof byte[]) {
      if (!checkBytes(value,entry.getValue())) {
        return new JLabel("String_Node_Str");
      }
    }
 else     if (!value.equals(entry.getValue())) {
      return new JLabel("String_Node_Str");
    }
  }
  return new JLabel("String_Node_Str");
}
Program: 21656
Project: 21656
Buggy source:
/** 
 * This method is used by object services that can't handle a requested object this happens in reports when a report object needs to access a user object. It might be possible to clean this up by explicitly giving the object service of the report access to the users objects. 
 * @param childID
 * @return
 * @throws Exception
 */
OTObject getOrphanOTObject(OTID childID) throws Exception {
  for (int i=0; i < objectServices.size(); i++) {
    OTObjectServiceImpl objService=(OTObjectServiceImpl)objectServices.get(i);
    if (objService.managesObject(childID)) {
      return objService.getOTObject(childID);
    }
  }
  System.err.println("String_Node_Str" + childID);
  return null;
}

Fixed version (ground truth):
/** 
 * This method is used by object services that can't handle a requested object this happens in reports when a report object needs to access a user object. It might be possible to clean this up by explicitly giving the object service of the report access to the users objects. 
 * @param childID
 * @return
 * @throws Exception
 */
OTObject getOrphanOTObject(OTID childID,OTObjectServiceImpl oldService) throws Exception {
  for (int i=0; i < objectServices.size(); i++) {
    OTObjectServiceImpl objService=(OTObjectServiceImpl)objectServices.get(i);
    if (objService.managesObject(childID) && objService != oldService) {
      return objService.getOTObject(childID);
    }
  }
  System.err.println("String_Node_Str" + childID);
  return null;
}
Program: 21657
Project: 21657
Buggy source:
public OTDocumentObjectView(Element elem,OTDocument doc,AbstractOTDocumentView docView){
  super(elem);
  compoundDoc=doc;
  viewContainerPanel=new OTViewContainerPanel(docView.getFrameManager());
  viewContainerPanel.setOTViewFactory(docView.getViewFactory());
  viewContainerPanel.setAutoRequestFocus(false);
  viewContainerPanel.setUseScrollPane(false);
  viewContainerPanel.setOpaque(false);
}

Fixed version (ground truth):
/** 
 * A new object view will be created each time the text of the  document is updated.  So this object needs to be careful about the listeners it adds to things.   One option would be to cache the panels used to display the objects in documentView, and that way new views don't need to be created each time the text is changed.
 * @param elem
 * @param doc
 * @param docView
 */
public OTDocumentObjectView(Element elem,OTDocument doc,AbstractOTDocumentView docView){
  super(elem);
  compoundDoc=doc;
  viewContainerPanel=docView.createtViewContainerPanel();
}
Program: 21658
Project: 21658
Buggy source:
public String updateFormatedView(){
  if (pfDocument == null)   return null;
  String markupLanguage=pfDocument.getMarkupLanguage();
  if (markupLanguage == null) {
    markupLanguage=System.getProperty("String_Node_Str",null);
  }
  String bodyText=pfDocument.getDocumentText();
  bodyText=substituteIncludables(bodyText);
  if (markupLanguage == null || markupLanguage.equals(OTDocument.MARKUP_PFHTML) || markupLanguage.equals(OTDocument.MARKUP_PLAIN)) {
    if (editorPane == null) {
      editorPane=new JEditorPane();
      OTHTMLFactory kitViewFactory=new OTHTMLFactory(pfDocument,this);
      OTDocumentEditorKit editorKit=new OTDocumentEditorKit(pfDocument,kitViewFactory);
      editorPane.setEditorKit(editorKit);
      editorPane.setEditable(false);
      editorPane.addHyperlinkListener(this);
    }
    bodyText=htmlizeText(bodyText);
    editorPane.setText(bodyText);
    previewComponent=editorPane;
    editorPane.setCaretPosition(0);
  }
 else {
    System.err.println("String_Node_Str");
  }
  if (parsedTextArea == null) {
    parsedTextArea=new JTextArea();
  }
  parsedTextArea.setText(bodyText);
  return bodyText;
}

Fixed version (ground truth):
public String updateFormatedView(){
  if (pfDocument == null)   return null;
  String markupLanguage=pfDocument.getMarkupLanguage();
  if (markupLanguage == null) {
    markupLanguage=System.getProperty("String_Node_Str",null);
  }
  String bodyText=pfDocument.getDocumentText();
  bodyText=substituteIncludables(bodyText);
  if (markupLanguage == null || markupLanguage.equals(OTDocument.MARKUP_PFHTML) || markupLanguage.equals(OTDocument.MARKUP_PLAIN)) {
    if (editorPane == null) {
      editorPane=new JEditorPane();
      OTHTMLFactory kitViewFactory=new OTHTMLFactory(pfDocument,this);
      OTDocumentEditorKit editorKit=new OTDocumentEditorKit(pfDocument,kitViewFactory);
      editorPane.setEditorKit(editorKit);
      editorPane.setEditable(false);
      editorPane.addHyperlinkListener(this);
    }
    bodyText=htmlizeText(bodyText);
    removeAllSubViews();
    editorPane.setText(bodyText);
    previewComponent=editorPane;
    editorPane.setCaretPosition(0);
  }
 else {
    System.err.println("String_Node_Str");
  }
  if (parsedTextArea == null) {
    parsedTextArea=new JTextArea();
  }
  parsedTextArea.setText(bodyText);
  return bodyText;
}
Program: 21659
Project: 21659
Buggy source:
public static String escapeElementText(String text){
  String newText=text.replaceAll("String_Node_Str","String_Node_Str");
  newText=text.replaceAll("String_Node_Str","String_Node_Str");
  newText=newText.replaceAll("String_Node_Str","String_Node_Str");
  return newText;
}

Fixed version (ground truth):
public static String escapeElementText(String text){
  String newText=text.replaceAll("String_Node_Str","String_Node_Str");
  newText=newText.replaceAll("String_Node_Str","String_Node_Str");
  newText=newText.replaceAll("String_Node_Str","String_Node_Str");
  return newText;
}
Program: 21661
Project: 21661
Buggy source:
/** 
 * @return Returns the menuBar.
 */
public JMenuBar updateMenuBar(){
  JMenu fileMenu=null;
  if (menuBar == null) {
    menuBar=new JMenuBar();
    fileMenu=new JMenu("String_Node_Str");
    menuBar.add(fileMenu);
  }
 else {
    fileMenu=menuBar.getMenu(0);
    fileMenu.removeAll();
  }
  if (userMode == SINGLE_USER_MODE) {
    fileMenu.setEnabled(!justStarted);
    fileMenu.add(newUserDataAction);
    fileMenu.add(loadUserDataAction);
    fileMenu.add(saveUserDataAction);
    fileMenu.add(saveUserDataAsAction);
  }
  if (Boolean.getBoolean(DEBUG_PROP)) {
    fileMenu.add(loadAction);
    fileMenu.add(saveAction);
    fileMenu.add(saveAsAction);
  }
  if (Boolean.getBoolean("String_Node_Str")) {
    fileMenu.add(exportImageAction);
    fileMenu.add(exportHiResImageAction);
  }
  fileMenu.add(exportToHtmlAction);
  fileMenu.add(showConsoleAction);
  JCheckBoxMenuItem debugItem=new JCheckBoxMenuItem(debugAction);
  debugItem.setSelected(Boolean.getBoolean(DEBUG_PROP));
  fileMenu.add(debugItem);
  fileMenu.add(exitAction);
  return menuBar;
}

Fixed version (ground truth):
/** 
 * @return Returns the menuBar.
 */
public JMenuBar updateMenuBar(){
  JMenu fileMenu=null;
  if (menuBar == null) {
    menuBar=new JMenuBar();
    fileMenu=new JMenu("String_Node_Str");
    menuBar.add(fileMenu);
  }
 else {
    fileMenu=menuBar.getMenu(0);
    fileMenu.removeAll();
  }
  if (userMode == SINGLE_USER_MODE) {
    fileMenu.setEnabled(!justStarted);
    fileMenu.add(newUserDataAction);
    fileMenu.add(loadUserDataAction);
    fileMenu.add(saveUserDataAction);
    fileMenu.add(saveUserDataAsAction);
  }
  if (Boolean.getBoolean(DEBUG_PROP)) {
    fileMenu.add(loadAction);
    fileMenu.add(reloadAction);
    fileMenu.add(saveAction);
    fileMenu.add(saveAsAction);
  }
  if (Boolean.getBoolean("String_Node_Str")) {
    fileMenu.add(exportImageAction);
    fileMenu.add(exportHiResImageAction);
  }
  fileMenu.add(exportToHtmlAction);
  fileMenu.add(showConsoleAction);
  JCheckBoxMenuItem debugItem=new JCheckBoxMenuItem(debugAction);
  debugItem.setSelected(Boolean.getBoolean(DEBUG_PROP));
  fileMenu.add(debugItem);
  fileMenu.add(exitAction);
  return menuBar;
}
Program: 21663
Project: 21663
Buggy source:
/** 
 * This is a temporary method.  It works for files that represent a single user.  This method finds that user and registers them.  It could be modified to register all the users referenced in the passed in database and in which case it should check if the user is already registered with another database.  
 * @param userDataDb
 * @throws Exception
 */
public void registerUserDataDatabase(OTDatabase userDataDb) throws Exception {
  OTStateRoot stateRoot=(OTStateRoot)getRootObject(userDataDb);
  OTObjectMap userMap=stateRoot.getUserMap();
  Vector keys=userMap.getObjectKeys();
  OTReferenceMap refMap=(OTReferenceMap)userMap.getObject((String)keys.get(0));
  OTUser currentUser=refMap.getUser();
  users.add(currentUser);
  OTTemplateDatabase db=new OTTemplateDatabase(rootDb,userDataDb,refMap);
  userTemplateDatabases.put(currentUser.getUserId(),db);
}

Fixed version (ground truth):
/** 
 * This is a temporary method.  It works for files that represent a single user.  This method finds that user and registers them.  It could be modified to register all the users referenced in the passed in database and in which case it should check if the user is already registered with another database.  
 * @param userDataDb
 * @throws Exception
 */
public void registerUserDataDatabase(OTDatabase userDataDb) throws Exception {
  if (!databases.contains(userDataDb)) {
    databases.add(userDataDb);
  }
  OTStateRoot stateRoot=(OTStateRoot)getRootObject(userDataDb);
  OTObjectMap userMap=stateRoot.getUserMap();
  Vector keys=userMap.getObjectKeys();
  OTReferenceMap refMap=(OTReferenceMap)userMap.getObject((String)keys.get(0));
  OTUser currentUser=refMap.getUser();
  users.add(currentUser);
  OTTemplateDatabase db=new OTTemplateDatabase(rootDb,userDataDb,refMap);
  databases.add(db);
  userTemplateDatabases.put(currentUser.getUserId(),db);
}
Program: 21664
Project: 21664
Buggy source:
public void run(){
  JComponent newComponent=null;
  if (currentObject != null) {
    currentView=otViewFactory.getObjectView(currentObject,OTViewContainerPanel.this);
    if (currentView == null) {
      newComponent=new JLabel("String_Node_Str" + currentObject);
    }
 else {
      newComponent=currentView.getComponent(true);
    }
  }
 else {
    newComponent=new JLabel("String_Node_Str");
  }
  removeAll();
  add(newComponent,BorderLayout.CENTER);
  revalidate();
  notifyListeners();
  newComponent.requestFocus();
}

Fixed version (ground truth):
public void run(){
  try {
    String seperator=System.getProperty("String_Node_Str");
    String id=otObject.getGlobalId().toString();
    id=id.replaceAll("String_Node_Str","String_Node_Str");
    id=id.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (!folder.isDirectory()) {
      text=null;
      return;
    }
    File newFile=new File(folder,id);
    BufferedImage bim=ComponentScreenshot.makeComponentImageAlpha(comp,scaleX,scaleY);
    ComponentScreenshot.saveImageAsFile(bim,newFile,"String_Node_Str");
    text=folder + "String_Node_Str" + id;
    return;
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  text=null;
}
Program: 21665
Project: 21665
Buggy source:
public String saveImage(JComponent comp,float scaleX,float scaleY,File folder,OTObject otObject){
  try {
    String seperator=System.getProperty("String_Node_Str");
    String id=otObject.getGlobalId().toString();
    id=id.replaceAll("String_Node_Str","String_Node_Str");
    id=id.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (!folder.isDirectory())     return null;
    File newFile=new File(folder.getAbsoluteFile().toString() + seperator + id);
    BufferedImage bim=ComponentScreenshot.makeComponentImageAlpha(comp,scaleX,scaleY);
    ComponentScreenshot.saveImageAsFile(bim,newFile,"String_Node_Str");
    String relativePath=folder + "String_Node_Str" + newFile.getName();
    return relativePath;
  }
 catch (  Throwable t) {
    t.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This code attempts to save an image of the component.   It does 3 things that are a bit odd but seem to make things work. 1. It calls addNotify on the component.  This tricks it into thinking it has a parent, so it can be laid out. 2. It calls validate on the component that makes it get laid out. 3. The image saving code is placed into a invoke and wait call. Both setSize and validate cause events to be queued so we use Invoke and wait so these events get processed before we save the image by calling paint on it.
 */
public String saveImage(JComponent comp,float scaleX,float scaleY,File folder,OTObject otObject){
  Dimension compSize=comp.getSize();
  if (compSize.height <= 0 || compSize.width <= 0) {
    throw new RuntimeException("String_Node_Str" + compSize.width + "String_Node_Str"+ compSize.height+ "String_Node_Str");
  }
  comp.addNotify();
  comp.validate();
  ImageSaver saver=new ImageSaver(comp,folder,otObject,scaleX,scaleY);
  try {
    SwingUtilities.invokeAndWait(saver);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
  return saver.getText();
}
Program: 21666
Project: 21666
Buggy source:
public void setCurrentObject(OTObject pfObject,OTFrame otFrame){
  if (otFrame != null) {
    frameManager.setFrameObject(pfObject,otFrame);
    return;
  }
  if (currentView != null) {
    currentView.viewClosed();
  }
  currentObject=pfObject;
  JComponent newComponent=null;
  if (pfObject != null) {
    currentView=otViewFactory.getObjectView(pfObject,this);
    if (currentView == null) {
      newComponent=new JLabel("String_Node_Str" + pfObject);
    }
 else {
      newComponent=currentView.getComponent(true);
    }
  }
 else {
    newComponent=new JLabel("String_Node_Str");
  }
  removeAll();
  add(newComponent,BorderLayout.CENTER);
  revalidate();
  notifyListeners();
}

Fixed version (ground truth):
public void setCurrentObject(OTObject pfObject,OTFrame otFrame){
  if (otFrame != null) {
    frameManager.setFrameObject(pfObject,otFrame);
    return;
  }
  if (currentView != null) {
    currentView.viewClosed();
  }
  currentObject=pfObject;
  JComponent newComponent=null;
  if (pfObject != null) {
    currentView=otViewFactory.getObjectView(pfObject,this);
    if (currentView == null) {
      newComponent=new JLabel("String_Node_Str" + pfObject);
    }
 else {
      newComponent=currentView.getComponent(true);
    }
  }
 else {
    newComponent=new JLabel("String_Node_Str");
  }
  removeAll();
  add(newComponent,BorderLayout.CENTER);
  revalidate();
  notifyListeners();
  newComponent.requestFocus();
}
Program: 21667
Project: 21667
Buggy source:
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  bodyPanel.addViewContainerListener(this);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    updateTreePane();
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setVisible(true);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
      if (screenSize.width < 1000 || screenSize.height < 700) {
        int state=getExtendedState();
        state|=Frame.MAXIMIZED_BOTH;
        setExtendedState(state);
      }
 else {
        setBounds(100,100,875,600);
      }
      bodyPanel.invalidate();
      bodyPanel.repaint();
    }
  }
);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}

Fixed version (ground truth):
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  bodyPanel.addViewContainerListener(this);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    updateTreePane();
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
      if (screenSize.width < 1000 || screenSize.height < 700) {
        setVisible(true);
        int state=getExtendedState();
        state|=Frame.MAXIMIZED_BOTH;
        setExtendedState(state);
      }
 else {
        setBounds(100,100,875,600);
        setVisible(true);
      }
    }
  }
);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}
Program: 21668
Project: 21668
Buggy source:
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  bodyPanel.addViewContainerListener(this);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    updateTreePane();
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setVisible(true);
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  if (screenSize.width < 1000 || screenSize.height < 700) {
    int state=getExtendedState();
    state|=Frame.MAXIMIZED_BOTH;
    setExtendedState(state);
  }
 else {
    setBounds(100,100,875,600);
  }
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}

Fixed version (ground truth):
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  bodyPanel.addViewContainerListener(this);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    updateTreePane();
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setVisible(true);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
      if (screenSize.width < 1000 || screenSize.height < 700) {
        int state=getExtendedState();
        state|=Frame.MAXIMIZED_BOTH;
        setExtendedState(state);
      }
 else {
        setBounds(100,100,875,600);
      }
      bodyPanel.invalidate();
      bodyPanel.repaint();
    }
  }
);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}
Program: 21669
Project: 21669
Buggy source:
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    folderTreeArea=new JTree(folderTreeModel);
    folderTreeArea.setEditable(true);
    folderTreeArea.addTreeSelectionListener(this);
    JScrollPane folderTreeScrollPane=new JScrollPane(folderTreeArea);
    dataTreeArea=new JTree(dataTreeModel);
    dataTreeArea.setEditable(true);
    dataTreeArea.addTreeSelectionListener(this);
    JScrollPane dataTreeScrollPane=new JScrollPane(dataTreeArea);
    JTabbedPane tabbedPane=new JTabbedPane();
    tabbedPane.add("String_Node_Str",folderTreeScrollPane);
    tabbedPane.add("String_Node_Str",dataTreeScrollPane);
    splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,tabbedPane,bodyPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(200);
    Dimension minimumSize=new Dimension(100,50);
    folderTreeScrollPane.setMinimumSize(minimumSize);
    dataTreeScrollPane.setMinimumSize(minimumSize);
    tabbedPane.setMinimumSize(minimumSize);
    bodyPanel.setMinimumSize(minimumSize);
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setBounds(100,100,800,600);
  setVisible(true);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}

Fixed version (ground truth):
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    folderTreeArea=new JTree(folderTreeModel);
    folderTreeArea.setEditable(true);
    folderTreeArea.addTreeSelectionListener(this);
    JScrollPane folderTreeScrollPane=new JScrollPane(folderTreeArea);
    dataTreeArea=new JTree(dataTreeModel);
    dataTreeArea.setEditable(true);
    dataTreeArea.addTreeSelectionListener(this);
    JScrollPane dataTreeScrollPane=new JScrollPane(dataTreeArea);
    JTabbedPane tabbedPane=new JTabbedPane();
    tabbedPane.add("String_Node_Str",folderTreeScrollPane);
    tabbedPane.add("String_Node_Str",dataTreeScrollPane);
    splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,tabbedPane,bodyPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(200);
    Dimension minimumSize=new Dimension(100,50);
    folderTreeScrollPane.setMinimumSize(minimumSize);
    dataTreeScrollPane.setMinimumSize(minimumSize);
    tabbedPane.setMinimumSize(minimumSize);
    bodyPanel.setMinimumSize(minimumSize);
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setBounds(100,100,875,600);
  setVisible(true);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}
Program: 21670
Project: 21670
Buggy source:
public OTViewer(boolean showTree){
  super("String_Node_Str");
  initialize();
  this.showTree=showTree;
}

Fixed version (ground truth):
public OTViewer(boolean showTree){
  super("String_Node_Str");
  this.showTree=showTree;
}
Program: 21672
Project: 21672
Buggy source:
public static EthernetAddress getHWAddress(){
  if (noEthernetInterfaces) {
    return null;
  }
  if (hwAddress != null) {
    return hwAddress;
  }
  hwAddress=NativeInterfaces.getPrimaryInterface();
  if (hwAddress == null) {
    System.err.println("String_Node_Str");
    EthernetAddress[] addressArray=NativeInterfaces.getAllInterfaces();
    for (int i=0; i < addressArray.length; i++) {
      if (addressArray[i] != null) {
        hwAddress=addressArray[i];
      }
    }
    if (hwAddress == null) {
      System.err.println("String_Node_Str");
    }
  }
  if (hwAddress == null) {
    noEthernetInterfaces=true;
  }
  return hwAddress;
}

Fixed version (ground truth):
public static EthernetAddress getHWAddress(){
  if (noEthernetInterfaces) {
    return null;
  }
  if (hwAddress != null) {
    return hwAddress;
  }
  try {
    hwAddress=NativeInterfaces.getPrimaryInterface();
  }
 catch (  Throwable t) {
    System.err.println("String_Node_Str" + t.getMessage());
    noEthernetInterfaces=true;
    return null;
  }
  if (hwAddress == null) {
    System.err.println("String_Node_Str");
    EthernetAddress[] addressArray=NativeInterfaces.getAllInterfaces();
    for (int i=0; i < addressArray.length; i++) {
      if (addressArray[i] != null) {
        hwAddress=addressArray[i];
      }
    }
    if (hwAddress == null) {
      System.err.println("String_Node_Str");
    }
  }
  if (hwAddress == null) {
    noEthernetInterfaces=true;
  }
  return hwAddress;
}
Program: 21674
Project: 21674
Buggy source:
/** 
 * There is no information about the element.  So in this case the  element is treated literally.  The name of the element is used to figure out its type. 
 * @param child
 * @return
 */
public Object handleLiteralElement(Element child){
  String childName=child.getName();
  Properties elementProps;
  ResourceTypeHandler handler=getElementHandler(childName);
  if (handler == null) {
    throw new RuntimeException("String_Node_Str" + childName);
  }
  String childTypeName=handler.getPrimitiveName();
  if (childTypeName == null) {
    System.err.println("String_Node_Str" + childTypeName);
    return null;
  }
  return handler.handleElement(child,null);
}

Fixed version (ground truth):
/** 
 * There is no information about the element.  So in this case the  element is treated literally.  The name of the element is used to figure out its type. 
 * @param child
 * @return
 */
public Object handleLiteralElement(Element child){
  String childName=child.getName();
  Properties elementProps;
  ResourceTypeHandler handler=getElementHandler(childName);
  if (handler == null) {
    throw new RuntimeException("String_Node_Str" + elementPath(child));
  }
  String childTypeName=handler.getPrimitiveName();
  if (childTypeName == null) {
    System.err.println("String_Node_Str" + childTypeName);
    return null;
  }
  return handler.handleElement(child,null);
}