nus-yam/ex-repair huggingface dataset:
Program: 21579
Project: 21579
Buggy source:
@Override public void updateLine(int startX,int startY,int endX,int endY) throws CollPaintException {
  HttpSession httpSession=getThreadLocalRequest().getSession();
  CometSession cometSession=CometServlet.getCometSession(httpSession);
  final LineUpdate lineUpdate=new LineUpdate();
  lineUpdate.state=State.STARTED;
  lineUpdate.startX=12;
  lineUpdate.startY=20;
  lineUpdate.endX=12;
  lineUpdate.endY=30;
  cometSession.enqueue(lineUpdate);
}

Fixed version (ground truth):
@Override public void updateLine(float startX,float startY,float endX,float endY) throws CollPaintException {
  HttpSession httpSession=getThreadLocalRequest().getSession();
  CometSession cometSession=CometServlet.getCometSession(httpSession);
  final LineUpdate lineUpdate=new LineUpdate();
  lineUpdate.setState(State.STARTED);
  lineUpdate.setStartX(startX);
  lineUpdate.setStartY(startY);
  lineUpdate.setEndX(endX);
  lineUpdate.setEndY(endY);
  cometSession.enqueue(lineUpdate);
}
Program: 21581
Project: 21581
Buggy source:
private IResource determineResource(ITest testelement){
  IResource res=null;
  ITest item=testelement;
  String filepath="String_Node_Str";
  if (item.getTestElementType() == TestElementType.TESTCASE) {
    filepath=((TestCase)item).getFilePath();
  }
 else {
    filepath=((TestMethod)item).getParent().getFilePath();
  }
  IPath path=new Path(filepath);
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IFile ifile=root.getFileForLocation(path);
  if (ifile != null) {
    res=root.findMember(ifile.getFullPath());
    if (res == null) {
      MXUnitPluginLog.logWarning("String_Node_Str" + ifile.getFullPath());
    }
  }
 else {
    MXUnitPluginLog.logWarning("String_Node_Str" + filepath);
  }
  return res;
}

Fixed version (ground truth):
private IResource determineResource(ITest testelement){
  IResource res=null;
  ITest item=testelement;
  String filepath="String_Node_Str";
  if (item.getTestElementType() == TestElementType.TESTCASE) {
    filepath=((TestCase)item).getFilePath();
  }
 else {
    filepath=((TestMethod)item).getParent().getFilePath();
  }
  IPath path=new Path(filepath);
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IFile ifile=root.getFileForLocation(path);
  if (ifile != null) {
    res=root.findMember(ifile.getFullPath());
    if (res == null) {
      MXUnitPluginLog.logWarning("String_Node_Str" + ifile.getFullPath() + "String_Node_Str"+ testelement);
    }
  }
 else {
    MXUnitPluginLog.logWarning("String_Node_Str" + filepath);
  }
  return res;
}
Program: 21582
Project: 21582
Buggy source:
/** 
 * a dandy of a function that parses stuff and otherwise creates the DOT-notation CFC paths
 * @param resource the resource whose cfc notation will be derived
 * @return the cfc notation
 */
private String deriveCFCPath(IResource resource){
  String path="String_Node_Str";
  String propValue="String_Node_Str";
  IResource currentParent=resource;
  IPath p=resource.getFullPath().removeFileExtension();
  for (int i=p.segmentCount() - 1; i > 0; i--) {
    currentParent=currentParent.getParent();
    if (currentParent.getType() == IResource.ROOT) {
      break;
    }
    propValue=props.getComponentPropertyValue(currentParent).trim();
    if (propValue.length() > 0) {
      if (Arrays.binarySearch(emptyPathIndicators,propValue) >= 0) {
        path=p.removeFirstSegments(i).toString().replaceAll("String_Node_Str","String_Node_Str");
      }
 else {
        path=propValue + "String_Node_Str" + p.removeFirstSegments(i).toString().replaceAll("String_Node_Str","String_Node_Str");
      }
      MXUnitPluginLog.logInfo("String_Node_Str" + currentParent + "String_Node_Str"+ propValue+ "String_Node_Str"+ path);
      break;
    }
  }
  if (path.length() == 0) {
    p.removeFirstSegments(webrootAsPath.segmentCount());
    path=p.toString().replaceAll("String_Node_Str","String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str");
  }
  return path;
}

Fixed version (ground truth):
/** 
 * a dandy of a function that parses stuff and otherwise creates the DOT-notation CFC paths
 * @param resource the resource whose cfc notation will be derived
 * @return the cfc notation
 */
private String deriveCFCPath(IResource resource){
  String path="String_Node_Str";
  String propValue="String_Node_Str";
  IResource currentParent=resource;
  IPath p=resource.getLocation().removeFileExtension();
  p=p.setDevice(null);
  webrootAsPath=webrootAsPath.setDevice(null);
  for (int i=p.segmentCount() - 1; i > 0; i--) {
    currentParent=currentParent.getParent();
    if (currentParent.getType() == IResource.ROOT) {
      break;
    }
    propValue=props.getComponentPropertyValue(currentParent).trim();
    if (propValue.length() > 0) {
      if (Arrays.binarySearch(emptyPathIndicators,propValue) >= 0) {
        path=p.removeFirstSegments(i).toString().replaceAll("String_Node_Str","String_Node_Str");
      }
 else {
        path=propValue + "String_Node_Str" + p.removeFirstSegments(i).toString().replaceAll("String_Node_Str","String_Node_Str");
      }
      MXUnitPluginLog.logInfo("String_Node_Str" + currentParent + "String_Node_Str"+ propValue+ "String_Node_Str"+ path);
      break;
    }
  }
  if (path.length() == 0) {
    MXUnitPluginLog.logInfo("String_Node_Str" + webrootAsPath + "String_Node_Str"+ p);
    p=p.removeFirstSegments(webrootAsPath.segmentCount());
    path=p.toString().replaceAll("String_Node_Str","String_Node_Str");
  }
  return path;
}
Program: 21583
Project: 21583
Buggy source:
private String determineURL(IResource resource){
  String urlToUse=prefs.getString(MXUnitPreferenceConstants.P_FACADEURL);
  String projectFacadeURL="String_Node_Str";
  if (resource != null) {
    projectFacadeURL=props.getURLPropertyValue(resource.getProject());
  }
 else {
    MXUnitPluginLog.logInfo("String_Node_Str");
  }
  if (projectFacadeURL != null && projectFacadeURL.length() > 0) {
    urlToUse=projectFacadeURL;
  }
  urlToUse=urlToUse.trim().toLowerCase();
  if (!urlToUse.endsWith("String_Node_Str") && !urlToUse.endsWith("String_Node_Str")) {
    urlToUse+="String_Node_Str";
  }
  if (urlToUse.endsWith("String_Node_Str")) {
    urlToUse+="String_Node_Str";
  }
  MXUnitPluginLog.logInfo("String_Node_Str" + urlToUse);
  return urlToUse;
}

Fixed version (ground truth):
private String determineURL(IResource resource){
  String urlToUse=prefs.getString(MXUnitPreferenceConstants.P_FACADEURL);
  String projectFacadeURL="String_Node_Str";
  if (resource != null) {
    projectFacadeURL=props.getURLPropertyValue(resource.getProject());
  }
 else {
    MXUnitPluginLog.logInfo("String_Node_Str");
  }
  if (projectFacadeURL != null && projectFacadeURL.length() > 0) {
    urlToUse=projectFacadeURL;
  }
  urlToUse=urlToUse.trim();
  if (!urlToUse.toLowerCase().endsWith("String_Node_Str") && !urlToUse.toLowerCase().endsWith("String_Node_Str")) {
    urlToUse+="String_Node_Str";
  }
  if (urlToUse.toLowerCase().endsWith("String_Node_Str")) {
    urlToUse+="String_Node_Str";
  }
  MXUnitPluginLog.logInfo("String_Node_Str" + urlToUse);
  return urlToUse;
}
Program: 21584
Project: 21584
Buggy source:
/** 
 * convenience method for use in unit tests for testing unix-style paths
 * @param webroot the webroot. parent of the CFC in question
 * @param component full path to CFC under the webroot
 * @param pathSeparator String representing the file path separator (\, /)
 * @return String representing coldfusion cfc path for this component
 */
public static String deriveComponentPath(String webroot,String component,String pathSeparator){
  if (!webroot.endsWith(pathSeparator)) {
    webroot+=pathSeparator;
  }
  webroot=webroot.replace(pathSeparator,"String_Node_Str");
  component=component.replace(pathSeparator,"String_Node_Str");
  String path=component.substring(webroot.length());
  path=path.replaceFirst("String_Node_Str","String_Node_Str");
  return path;
}

Fixed version (ground truth):
/** 
 * convenience method for use in unit tests for testing unix-style paths
 * @param webroot the webroot. parent of the CFC in question
 * @param component full path to CFC under the webroot
 * @param pathSeparator String representing the file path separator (\, /)
 * @return String representing coldfusion cfc path for this component
 */
public static String deriveComponentPath(String webroot,String component,String pathSeparator){
  webroot=webroot.trim();
  if (!webroot.endsWith(pathSeparator)) {
    webroot+=pathSeparator;
  }
  webroot=webroot.replace(pathSeparator,"String_Node_Str");
  component=component.replace(pathSeparator,"String_Node_Str");
  String path=component.substring(webroot.length());
  path=path.replaceFirst("String_Node_Str","String_Node_Str");
  return path;
}
Program: 21587
Project: 21587
Buggy source:
/** 
 * This method should be used to read properties because in some places properties cannot be read.  So this will catch the exception when that happens, and it will not try to read the properties again.
 * @param property
 * @param defaultValue
 * @return
 */
public static boolean getBooleanProp(String property,boolean defaultValue){
  if (OTConfig.cannotReadProperties) {
    return defaultValue;
  }
  try {
    return Boolean.getBoolean(property);
  }
 catch (  AccessControlException e) {
    OTConfig.handlePropertyReadException(e);
    return defaultValue;
  }
}

Fixed version (ground truth):
/** 
 * This method should be used to read properties because in some places properties cannot be read.  So this will catch the exception when that happens, and it will not try to read the properties again.
 * @param property
 * @param defaultValue
 * @return
 */
public static boolean getBooleanProp(String property,boolean defaultValue){
  if (OTConfig.cannotReadProperties) {
    return defaultValue;
  }
  try {
    String value=System.getProperty(property,null);
    if (value == null) {
      return defaultValue;
    }
 else {
      return Boolean.parseBoolean(value);
    }
  }
 catch (  AccessControlException e) {
    OTConfig.handlePropertyReadException(e);
    return defaultValue;
  }
}
Program: 21588
Project: 21588
Buggy source:
public void init(String[] args){
  viewerHelper=new OTViewerHelper();
  try {
    viewerHelper.init(args);
    initFields();
    OTMLToXHTMLConverter conv=new OTMLToXHTMLConverter(viewFactory,rootObject,rootViewEntry,OTConfig.getSystemPropertyViewMode());
    String outputFolderStr=System.getProperty("String_Node_Str");
    if (outputFolderStr == null) {
      outputFolderStr=System.getProperty("String_Node_Str");
    }
    File outputFolder=new File(outputFolderStr);
    outputFolder.mkdirs();
    File fileToSave=new File(outputFolder,"String_Node_Str");
    conv.setXHTMLParams(fileToSave,800,600);
    (new Thread(conv)).start();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public void init(String[] args){
  viewerHelper=new OTViewerHelper();
  try {
    viewerHelper.init(args);
    initFields();
    OTMLToXHTMLConverter conv=new OTMLToXHTMLConverter(viewFactory,rootObject,rootViewEntry,OTConfig.getSystemPropertyViewMode());
    String outputFolderStr=System.getProperty("String_Node_Str");
    if (outputFolderStr == null) {
      outputFolderStr=System.getProperty("String_Node_Str");
    }
    File outputFolder=new File(outputFolderStr);
    outputFolder.mkdirs();
    String fileName=System.getProperty("String_Node_Str","String_Node_Str");
    File fileToSave=new File(outputFolder,fileName);
    conv.setXHTMLParams(fileToSave,800,600);
    (new Thread(conv)).start();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 21589
Project: 21589
Buggy source:
@Override public OutputStream getBody() throws IOException {
  return fos;
}

Fixed version (ground truth):
@Override public OutputStream getBody() throws IOException {
  ByteArrayOutputStream output=new ByteArrayOutputStream(){
    private ArrayList<Byte> firstEight=new ArrayList<Byte>(8);
    private ArrayList<Byte> secondEight=new ArrayList<Byte>(8);
    private ArrayList<Byte> overflow=new ArrayList<Byte>();
    private boolean doneWithFirstBytes=false;
    @Override public void write(    byte[] bytes){
      try {
        int size=bytes.length;
        if (!doneWithFirstBytes) {
          for (int i=0; i < size; i++) {
            if (firstEight.size() < 8) {
              firstEight.add(bytes[i]);
            }
 else             if (secondEight.size() < 8) {
              secondEight.add(bytes[i]);
            }
 else {
              overflow.add(bytes[i]);
            }
          }
          if (overflow.size() > 0) {
            doneWithFirstBytes=true;
            fos.write(getFirstBytes());
            fos.write(convertToByteArray(overflow));
          }
        }
 else {
          fos.write(bytes);
        }
      }
 catch (      IOException e) {
        logger.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
    @Override public void write(    byte[] bytes,    int off,    int len){
      byte[] outbytes=new byte[len];
      System.arraycopy(bytes,off,outbytes,0,len);
      write(outbytes);
    }
    @Override public void write(    int bit){
      super.write(bit);
    }
    private byte[] getFirstBytes(){
      if (!firstEight.equals(secondEight)) {
        logger.info("String_Node_Str");
        firstEight.addAll(secondEight);
      }
 else {
        logger.info("String_Node_Str");
      }
      return convertToByteArray(firstEight);
    }
    private byte[] convertToByteArray(    ArrayList<Byte> list){
      byte[] outBytes=new byte[list.size()];
      for (int i=0; i < list.size(); i++) {
        outBytes[i]=list.get(i);
      }
      return outBytes;
    }
  }
;
  return output;
}
Program: 21590
Project: 21590
Buggy source:
protected boolean shouldWriteReference(OTDataObject dataObj,OTDataObject parent,String parentResourceName){
  OTID id=dataObj.getGlobalId();
  if (writtenIds.contains(id)) {
    return true;
  }
  if (!(dataObj instanceof XMLDataObject)) {
    return false;
  }
  XMLDataObject xmlDO=(XMLDataObject)dataObj;
  XMLDataObject container=xmlDO.getContainer();
  if (container == null || !processedIds.contains(container.getGlobalId())) {
    return false;
  }
  String containerResourceName=xmlDO.getContainerResourceKey();
  if (parent == container && parentResourceName.equals(containerResourceName)) {
    return false;
  }
  Object containedValue=container.getResourceWithSuffix(containerResourceName);
  if (containedValue.equals(id)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
protected boolean shouldWriteReference(OTDataObject dataObj,OTDataObject parent,String parentResourceName){
  OTID id=dataObj.getGlobalId();
  if (writtenIds.contains(id)) {
    return true;
  }
  if (!(dataObj instanceof XMLDataObject)) {
    return false;
  }
  XMLDataObject xmlDO=(XMLDataObject)dataObj;
  XMLDataObject container=xmlDO.getContainer();
  if (container == null || !processedIds.contains(container.getGlobalId())) {
    return false;
  }
  String containerResourceName=xmlDO.getContainerResourceKey();
  if (parent == container && parentResourceName.equals(containerResourceName)) {
    return false;
  }
  Object containedValue=container.getResourceWithSuffix(containerResourceName);
  if (id.equals(containedValue)) {
    return true;
  }
  return false;
}
Program: 21591
Project: 21591
Buggy source:
Object getResourceWithSuffix(String key){
  int suffixStartIndex=key.indexOf('[');
  if (suffixStartIndex == -1) {
    return getResource(key);
  }
  int suffixEndIndex=key.indexOf(']');
  if (suffixEndIndex == -1) {
    throw new IllegalStateException("String_Node_Str" + key);
  }
  String property=key.substring(0,suffixStartIndex);
  Object resource=getResource(property);
  if (resource instanceof XMLDataList) {
    XMLDataList list=(XMLDataList)resource;
    String indexStr=key.substring(suffixStartIndex + 1,suffixEndIndex);
    return list.get(Integer.parseInt(indexStr));
  }
 else   if (resource instanceof XMLDataMap) {
    XMLDataMap map=(XMLDataMap)resource;
    String mapKey=key.substring(suffixStartIndex + 2,suffixEndIndex - 1);
    return map.get(mapKey);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + key);
  }
}

Fixed version (ground truth):
Object getResourceWithSuffix(String key){
  int suffixStartIndex=key.indexOf('[');
  if (suffixStartIndex == -1) {
    return getResource(key);
  }
  int suffixEndIndex=key.indexOf(']');
  if (suffixEndIndex == -1) {
    throw new IllegalStateException("String_Node_Str" + key);
  }
  String property=key.substring(0,suffixStartIndex);
  Object resource=getResource(property);
  if (resource instanceof XMLDataList) {
    XMLDataList list=(XMLDataList)resource;
    String indexStr=key.substring(suffixStartIndex + 1,suffixEndIndex);
    int index=Integer.parseInt(indexStr);
    if (index < 0 || index >= list.size()) {
      return null;
    }
    return list.get(index);
  }
 else   if (resource instanceof XMLDataMap) {
    XMLDataMap map=(XMLDataMap)resource;
    String mapKey=key.substring(suffixStartIndex + 2,suffixEndIndex - 1);
    return map.get(mapKey);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + key);
  }
}
Program: 21593
Project: 21593
Buggy source:
public void initArgs(String[] args){
  URL authorOTMLURL=OTViewerHelper.getURLFromArgs(args);
  if (authorOTMLURL == null && System.getProperty(OTML_URL_PROP,null) != null) {
    try {
      authorOTMLURL=new URL(System.getProperty(OTML_URL_PROP,null));
    }
 catch (    MalformedURLException e) {
      e.printStackTrace();
    }
  }
  if (authorOTMLURL == null) {
    authorOTMLURL=OTViewer.class.getResource("String_Node_Str");
  }
  if ("String_Node_Str".equalsIgnoreCase(authorOTMLURL.getProtocol())) {
    currentAuthoredFile=new File(authorOTMLURL.getPath());
  }
  initWithWizard(authorOTMLURL);
}

Fixed version (ground truth):
public void initArgs(String[] args){
  URL authorOTMLURL=OTViewerHelper.getURLFromArgs(args);
  if (authorOTMLURL == null && System.getProperty(OTML_URL_PROP,null) != null) {
    try {
      authorOTMLURL=new URL(System.getProperty(OTML_URL_PROP,null));
    }
 catch (    MalformedURLException e) {
      e.printStackTrace();
    }
  }
  if (authorOTMLURL == null) {
    authorOTMLURL=OTViewer.class.getResource("String_Node_Str");
  }
  initWithWizard(authorOTMLURL);
}
Program: 21595
Project: 21595
Buggy source:
private void logPreserveUUIDError(String string){
  logger.warning(string);
  Throwable throwable=new IllegalArgumentException(string);
  StackTraceElement stackTraceElement=throwable.getStackTrace()[2];
  String callerStr=stackTraceElement.getClassName() + "String_Node_Str" + stackTraceElement.getMethodName();
  Object value=preserveUUIDCallers.get(callerStr);
  if (value != null) {
    return;
  }
  preserveUUIDCallers.put(callerStr,callerStr);
  logger.log(Level.FINE,"String_Node_Str",string);
}

Fixed version (ground truth):
private void logPreserveUUIDError(String string){
  logger.warning(string);
  Throwable throwable=new IllegalArgumentException(string);
  StackTraceElement stackTraceElement=throwable.getStackTrace()[2];
  String callerStr=stackTraceElement.getClassName() + "String_Node_Str" + stackTraceElement.getMethodName();
  Object value=preserveUUIDCallers.get(callerStr);
  if (value != null) {
    return;
  }
  preserveUUIDCallers.put(callerStr,callerStr);
  logger.log(Level.FINE,"String_Node_Str",throwable);
}
Program: 21596
Project: 21596
Buggy source:
public OTObject getRuntimeObject(OTObject object,String userStr){
  try {
    OTObjectService objectService=object.getOTObjectService();
    OTrunk otrunk=(OTrunk)objectService.getOTrunkService(OTrunk.class);
    OTID userId=objectService.getOTID(userStr);
    OTUser user=(OTUser)objectService.getOTObject(userId);
    return otrunk.getUserRuntimeObject(object,user);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
public OTObject getRuntimeObject(OTObject object,String userStr){
  try {
    OTObjectService objectService=object.getOTObjectService();
    OTrunk otrunk=objectService.getOTrunkService(OTrunk.class);
    OTID userId=objectService.getOTID(userStr);
    OTUser user=(OTUser)objectService.getOTObject(userId);
    return otrunk.getUserRuntimeObject(object,user);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 21597
Project: 21597
Buggy source:
public String embedOTObject(OTObject obj,OTViewEntry viewEntry){
  OTView view=viewFactory.getView(obj,OTPrintDimension.class);
  if (view == null) {
    view=(OTView)viewFactory.getView(obj,OTJComponentView.class);
  }
  if (view instanceof OTXHTMLView) {
    String objectText=((OTXHTMLView)view).getXHTMLText(obj);
    return objectText;
  }
  view=getOTJComponentView(obj,null,viewEntry);
  JComponent comp=((OTJComponentView)view).getComponent(obj);
  Dimension printDim=null;
  if (view instanceof OTPrintDimension) {
    OTPrintDimension dimView=(OTPrintDimension)view;
    printDim=dimView.getPrintDimension(obj,containerDisplayWidth,containerDisplayHeight);
  }
  if (printDim != null) {
    comp.setSize(printDim);
  }
 else {
    Dimension dim2=comp.getPreferredSize();
    if (dim2.width == 0)     dim2.width=1;
    if (dim2.height == 0)     dim2.height=1;
    comp.setSize(dim2);
  }
  String url=embedComponent(comp,1,1,obj);
  url="String_Node_Str" + url + "String_Node_Str";
  return url;
}

Fixed version (ground truth):
public String embedOTObject(OTObject obj,OTViewEntry viewEntry){
  OTView view=viewFactory.getView(obj,OTPrintDimension.class);
  if (view == null) {
    view=viewFactory.getView(obj,OTJComponentView.class);
  }
  if (view instanceof OTXHTMLView) {
    String objectText=((OTXHTMLView)view).getXHTMLText(obj);
    return objectText;
  }
  view=getOTJComponentView(obj,null,viewEntry);
  if (view instanceof OTXHTMLView) {
    String objectText=((OTXHTMLView)view).getXHTMLText(obj);
    return objectText;
  }
  JComponent comp=((OTJComponentView)view).getComponent(obj);
  Dimension printDim=null;
  if (view instanceof OTPrintDimension) {
    OTPrintDimension dimView=(OTPrintDimension)view;
    printDim=dimView.getPrintDimension(obj,containerDisplayWidth,containerDisplayHeight);
  }
  if (printDim != null) {
    comp.setSize(printDim);
  }
 else {
    Dimension dim2=comp.getPreferredSize();
    if (dim2.width == 0)     dim2.width=1;
    if (dim2.height == 0)     dim2.height=1;
    comp.setSize(dim2);
  }
  String url=embedComponent(comp,1,1,obj);
  url="String_Node_Str" + url + "String_Node_Str";
  return url;
}
Program: 21598
Project: 21598
Buggy source:
protected OTJComponentView getOTJComponentView(OTObject obj,String mode,OTViewEntry viewEntry){
  if (jComponentService == null) {
    OTViewContext viewContext=viewFactory.getViewContext();
    OTJComponentServiceFactory serviceFactory=(OTJComponentServiceFactory)viewContext.getViewService(OTJComponentServiceFactory.class);
    jComponentService=serviceFactory.createOTJComponentService(viewFactory,false);
  }
  if (viewEntry != null) {
    return jComponentService.getObjectView(obj,viewContainer,mode,viewEntry);
  }
 else {
    return jComponentService.getObjectView(obj,viewContainer,mode);
  }
}

Fixed version (ground truth):
protected OTJComponentView getOTJComponentView(OTObject obj,String mode,OTViewEntry viewEntry){
  if (jComponentService == null) {
    OTViewContext viewContext=viewFactory.getViewContext();
    OTJComponentServiceFactory serviceFactory=viewContext.getViewService(OTJComponentServiceFactory.class);
    jComponentService=serviceFactory.createOTJComponentService(viewFactory,false);
  }
  if (viewEntry != null) {
    return jComponentService.getObjectView(obj,viewContainer,mode,viewEntry);
  }
 else {
    return jComponentService.getObjectView(obj,viewContainer,mode);
  }
}
Program: 21599
Project: 21599
Buggy source:
/** 
 * Adds all the viewEntries from the bundle  Overrides the default view mode. Adds the bundle to the beginning of the list of bundles which is used to find view mode view entries.
 * @param viewBundle
 */
public void addViewBundle(OTViewBundle viewBundle){
  Vector viewEntries=viewBundle.getViewEntries().getVector();
  Iterator it=viewEntries.iterator();
  Vector tempViewMap=new Vector();
  while (it.hasNext()) {
    tempViewMap.add(createInternalViewEntry((OTViewEntry)it.next()));
  }
  viewMap.addAll(0,tempViewMap);
  if (viewBundle.getCurrentMode() != null) {
    setDefaultViewMode(viewBundle.getCurrentMode());
  }
  viewBundles.add(0,viewBundle);
}

Fixed version (ground truth):
/** 
 * Adds all the viewEntries from the bundle  Overrides the default view mode. Adds the bundle to the beginning of the list of bundles which is used to find view mode view entries.
 * @param viewBundle
 */
public void addViewBundle(OTViewBundle viewBundle){
  Vector viewEntries=viewBundle.getViewEntries().getVector();
  Iterator it=viewEntries.iterator();
  Vector tempViewMap=new Vector();
  while (it.hasNext()) {
    InternalViewEntry internalViewEntry=createInternalViewEntry((OTViewEntry)it.next());
    if (internalViewEntry == null) {
      continue;
    }
    tempViewMap.add(internalViewEntry);
  }
  viewMap.addAll(0,tempViewMap);
  if (viewBundle.getCurrentMode() != null) {
    setDefaultViewMode(viewBundle.getCurrentMode());
  }
  viewBundles.add(0,viewBundle);
}
Program: 21600
Project: 21600
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 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=documentConfig.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();
  if (bodyText == null)   bodyText="String_Node_Str";
  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=documentConfig.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: 21601
Project: 21601
Buggy source:
public URL getCodebase(OTObject otObject){
  OTID id=otObject.getGlobalId();
  try {
    OTDataObject dataObject=getOTDataObject(id);
    return dataObject.getCodebase();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public URL getCodebase(OTObject otObject){
  OTID id=otObject.getGlobalId();
  try {
    OTDataObject dataObject=OTInvocationHandler.getOTDataObject(otObject);
    return dataObject.getCodebase();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 21602
Project: 21602
Buggy source:
/** 
 * @param dataParent
 * @param childID
 * @return
 * @throws Exception
 */
private OTDataObject getOTDataObject(OTID childID) throws Exception {
  if (childID == null) {
    throw new Exception("String_Node_Str");
  }
  OTDataObject childDataObject=mainDb.getOTDataObject(null,childID);
  return childDataObject;
}

Fixed version (ground truth):
/** 
 * @param dataParent
 * @param childID
 * @return
 * @throws Exception
 */
OTDataObject getOTDataObject(OTID childID) throws Exception {
  if (childID == null) {
    throw new Exception("String_Node_Str");
  }
  OTDataObject childDataObject=mainDb.getOTDataObject(null,childID);
  return childDataObject;
}
Program: 21603
Project: 21603
Buggy source:
public OTObject copyObject(OTObject original,OTObjectList orphanObjectList,int maxDepth) throws Exception {
  OTObjectServiceImpl originalObjectService=(OTObjectServiceImpl)original.getOTObjectService();
  OTDataObject originalDataObject=originalObjectService.getOTDataObject(original.getGlobalId());
  OTDataList orphanDataList=((OTObjectListImpl)orphanObjectList).getDataList();
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,orphanDataList,maxDepth,this,otrunk.getDataObjectFinder());
  return getOTObject(copyDataObject.getGlobalId());
}

Fixed version (ground truth):
public OTObject copyObject(OTObject original,OTObjectList orphanObjectList,int maxDepth) throws Exception {
  OTDataObject originalDataObject=OTInvocationHandler.getOTDataObject(original);
  OTDataList orphanDataList=((OTObjectListImpl)orphanObjectList).getDataList();
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,orphanDataList,maxDepth,this,otrunk.getDataObjectFinder());
  return getOTObject(copyDataObject.getGlobalId());
}
Program: 21604
Project: 21604
Buggy source:
public boolean hasUserModified(OTObject authoredObject,OTUser user) throws Exception {
  OTID authoredId=authoredObject.getGlobalId();
  OTID userId=user.getUserId();
  CompositeDatabase db=(CompositeDatabase)compositeDatabases.get(userId);
  if (db == null) {
    return false;
  }
  OTDataObject userDataObject=db.getOTDataObject(null,authoredId);
  if (userDataObject instanceof CompositeDataObject) {
    OTDataObject userModifications=((CompositeDataObject)userDataObject).getActiveDeltaObject();
    return userModifications != null;
  }
  return false;
}

Fixed version (ground truth):
public boolean hasUserModified(OTObject authoredObject,OTUser user) throws Exception {
  OTObject userObject=getUserRuntimeObject(authoredObject,user);
  return isModifiedInTopOverlay(userObject);
}
Program: 21605
Project: 21605
Buggy source:
public Object getResource(String key);

Fixed version (ground truth):
/** 
 * Return the value of the resource.  If the resource is not set it returns null.  Resources can also be set to null, so  the containsKey method should be used to test if this object actually has the key or not.
 * @param key
 * @return
 */
public Object getResource(String key);
Program: 21606
Project: 21606
Buggy source:
public Object getResource(String key){
  if (!composite) {
    return baseObject.getResource(key);
  }
  Object value=null;
  OTDataObject localActiveDelta=getActiveDeltaObject();
  if (localActiveDelta != null) {
    value=localActiveDelta.getResource(key);
    if (value != null) {
      return value;
    }
  }
  return getNonActiveDeltaResource(key);
}

Fixed version (ground truth):
public Object getResource(String key){
  if (!composite) {
    return baseObject.getResource(key);
  }
  Object value=null;
  OTDataObject localActiveDelta=getActiveDeltaObject();
  if (localActiveDelta != null) {
    value=localActiveDelta.getResource(key);
    if (value != null) {
      return value;
    }
 else     if (localActiveDelta.containsKey(key)) {
      return null;
    }
  }
  return getNonActiveDeltaResource(key);
}
Program: 21607
Project: 21607
Buggy source:
protected Object getNonActiveDeltaResource(String key){
  Object value=null;
  if (middleDeltas != null) {
    for (int i=0; i < middleDeltas.length; i++) {
      OTDataObject delta=middleDeltas[i];
      if (delta != null) {
        value=delta.getResource(key);
        if (value != null) {
          return value;
        }
      }
    }
  }
  return baseObject.getResource(key);
}

Fixed version (ground truth):
protected Object getNonActiveDeltaResource(String key){
  Object value=null;
  if (middleDeltas != null) {
    for (int i=0; i < middleDeltas.length; i++) {
      OTDataObject delta=middleDeltas[i];
      if (delta != null) {
        value=delta.getResource(key);
        if (value != null) {
          return value;
        }
 else         if (delta.containsKey(key)) {
          return null;
        }
      }
    }
  }
  return baseObject.getResource(key);
}
Program: 21608
Project: 21608
Buggy source:
public OTDataObject getActiveDeltaObject(OTDataObject baseObject){
  return activeOverlay.getDeltaObject(baseObject);
}

Fixed version (ground truth):
public OTDataObject getActiveDeltaObject(OTDataObject baseObject){
  OTDataObject deltaObject=activeOverlay.getDeltaObject(baseObject);
  if (deltaObject instanceof XMLDataObject) {
    ((XMLDataObject)deltaObject).setSaveNulls(true);
  }
  return deltaObject;
}
Program: 21609
Project: 21609
Buggy source:
public OTDataObject createActiveDeltaObject(OTDataObject baseObject){
  return activeOverlay.createDeltaObject(baseObject);
}

Fixed version (ground truth):
public OTDataObject createActiveDeltaObject(OTDataObject baseObject){
  OTDataObject deltaObject=activeOverlay.createDeltaObject(baseObject);
  if (deltaObject instanceof XMLDataObject) {
    ((XMLDataObject)deltaObject).setSaveNulls(true);
  }
  return deltaObject;
}
Program: 21610
Project: 21610
Buggy source:
protected Component createComponent(){
  AttributeSet attr=getElement().getAttributes();
  String refId=(String)attr.getAttribute("String_Node_Str");
  String editStr=(String)attr.getAttribute("String_Node_Str");
  String viewId=(String)attr.getAttribute("String_Node_Str");
  String userId=(String)attr.getAttribute("String_Node_Str");
  String modeStr=(String)attr.getAttribute("String_Node_Str");
  if (editStr != null && editStr.equalsIgnoreCase("String_Node_Str")) {
    System.err.println("String_Node_Str");
  }
  if (refId != null && refId.length() > 0) {
    OTObject childObject=docView.getReferencedObject(refId);
    if (userId != null) {
      childObject=docView.getRuntimeObject(childObject,userId);
    }
    if (childObject == null) {
      return new JLabel("String_Node_Str" + refId);
    }
    OTViewEntry viewEntry=null;
    if (viewId != null && viewId.length() > 0) {
      viewEntry=(OTViewEntry)docView.getReferencedObject(viewId);
    }
    if (modeStr != null) {
      if (modeStr.length() == 0) {
        modeStr=null;
      }
      viewContainerPanel.setViewMode(modeStr);
    }
    viewContainerPanel.setCurrentObject(childObject,viewEntry);
    return viewContainerPanel;
  }
  return null;
}

Fixed version (ground truth):
protected Component createComponent(){
  AttributeSet attr=getElement().getAttributes();
  String refId=(String)attr.getAttribute("String_Node_Str");
  String editStr=(String)attr.getAttribute("String_Node_Str");
  String viewId=(String)attr.getAttribute("String_Node_Str");
  String userId=(String)attr.getAttribute("String_Node_Str");
  String modeStr=(String)attr.getAttribute("String_Node_Str");
  if (editStr != null && editStr.equalsIgnoreCase("String_Node_Str")) {
    System.err.println("String_Node_Str");
  }
  if (refId != null && refId.length() > 0) {
    OTObject childObject=docView.getReferencedObject(refId);
    if (userId != null) {
      childObject=docView.getRuntimeObject(childObject,userId);
    }
    if (childObject == null) {
      return new JLabel("String_Node_Str" + refId);
    }
    OTViewEntry viewEntry=null;
    if (viewId != null && viewId.length() > 0) {
      try {
        viewEntry=(OTViewEntry)docView.getReferencedObject(viewId);
      }
 catch (      ClassCastException e) {
        System.err.println("String_Node_Str" + viewId + "String_Node_Str");
        throw e;
      }
    }
    if (modeStr != null) {
      if (modeStr.length() == 0) {
        modeStr=null;
      }
      viewContainerPanel.setViewMode(modeStr);
    }
    viewContainerPanel.setCurrentObject(childObject,viewEntry);
    return viewContainerPanel;
  }
  return null;
}
Program: 21613
Project: 21613
Buggy source:
public JComponent getComponent(OTObject otObject,OTJComponentView view){
  JComponent component=view.getComponent(otObject);
  return component;
}

Fixed version (ground truth):
public JComponent getComponent(OTObject otObject,OTJComponentView view){
  JComponent component=view.getComponent(otObject);
  objToComponent.put(otObject,component);
  return component;
}
Program: 21614
Project: 21614
Buggy source:
protected OTObjectInternal createOTObjectInternal(Class objectClass) throws Exception {
  String className=objectClass.getName();
  OTDataObjectType type=new OTDataObjectType(objectClass.getName());
  OTDataObject dataObject=createDataObject(type);
  OTClass otClass=OTrunkImpl.getOTClass(className);
  if (otClass == null) {
    otClass=ReflectiveOTClassFactory.singleton.registerClass(objectClass);
    if (otClass == null) {
      throw new IllegalStateException("String_Node_Str" + className);
    }
    ReflectiveOTClassFactory.singleton.processAllNewlyRegisteredClasses();
  }
  OTObjectInternal otObjectImpl=new OTObjectInternal(dataObject,this,otClass);
  return otObjectImpl;
}

Fixed version (ground truth):
protected OTObjectInternal createOTObjectInternal(Class objectClass) throws Exception {
  String className=objectClass.getName();
  OTClass otClass=OTrunkImpl.getOTClass(className);
  if (otClass == null) {
    otClass=ReflectiveOTClassFactory.singleton.registerClass(objectClass);
    if (otClass == null) {
      throw new IllegalStateException("String_Node_Str" + className);
    }
    ReflectiveOTClassFactory.singleton.processAllNewlyRegisteredClasses();
  }
  OTDataObjectType type=new OTDataObjectType(objectClass.getName());
  OTDataObject dataObject=createDataObject(type);
  OTObjectInternal otObjectImpl=new OTObjectInternal(dataObject,this,otClass);
  return otObjectImpl;
}
Program: 21615
Project: 21615
Buggy source:
public OTObject copyObject(OTObject original,OTObjectList orphanObjectList,int maxDepth) throws Exception {
  OTObjectServiceImpl originalObjectService=(OTObjectServiceImpl)original.getOTObjectService();
  OTDataObject originalDataObject=originalObjectService.getOTDataObject(original.getGlobalId());
  OTDataList orphanDataList=((OTObjectListImpl)orphanObjectList).getDataList();
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,orphanDataList,maxDepth,this);
  return getOTObject(copyDataObject.getGlobalId());
}

Fixed version (ground truth):
public OTObject copyObject(OTObject original,OTObjectList orphanObjectList,int maxDepth) throws Exception {
  OTObjectServiceImpl originalObjectService=(OTObjectServiceImpl)original.getOTObjectService();
  OTDataObject originalDataObject=originalObjectService.getOTDataObject(original.getGlobalId());
  OTDataList orphanDataList=((OTObjectListImpl)orphanObjectList).getDataList();
  OTDataObject copyDataObject=DataObjectUtil.copy(originalDataObject,creationDb,orphanDataList,maxDepth,this,otrunk.getDataObjectFinder());
  return getOTObject(copyDataObject.getGlobalId());
}
Program: 21616
Project: 21616
Buggy source:
public OTDataObject findDataObject(OTID id) throws Exception {
  OTDatabase db=getOTDatabase(id);
  return db.getOTDataObject(null,id);
}

Fixed version (ground truth):
public OTDataObject findDataObject(OTID id) throws Exception {
  OTDatabase db=getOTDatabase(id);
  if (db == null) {
    return null;
  }
  return db.getOTDataObject(null,id);
}
Program: 21617
Project: 21617
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 OTUserObject registerUserDataDatabase(OTDatabase userDataDb,String name) throws Exception {
  addDatabase(userDataDb);
  OTReferenceMap refMap=getReferenceMapFromUserDb(userDataDb);
  OTUser user=refMap.getUser();
  OTUserObject aUser=(OTUserObject)user;
  if (name != null) {
    aUser.setName(name);
  }
  users.add(aUser);
  setupUserDatabase(user,refMap);
  return aUser;
}

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 OTUserObject registerUserDataDatabase(OTDatabase userDataDb,String name) throws Exception {
  addDatabase(userDataDb);
  OTReferenceMap refMap=getReferenceMapFromUserDb(userDataDb);
  OTUser user=refMap.getUser();
  OTUserObject aUser=(OTUserObject)user;
  if (name != null) {
    aUser.setName(name);
  }
  return registerReferenceMap(refMap);
}
Program: 21618
Project: 21618
Buggy source:
protected OTObjectService setupUserDatabase(OTUser user,OTReferenceMap userStateMap){
  OTObjectServiceImpl userObjService;
  OTID userId=user.getUserId();
  OTDataObjectFinder objectFinder=new OTDataObjectFinder(){
    public OTDataObject findDataObject(    OTID id) throws Exception {
      OTDatabase db=getOTDatabase(id);
      return db.getOTDataObject(null,id);
    }
  }
;
  CompositeDatabase userDb=new CompositeDatabase(objectFinder,userStateMap);
  addDatabase(userDb);
  userObjService=createObjectService(userDb);
  compositeDatabases.put(userId,userDb);
  userObjectServices.put(userId,userObjService);
  try {
    ArrayList overlays=null;
    OTObjectList otOverlays=getSystemOverlays(user);
    if (otOverlays != null && otOverlays.size() > 0) {
      overlays=new ArrayList();
      for (int i=0; i < otOverlays.size(); i++) {
        OTOverlay otOverlay=(OTOverlay)otOverlays.get(i);
        Overlay overlay=new OverlayImpl(otOverlay);
        if (overlay != null)         overlays.add(overlay);
      }
    }
    userDb.setOverlays(overlays);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return userObjService;
}

Fixed version (ground truth):
protected OTObjectService setupUserDatabase(OTUser user,OTReferenceMap userStateMap){
  OTObjectServiceImpl userObjService;
  OTID userId=user.getUserId();
  CompositeDatabase userDb=new CompositeDatabase(dataObjectFinder,userStateMap);
  addDatabase(userDb);
  userObjService=createObjectService(userDb);
  compositeDatabases.put(userId,userDb);
  userObjectServices.put(userId,userObjService);
  try {
    ArrayList overlays=null;
    OTObjectList otOverlays=getSystemOverlays(user);
    if (otOverlays != null && otOverlays.size() > 0) {
      overlays=new ArrayList();
      for (int i=0; i < otOverlays.size(); i++) {
        OTOverlay otOverlay=(OTOverlay)otOverlays.get(i);
        Overlay overlay=new OverlayImpl(otOverlay);
        if (overlay != null)         overlays.add(overlay);
      }
    }
    userDb.setOverlays(overlays);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return userObjService;
}
Program: 21619
Project: 21619
Buggy source:
protected OTObjectServiceImpl initObjectService(OTDatabase db,String logLabel) throws Exception {
  addDatabase(db);
  OTObjectServiceImpl objectService=createObjectService(db);
  if (OTConfig.isTrace()) {
    objectService.addObjectServiceListener(new TraceListener(logLabel + "String_Node_Str" + db));
  }
  loadIncludes(objectService);
  return objectService;
}

Fixed version (ground truth):
public OTObjectServiceImpl initObjectService(OTDatabase db,String logLabel,boolean loadIncludes) throws Exception {
  addDatabase(db);
  OTObjectServiceImpl objectService=createObjectService(db);
  if (OTConfig.isTrace()) {
    objectService.addObjectServiceListener(new TraceListener(logLabel + "String_Node_Str" + db));
  }
  if (loadIncludes) {
    loadIncludes(objectService);
  }
  return objectService;
}
Program: 21620
Project: 21620
Buggy source:
protected void addDatabase(OTDatabase db){
  if (!databases.contains(db)) {
    databases.add(db);
    Vector packageClasses=db.getPackageClasses();
    if (packageClasses != null) {
      for (int i=0; i < packageClasses.size(); i++) {
        registerPackageClass((Class)packageClasses.get(i));
      }
    }
  }
}

Fixed version (ground truth):
public void addDatabase(OTDatabase db){
  if (!databases.contains(db)) {
    databases.add(db);
    Vector packageClasses=db.getPackageClasses();
    if (packageClasses != null) {
      for (int i=0; i < packageClasses.size(); i++) {
        registerPackageClass((Class)packageClasses.get(i));
      }
    }
  }
}
Program: 21621
Project: 21621
Buggy source:
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=sourceDb.getOTDataObject(root,(OTID)child);
      if (itemObj == null) {
        throw new IllegalStateException("String_Node_Str" + child);
      }
      OTDataObject itemCopy=destinationDb.createDataObject(itemObj.getType());
      int copyMaxDepth=-1;
      if (maxDepth != -1) {
        copyMaxDepth=maxDepth - 1;
      }
      itemCopyEntry=new CopyEntry(itemObj,copyMaxDepth,itemCopy);
      toBeCopied.add(itemCopyEntry);
    }
 else {
      return child;
    }
    child=itemCopyEntry.copy.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=sourceDb.getOTDataObject(root,(OTID)child);
      if (itemObj == null) {
        itemObj=dataObjectFinder.findDataObject((OTID)child);
        if (itemObj == null) {
          throw new IllegalStateException("String_Node_Str" + child);
        }
      }
      OTDataObject itemCopy=destinationDb.createDataObject(itemObj.getType());
      int copyMaxDepth=-1;
      if (maxDepth != -1) {
        copyMaxDepth=maxDepth - 1;
      }
      itemCopyEntry=new CopyEntry(itemObj,copyMaxDepth,itemCopy);
      toBeCopied.add(itemCopyEntry);
    }
 else {
    }
    child=itemCopyEntry.copy.getGlobalId();
  }
  return child;
}
Program: 21622
Project: 21622
Buggy source:
public Copier(OTDatabase sourceDb,OTDatabase destinationDb,OTDataList orphanDataList,OTExternalIDProvider idProvider){
  this.destinationDb=destinationDb;
  this.sourceDb=sourceDb;
  this.toBeCopied=new Vector();
  this.orphanList=orphanDataList;
  this.idProvider=idProvider;
}

Fixed version (ground truth):
public Copier(OTDatabase sourceDb,OTDatabase destinationDb,OTDataList orphanDataList,OTExternalIDProvider idProvider,OTDataObjectFinder dataObjectFinder){
  this.destinationDb=destinationDb;
  this.sourceDb=sourceDb;
  this.toBeCopied=new Vector();
  this.orphanList=orphanDataList;
  this.idProvider=idProvider;
  this.dataObjectFinder=dataObjectFinder;
}