nus-yam/ex-repair huggingface dataset:
Program: 102211
Project: 102211
Buggy source:
void updateTranslatorOverrides(Properties props){
  if (this.sourceInfo.isMultiSource()) {
    return;
  }
  if (props.size() == 1 && ((String)props.keySet().toArray()[0]).equalsIgnoreCase(VdbConstants.Translator.NAME_KEY)) {
    return;
  }
  TranslatorOverride to=getTranslatorOverride();
  String oldTranslator=this.sourceInfo.getSource().getTranslatorName();
  String newTranslator=null;
  if (to == null) {
    String toName=null;
    if (!oldTranslator.startsWith(this.sourceInfo.getSource().getName())) {
      toName=this.sourceInfo.getSource().getName() + '_' + oldTranslator;
    }
    to=new TranslatorOverride(getVdb(),toName,oldTranslator,null);
    newTranslator=toName;
    this.sourceInfo.getSource().setTranslatorName(toName);
    getVdb().addTranslator(to,new NullProgressMonitor());
  }
  TranslatorOverrideProperty[] toProps=to.getProperties();
  Set<Object> keys=props.keySet();
  for (  Object nextKey : keys) {
    boolean existing="String_Node_Str".equals(nextKey);
    for (    TranslatorOverrideProperty toProp : toProps) {
      if (toProp.getDefinition().getId().equals(nextKey)) {
        toProp.setValue(props.getProperty((String)nextKey));
        existing=true;
        break;
      }
    }
    if (!existing) {
      to.addProperty(new TranslatorOverrideProperty(new TranslatorPropertyDefinition((String)nextKey,"String_Node_Str"),props.getProperty((String)nextKey)));
    }
  }
  getVdb().setModified(this,MODEL_TRANSLATOR,oldTranslator,newTranslator);
}

Fixed version (ground truth):
void updateTranslatorOverrides(Properties props){
  if (this.sourceInfo.isMultiSource()) {
    return;
  }
  if (props.size() == 1 && ((String)props.keySet().toArray()[0]).equalsIgnoreCase(VdbConstants.Translator.NAME_KEY)) {
    return;
  }
  TranslatorOverride to=getTranslatorOverride();
  String oldTranslator=this.sourceInfo.getSource(0).getTranslatorName();
  String newTranslator=null;
  if (to == null) {
    String toName=null;
    if (!oldTranslator.startsWith(this.sourceInfo.getSource(0).getName())) {
      toName=this.sourceInfo.getSource(0).getName() + '_' + oldTranslator;
    }
    to=new TranslatorOverride(getVdb(),toName,oldTranslator,null);
    newTranslator=toName;
    this.sourceInfo.getSource(0).setTranslatorName(toName);
    getVdb().addTranslator(to,new NullProgressMonitor());
  }
  TranslatorOverrideProperty[] toProps=to.getProperties();
  Set<Object> keys=props.keySet();
  for (  Object nextKey : keys) {
    boolean existing="String_Node_Str".equals(nextKey);
    for (    TranslatorOverrideProperty toProp : toProps) {
      if (toProp.getDefinition().getId().equals(nextKey)) {
        toProp.setValue(props.getProperty((String)nextKey));
        existing=true;
        break;
      }
    }
    if (!existing) {
      to.addProperty(new TranslatorOverrideProperty(new TranslatorPropertyDefinition((String)nextKey,"String_Node_Str"),props.getProperty((String)nextKey)));
    }
  }
  getVdb().setModified(this,MODEL_TRANSLATOR,oldTranslator,newTranslator);
}
Program: 102212
Project: 102212
Buggy source:
/** 
 * @param index
 * @param name
 */
public final void setSourceName(int index,String name){
  CoreArgCheck.isTrue(index < sourceInfo.getSourceCount(),"String_Node_Str");
  if (StringUtilities.isEmpty(name))   name=null;
  String oldName=sourceInfo.getSource().getName();
  if (StringUtilities.equals(name,oldName))   return;
  sourceInfo.getSource(index).setName(name);
}

Fixed version (ground truth):
/** 
 * @param index
 * @param name
 */
public final void setSourceName(int index,String name){
  CoreArgCheck.isTrue(index < sourceInfo.getSourceCount(),"String_Node_Str");
  if (StringUtilities.isEmpty(name))   name=null;
  String oldName=sourceInfo.getSource(index).getName();
  if (StringUtilities.equals(name,oldName))   return;
  sourceInfo.getSource(index).setName(name);
}
Program: 102213
Project: 102213
Buggy source:
/** 
 * @param index
 * @param name 
 */
public void setJndiName(int index,String name){
  CoreArgCheck.isTrue(index < sourceInfo.getSourceCount(),"String_Node_Str");
  if (StringUtilities.isEmpty(name))   name=null;
  String oldName=sourceInfo.getSource().getJndiName();
  if (StringUtilities.equals(name,oldName))   return;
  sourceInfo.getSource(index).setJndiName(name);
}

Fixed version (ground truth):
/** 
 * @param index
 * @param name 
 */
public void setJndiName(int index,String name){
  CoreArgCheck.isTrue(index < sourceInfo.getSourceCount(),"String_Node_Str");
  if (StringUtilities.isEmpty(name))   name=null;
  String oldName=sourceInfo.getSource(index).getJndiName();
  if (StringUtilities.equals(name,oldName))   return;
  sourceInfo.getSource(index).setJndiName(name);
}
Program: 102214
Project: 102214
Buggy source:
/** 
 * @param index the source array index
 * @return the VdbSource instance if it exists in the sources map
 */
public VdbSource getSource(int index){
  if (!sources.isEmpty() && sources.size() < index) {
    for (int i=0; i < sources.size(); i++) {
      VdbSource source=sources.values().iterator().next();
      if (i == index)       return source;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param index the source array index
 * @return the VdbSource instance if it exists in the sources map
 */
public VdbSource getSource(int index){
  if (sources.isEmpty()) {
    add(DEFAULT_SOURCE_NAME,null,null);
  }
  if (index < sources.size()) {
    for (int i=0; i < sources.size(); i++) {
      VdbSource source=sources.values().iterator().next();
      if (i == index)       return source;
    }
  }
  return null;
}
Program: 102215
Project: 102215
Buggy source:
@Test public void shouldReflectJndiNameAsSimpleModelName() throws Exception {
  assertThat(entry.getSourceInfo().getSource().getJndiName(),is(modelResourceFileName));
}

Fixed version (ground truth):
@Test public void shouldReflectJndiNameAsSimpleModelName() throws Exception {
  assertThat(entry.getSourceInfo().getSource(0).getJndiName(),is(modelResourceFileName));
}
Program: 102216
Project: 102216
Buggy source:
@Test public void shouldReflectSourceNameAsSimpleModelName() throws Exception {
  assertThat(entry.getSourceInfo().getSource().getName(),is(modelResourceFileName));
}

Fixed version (ground truth):
@Test public void shouldReflectSourceNameAsSimpleModelName() throws Exception {
  assertThat(entry.getSourceInfo().getSource(0).getName(),is(modelResourceFileName));
}
Program: 102217
Project: 102217
Buggy source:
@Override final public IStatus execute(IProgressMonitor monitor){
  problems.clear();
  try {
    final String msg=ModelerCore.Util.getString("String_Node_Str");
    IStatus result=new Status(IStatus.OK,PID,EXECUTE_SUCCEEDED,msg,null);
    final IStatus okayStatus=result;
    if (result.getSeverity() == IStatus.ERROR) {
      return result;
    }
    int severity=checkDependentResources(NOT_UNDO_REQUEST);
    if (severity < IStatus.ERROR) {
      result=modifyResource(this.getResource(),monitor);
      if (result == null || result.getSeverity() < IStatus.ERROR) {
        final Map refactoredPaths=getMovedResourcePathMap(false);
        result=refactorModelContents(monitor,refactoredPaths);
      }
      if (result == null || result.getSeverity() < IStatus.ERROR) {
        final Map refactoredPaths=getMovedResourcePathMap(false);
        result=refactorDependentResources(monitor,refactoredPaths);
      }
    }
 else {
      final String msg2=ModelerCore.Util.getString("String_Node_Str");
      return new Status(severity,PID,ERROR_READONLY_RESOURCE,msg2,null);
    }
    if (result.isOK()) {
      return okayStatus;
    }
    return result;
  }
  finally {
    if (monitor != null)     monitor.done();
  }
}

Fixed version (ground truth):
@Override final public IStatus execute(IProgressMonitor monitor){
  problems.clear();
  try {
    final String msg=ModelerCore.Util.getString("String_Node_Str");
    IStatus result=new Status(IStatus.OK,PID,EXECUTE_SUCCEEDED,msg,null);
    final IStatus okayStatus=result;
    if (result.getSeverity() == IStatus.ERROR) {
      return result;
    }
    int severity=checkDependentResources(NOT_UNDO_REQUEST);
    if (severity < IStatus.ERROR) {
      unloadDependentResources();
      result=modifyResource(this.getResource(),monitor);
      if (result == null || result.getSeverity() < IStatus.ERROR) {
        final Map refactoredPaths=getMovedResourcePathMap(false);
        result=refactorModelContents(monitor,refactoredPaths);
      }
      if (result == null || result.getSeverity() < IStatus.ERROR) {
        final Map refactoredPaths=getMovedResourcePathMap(false);
        result=refactorDependentResources(monitor,refactoredPaths);
      }
    }
 else {
      final String msg2=ModelerCore.Util.getString("String_Node_Str");
      return new Status(severity,PID,ERROR_READONLY_RESOURCE,msg2,null);
    }
    if (result.isOK()) {
      return okayStatus;
    }
    return result;
  }
 catch (  Exception ex) {
    return new Status(IStatus.ERROR,PID,ex.getMessage(),ex);
  }
 finally {
    if (monitor != null)     monitor.done();
  }
}
Program: 102218
Project: 102218
Buggy source:
private void validateMetaclasses(){
  final String[] metaclasses=getMed().getExtendedMetaclasses();
  ValidationStatus status=ModelExtensionDefinitionValidator.validateMetaclassNames(metaclasses,true);
  if (!status.isError()) {
    ExtendableMetaclassNameProvider provider=ExtensionPlugin.getInstance().getMetaclassNameProvider(getMed().getMetamodelUri());
    if (provider instanceof ModelTypeMetaclassNameFactory) {
      provider=((ModelTypeMetaclassNameFactory)provider).getProvider(getMed().getSupportedModelTypes());
    }
    OUTER:     for (    final String metaclass : metaclasses) {
      INNER:       for (      final String metaclassRoot : provider.getExtendableMetaclassRoots()) {
        boolean confirmed=confirmMetaclass(metaclass,provider,metaclassRoot);
        if (confirmed) {
          break INNER;
        }
 else {
          status=ValidationStatus.createErrorMessage(NLS.bind(Messages.metaclassNotFoundByProvider,metaclass));
          break OUTER;
        }
      }
    }
  }
  this.metaclassError.setStatus(status);
  updateMessage(this.metaclassError);
  validatePropertyDefinitions();
}

Fixed version (ground truth):
private void validateMetaclasses(){
  final String[] metaclasses=getMed().getExtendedMetaclasses();
  ValidationStatus status=ModelExtensionDefinitionValidator.validateMetaclassNames(metaclasses,true);
  if (!status.isError()) {
    ExtendableMetaclassNameProvider provider=ExtensionPlugin.getInstance().getMetaclassNameProvider(getMed().getMetamodelUri());
    if (provider instanceof ModelTypeMetaclassNameFactory) {
      provider=((ModelTypeMetaclassNameFactory)provider).getProvider(getMed().getSupportedModelTypes());
    }
    OUTER:     for (    final String metaclass : metaclasses) {
      boolean confirmed=false;
      INNER:       for (      final String metaclassRoot : provider.getExtendableMetaclassRoots()) {
        confirmed=confirmMetaclass(metaclass,provider,metaclassRoot);
        if (confirmed) {
          break INNER;
        }
      }
      if (!confirmed) {
        status=ValidationStatus.createErrorMessage(NLS.bind(Messages.metaclassNotFoundByProvider,metaclass));
        break OUTER;
      }
    }
  }
  this.metaclassError.setStatus(status);
  updateMessage(this.metaclassError);
  validatePropertyDefinitions();
}
Program: 102221
Project: 102221
Buggy source:
/** 
 * handler for Create Relationships Model Button pressed
 */
private ModelResource createRelationalModel(IResource targetRes,String sNewRelationshipModelName){
  ModelResource mrRelationshipModel=constructRelationalModel(targetRes,sNewRelationshipModelName);
  try {
    if (mrRelationshipModel != null) {
      mrRelationshipModel.save(null,false);
    }
  }
 catch (  ModelWorkspaceException mwe) {
    UiConstants.Util.log(mwe);
  }
  return mrRelationshipModel;
}

Fixed version (ground truth):
/** 
 * handler for Create Relationships Model Button pressed
 */
private ModelResource createRelationalModel(IResource targetRes,String sNewRelationshipModelName){
  ModelResource mr=constructRelationalModel(targetRes,sNewRelationshipModelName);
  try {
    if (mr != null) {
      mr.save(null,false);
    }
  }
 catch (  ModelWorkspaceException mwe) {
    UiConstants.Util.log(mwe);
  }
  return mr;
}
Program: 102222
Project: 102222
Buggy source:
/** 
 * Create instance with custom functions
 * @param functionTrees
 */
public FunctionLibraryImpl(Collection<FunctionTree> functionTrees){
  functionLibrary=new FunctionLibrary(systemFunctionManager.getSystemFunctions(),functionTrees.toArray(new FunctionTree[0]));
}

Fixed version (ground truth):
/** 
 * Create instance with custom functions
 * @param functionTrees
 */
public FunctionLibraryImpl(Collection<FunctionTree> functionTrees){
  systemFunctionManager.setClassloader(getClass().getClassLoader());
  functionLibrary=new FunctionLibrary(systemFunctionManager.getSystemFunctions(),functionTrees.toArray(new FunctionTree[0]));
}
Program: 102223
Project: 102223
Buggy source:
@Override public IMappingNode getRootElement(){
  return new MappingNodeImpl(document.getRootNode());
}

Fixed version (ground truth):
@Override public IMappingNode getRootElement(){
  if (document.getRootNode() instanceof MappingAllNode) {
    return new MappingAllNodeImpl((MappingAllNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingChoiceNode) {
    return new MappingChoiceNodeImpl((MappingChoiceNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingCriteriaNode) {
    return new MappingCriteriaNodeImpl((MappingCriteriaNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingRecursiveElement) {
    return new MappingRecursiveElementImpl((MappingRecursiveElement)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingElement) {
    return new MappingElementImpl((MappingElement)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingSequenceNode) {
    return new MappingSequenceNodeImpl((MappingSequenceNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingSourceNode) {
    return new MappingSourceNodeImpl((MappingSourceNode)document.getRootNode());
  }
  return new MappingNodeImpl(document.getRootNode());
}
Program: 102224
Project: 102224
Buggy source:
@Override public void setSource(String source){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).setSource(source);
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void setSource(String source){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).setSource(source);
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102225
Project: 102225
Buggy source:
private void addSequenceNode(IMappingSequenceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSequenceNodeImpl nodeImpl=(MappingSequenceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSequenceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addSequenceNode(IMappingSequenceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSequenceNodeImpl nodeImpl=(MappingSequenceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSequenceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102226
Project: 102226
Buggy source:
private void addChildElement(IMappingElement element){
  if (mappingNode instanceof MappingBaseNode) {
    MappingElementImpl elementImpl=(MappingElementImpl)element;
    ((MappingBaseNode)mappingNode).addChildElement(elementImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addChildElement(IMappingElement element){
  if (mappingNode instanceof MappingBaseNode) {
    MappingElementImpl elementImpl=(MappingElementImpl)element;
    ((MappingBaseNode)mappingNode).addChildElement(elementImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102227
Project: 102227
Buggy source:
private void addCriteriaNode(IMappingCriteriaNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingCriteriaNodeImpl nodeImpl=(MappingCriteriaNodeImpl)node;
    ((MappingBaseNode)mappingNode).addCriteriaNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addCriteriaNode(IMappingCriteriaNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingCriteriaNodeImpl nodeImpl=(MappingCriteriaNodeImpl)node;
    ((MappingBaseNode)mappingNode).addCriteriaNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102228
Project: 102228
Buggy source:
@Override public void addStagingTable(String stagingTable){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).addStagingTable(stagingTable);
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void addStagingTable(String stagingTable){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).addStagingTable(stagingTable);
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102229
Project: 102229
Buggy source:
private void addSourceNode(IMappingSourceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSourceNodeImpl nodeImpl=(MappingSourceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSourceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addSourceNode(IMappingSourceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSourceNodeImpl nodeImpl=(MappingSourceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSourceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102230
Project: 102230
Buggy source:
private void addChoiceNode(IMappingChoiceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingChoiceNodeImpl nodeImpl=(MappingChoiceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addChoiceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addChoiceNode(IMappingChoiceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingChoiceNodeImpl nodeImpl=(MappingChoiceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addChoiceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102231
Project: 102231
Buggy source:
private void addAllNode(IMappingAllNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingAllNodeImpl nodeImpl=(MappingAllNodeImpl)node;
    ((MappingBaseNode)mappingNode).addAllNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addAllNode(IMappingAllNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingAllNodeImpl nodeImpl=(MappingAllNodeImpl)node;
    ((MappingBaseNode)mappingNode).addAllNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102232
Project: 102232
Buggy source:
/** 
 * @param name
 * @param namespace
 * @param recursionMappingClass 
 */
public MappingRecursiveElementImpl(String name,Namespace namespace,String recursionMappingClass){
  super(new MappingRecursiveElement(name,namespace,recursionMappingClass));
}

Fixed version (ground truth):
/** 
 * @param element
 */
public MappingRecursiveElementImpl(MappingRecursiveElement element){
  super(element);
}
Program: 102233
Project: 102233
Buggy source:
/** 
 * Create instance with custom functions
 * @param functionTrees
 */
public FunctionLibraryImpl(Collection<FunctionTree> functionTrees){
  functionLibrary=new FunctionLibrary(systemFunctionManager.getSystemFunctions(),functionTrees.toArray(new FunctionTree[0]));
}

Fixed version (ground truth):
/** 
 * Create instance with custom functions
 * @param functionTrees
 */
public FunctionLibraryImpl(Collection<FunctionTree> functionTrees){
  systemFunctionManager.setClassloader(getClass().getClassLoader());
  functionLibrary=new FunctionLibrary(systemFunctionManager.getSystemFunctions(),functionTrees.toArray(new FunctionTree[0]));
}
Program: 102234
Project: 102234
Buggy source:
@Override public IMappingNode getRootElement(){
  return new MappingNodeImpl(document.getRootNode());
}

Fixed version (ground truth):
@Override public IMappingNode getRootElement(){
  if (document.getRootNode() instanceof MappingAllNode) {
    return new MappingAllNodeImpl((MappingAllNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingChoiceNode) {
    return new MappingChoiceNodeImpl((MappingChoiceNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingCriteriaNode) {
    return new MappingCriteriaNodeImpl((MappingCriteriaNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingRecursiveElement) {
    return new MappingRecursiveElementImpl((MappingRecursiveElement)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingElement) {
    return new MappingElementImpl((MappingElement)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingSequenceNode) {
    return new MappingSequenceNodeImpl((MappingSequenceNode)document.getRootNode());
  }
  if (document.getRootNode() instanceof MappingSourceNode) {
    return new MappingSourceNodeImpl((MappingSourceNode)document.getRootNode());
  }
  return new MappingNodeImpl(document.getRootNode());
}
Program: 102235
Project: 102235
Buggy source:
@Override public void setSource(String source){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).setSource(source);
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void setSource(String source){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).setSource(source);
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102236
Project: 102236
Buggy source:
private void addSequenceNode(IMappingSequenceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSequenceNodeImpl nodeImpl=(MappingSequenceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSequenceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addSequenceNode(IMappingSequenceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSequenceNodeImpl nodeImpl=(MappingSequenceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSequenceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102237
Project: 102237
Buggy source:
private void addChildElement(IMappingElement element){
  if (mappingNode instanceof MappingBaseNode) {
    MappingElementImpl elementImpl=(MappingElementImpl)element;
    ((MappingBaseNode)mappingNode).addChildElement(elementImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addChildElement(IMappingElement element){
  if (mappingNode instanceof MappingBaseNode) {
    MappingElementImpl elementImpl=(MappingElementImpl)element;
    ((MappingBaseNode)mappingNode).addChildElement(elementImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102238
Project: 102238
Buggy source:
private void addCriteriaNode(IMappingCriteriaNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingCriteriaNodeImpl nodeImpl=(MappingCriteriaNodeImpl)node;
    ((MappingBaseNode)mappingNode).addCriteriaNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addCriteriaNode(IMappingCriteriaNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingCriteriaNodeImpl nodeImpl=(MappingCriteriaNodeImpl)node;
    ((MappingBaseNode)mappingNode).addCriteriaNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102239
Project: 102239
Buggy source:
@Override public void addStagingTable(String stagingTable){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).addStagingTable(stagingTable);
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void addStagingTable(String stagingTable){
  if (mappingNode instanceof MappingBaseNode) {
    ((MappingBaseNode)mappingNode).addStagingTable(stagingTable);
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102240
Project: 102240
Buggy source:
private void addSourceNode(IMappingSourceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSourceNodeImpl nodeImpl=(MappingSourceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSourceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addSourceNode(IMappingSourceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingSourceNodeImpl nodeImpl=(MappingSourceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addSourceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102241
Project: 102241
Buggy source:
private void addChoiceNode(IMappingChoiceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingChoiceNodeImpl nodeImpl=(MappingChoiceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addChoiceNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addChoiceNode(IMappingChoiceNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingChoiceNodeImpl nodeImpl=(MappingChoiceNodeImpl)node;
    ((MappingBaseNode)mappingNode).addChoiceNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102242
Project: 102242
Buggy source:
private void addAllNode(IMappingAllNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingAllNodeImpl nodeImpl=(MappingAllNodeImpl)node;
    ((MappingBaseNode)mappingNode).addAllNode(nodeImpl.getMappingNode());
  }
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
private void addAllNode(IMappingAllNode node){
  if (mappingNode instanceof MappingBaseNode) {
    MappingAllNodeImpl nodeImpl=(MappingAllNodeImpl)node;
    ((MappingBaseNode)mappingNode).addAllNode(nodeImpl.getMappingNode());
    return;
  }
  throw new UnsupportedOperationException();
}
Program: 102243
Project: 102243
Buggy source:
/** 
 * @param name
 * @param namespace
 * @param recursionMappingClass 
 */
public MappingRecursiveElementImpl(String name,Namespace namespace,String recursionMappingClass){
  super(new MappingRecursiveElement(name,namespace,recursionMappingClass));
}

Fixed version (ground truth):
/** 
 * @param element
 */
public MappingRecursiveElementImpl(MappingRecursiveElement element){
  super(element);
}
Program: 102244
Project: 102244
Buggy source:
private Collection<String> getRowsFromLine(String str){
  Collection<String> strings=new ArrayList<String>();
  String theString=str;
  while (theString.length() > 0) {
    if ((str.indexOf(CR_1) > -1 || str.indexOf(CR_2) > -1)) {
      int lf_1_index=theString.indexOf(CR_1);
      int lf_2_index=theString.indexOf(CR_2);
      if (lf_1_index > -1 && lf_2_index > lf_1_index) {
        String seg=theString.substring(0,lf_1_index);
        strings.add(seg);
        int strLen=theString.length();
        int lengthLeft=(strLen - 1) - (lf_1_index + 4);
        if (lengthLeft > 0) {
          theString=theString.substring((lf_1_index + 4),(strLen)).trim();
        }
 else {
          theString=EMPTY_STR;
        }
      }
 else       if (lf_2_index > -1) {
        String seg=theString.substring(0,lf_2_index);
        strings.add(seg);
        int strLen=theString.length();
        int lengthLeft=(strLen - 1) - (lf_2_index + 2);
        if (lengthLeft > 0) {
          theString=theString.substring((lf_2_index + 2),(strLen)).trim();
        }
 else {
        }
      }
    }
 else {
      strings.add(theString);
      theString=EMPTY_STR;
    }
  }
  return strings;
}

Fixed version (ground truth):
private Collection<String> getRowsFromLine(String str){
  Collection<String> strings=new ArrayList<String>();
  String theString=str;
  while (theString.length() > 0) {
    if ((theString.indexOf(CR_1) > -1 || theString.indexOf(CR_2) > -1)) {
      int lf_1_index=theString.indexOf(CR_1);
      int lf_2_index=theString.indexOf(CR_2);
      if (lf_1_index > -1 && lf_2_index > lf_1_index) {
        String seg=theString.substring(0,lf_1_index);
        strings.add(seg);
        int strLen=theString.length();
        int lengthLeft=(strLen - 1) - (lf_1_index + 4);
        if (lengthLeft > 0) {
          theString=theString.substring((lf_1_index + 4),(strLen)).trim();
        }
 else {
          theString=EMPTY_STR;
        }
      }
 else       if (lf_2_index > -1) {
        String seg=theString.substring(0,lf_2_index);
        strings.add(seg);
        int strLen=theString.length();
        int lengthLeft=(strLen - 1) - (lf_2_index + 2);
        if (lengthLeft > 0) {
          theString=theString.substring((lf_2_index + 2),(strLen)).trim();
        }
 else {
        }
      }
    }
 else {
      strings.add(theString);
      theString=EMPTY_STR;
    }
  }
  return strings;
}
Program: 102245
Project: 102245
Buggy source:
@Override public void visit(IUpdate update){
}

Fixed version (ground truth):
@Override public void visit(ILanguageObject languageObject){
}
Program: 102246
Project: 102246
Buggy source:
@Override public boolean hasChildren(){
  return dirty || (children != null && !children.isEmpty());
}

Fixed version (ground truth):
@Override public boolean hasChildren(){
  return !dirty || (children != null && !children.isEmpty());
}
Program: 102247
Project: 102247
Buggy source:
/** 
 * Adapt to a   {@link TeiidServerContainerNode}
 * @param adaptableObject
 * @return
 */
private TeiidServerContainerNode adaptToTeiidServerContainerNode(ITeiidResourceNode teiidResourceNode){
  if (teiidResourceNode.hasChildren()) {
    List<? extends ITeiidContentNode<?>> children=teiidResourceNode.getChildren();
    return (TeiidServerContainerNode)children.get(0);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Adapt to a   {@link TeiidServerContainerNode}
 * @param adaptableObject
 * @return
 */
private TeiidServerContainerNode adaptToTeiidServerContainerNode(ITeiidResourceNode teiidResourceNode){
  if (teiidResourceNode.hasChildren()) {
    List<? extends ITeiidContentNode<?>> children=teiidResourceNode.getChildren();
    ITeiidContentNode<?> child=children.get(0);
    if (child instanceof TeiidServerContainerNode)     return (TeiidServerContainerNode)child;
  }
  return null;
}
Program: 102248
Project: 102248
Buggy source:
@Override public void run(){
  if (viewer.getTree().isDisposed())   return;
  Tree tree=viewer.getTree();
  TeiidResourceNode trn=null;
  int selectionCount=tree.getSelectionCount();
  ISelection currentSelection=viewer.getSelection();
  viewer.refresh();
  TreePath[] expandedElements=viewer.getExpandedTreePaths();
  for (  TreePath o : expandedElements) {
    Object element=o.getLastSegment();
    if (isTeiidResourceNode(element)) {
      trn=(TeiidResourceNode)element;
      break;
    }
    Object[] children=TeiidServerContentProvider.this.getChildren(element);
    for (    Object child : children) {
      if (isTeiidResourceNode(child)) {
        trn=(TeiidResourceNode)child;
        break;
      }
    }
    if (isTeiidResourceNode(trn)) {
      break;
    }
  }
  if (trn != null) {
    viewer.setExpandedState(trn,true);
    viewer.expandToLevel(trn,2);
  }
  if (selectionCount == 1) {
    viewer.setSelection(new StructuredSelection());
    viewer.setSelection(currentSelection);
  }
  ModelerUiViewUtils.refreshModelExplorerResourceNavigatorTree();
}

Fixed version (ground truth):
@Override public void run(){
  if (viewer.getControl().isDisposed())   return;
  for (  Object node : updated) {
    pendingUpdates.remove(node);
    viewer.refresh(node);
    if (node instanceof TeiidResourceNode) {
      viewer.setExpandedState(node,true);
      viewer.expandToLevel(node,2);
    }
  }
}
Program: 102249
Project: 102249
Buggy source:
@Override public void configurationChanged(final ExecutionConfigurationEvent event){
  UiUtil.runInSwtThread(new Runnable(){
    @Override public void run(){
      if (viewer.getTree().isDisposed())       return;
      Tree tree=viewer.getTree();
      TeiidResourceNode trn=null;
      int selectionCount=tree.getSelectionCount();
      ISelection currentSelection=viewer.getSelection();
      viewer.refresh();
      TreePath[] expandedElements=viewer.getExpandedTreePaths();
      for (      TreePath o : expandedElements) {
        Object element=o.getLastSegment();
        if (isTeiidResourceNode(element)) {
          trn=(TeiidResourceNode)element;
          break;
        }
        Object[] children=TeiidServerContentProvider.this.getChildren(element);
        for (        Object child : children) {
          if (isTeiidResourceNode(child)) {
            trn=(TeiidResourceNode)child;
            break;
          }
        }
        if (isTeiidResourceNode(trn)) {
          break;
        }
      }
      if (trn != null) {
        viewer.setExpandedState(trn,true);
        viewer.expandToLevel(trn,2);
      }
      if (selectionCount == 1) {
        viewer.setSelection(new StructuredSelection());
        viewer.setSelection(currentSelection);
      }
      ModelerUiViewUtils.refreshModelExplorerResourceNavigatorTree();
    }
    private boolean isTeiidResourceNode(    Object o){
      return o instanceof TeiidResourceNode;
    }
  }
,false);
}

Fixed version (ground truth):
@Override public void configurationChanged(final ExecutionConfigurationEvent event){
  TeiidServer eventServer=event.getServer();
  if (eventServer == null)   return;
  refreshThread.refresh();
}
Program: 102250
Project: 102250
Buggy source:
/** 
 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
 * @since 4.2
 */
@Override public String getText(Object element){
  if (element instanceof IContentNode) {
    IContentNode node=(IContentNode)element;
    return node.getName();
  }
  if (element instanceof String) {
    return (String)element;
  }
  if (element == TeiidServerContentProvider.PENDING) {
    return DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str");
  }
  return super.getText(element);
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
 * @since 4.2
 */
@Override public String getText(Object element){
  if (element instanceof IContentNode) {
    IContentNode node=(IContentNode)element;
    return node.getName();
  }
  if (element instanceof String) {
    return (String)element;
  }
  if (element == TeiidServerContentProvider.getPending()) {
    return DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str");
  }
  return super.getText(element);
}
Program: 102251
Project: 102251
Buggy source:
@Override public final void load(){
  if (getServer().getServerState() != IServer.STATE_STARTED) {
    setError(new TeiidErrorNode(this,null,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
    return;
  }
  try {
    children=new ArrayList<IContentNode<? extends IContainerNode<?>>>();
    teiidServer=(TeiidServer)getServer().loadAdapter(TeiidServer.class,null);
    if (teiidServer != null) {
      if (teiidServer.isConnected())       children.add(new TeiidServerContainerNode(this,provider));
 else {
        setError(new TeiidErrorNode(this,teiidServer,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
        return;
      }
    }
    clearError();
  }
 catch (  Exception e) {
    setError(new TeiidErrorNode(this,teiidServer,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
  }
}

Fixed version (ground truth):
@Override public final void load(){
  if (getServer().getServerState() != IServer.STATE_STARTED) {
    setError(new TeiidErrorNode(this,null,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
    return;
  }
  try {
    teiidServer=(TeiidServer)getServer().loadAdapter(TeiidServer.class,null);
    if (teiidServer != null) {
      if (teiidServer.isConnected()) {
        if (children == null)         children=new ArrayList<IContentNode<? extends IContainerNode<?>>>();
        children.add(new TeiidServerContainerNode(this,provider));
      }
 else {
        setError(new TeiidErrorNode(this,teiidServer,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
        return;
      }
    }
    clearError();
  }
 catch (  Exception e) {
    DqpUiConstants.UTIL.log(e);
    setError(new TeiidErrorNode(this,teiidServer,DqpUiConstants.UTIL.getString(getClass().getSimpleName() + "String_Node_Str")));
  }
}
Program: 102252
Project: 102252
Buggy source:
/** 
 * @param vdb
 * @return
 */
public void undeployVdb(VDB vdb) throws Exception {
  CoreArgCheck.isNotNull(vdb,"String_Node_Str");
  admin.undeploy(vdb.getName() + ModelerCore.VDB_FILE_EXTENSION);
  refreshVDBs();
  this.eventManager.notifyListeners(ExecutionConfigurationEvent.createUnDeployVDBEvent(vdb));
}

Fixed version (ground truth):
/** 
 * @param vdb
 * @return
 */
public void undeployVdb(VDB vdb) throws Exception {
  CoreArgCheck.isNotNull(vdb,"String_Node_Str");
  admin.undeploy(appendVdbExtension(vdb.getName()));
  refreshVDBs();
  this.eventManager.notifyListeners(ExecutionConfigurationEvent.createUnDeployVDBEvent(vdb));
}
Program: 102253
Project: 102253
Buggy source:
/** 
 * @param sourceVdbName (excluding .vdb extension) the name of the VDB being merged into the target VDB
 * @param sourceVdbVersion the version of the source VDB
 * @param targetVdbName (excluding .vdb extension) the name of the VDB being merged into
 * @param targetVdbVersion the version of the target VDB
 * @throws Exception if there is a problem with the merge
 */
public void mergeVdbs(List<IFile> pvdbsToMerge,String ptargetVdbName,int ptargetVdbVersion,IFile ptargetvdbToMerge) throws Exception {
  VDB projectVdb=getVdb(ptargetVdbName);
  String name=projectVdb.getPropertyValue("String_Node_Str");
  Vdb vdb=new Vdb(ptargetvdbToMerge,new NullProgressMonitor());
  for (  IFile pvdbToMerge : pvdbsToMerge) {
    if (ptargetvdbToMerge.equals(pvdbToMerge))     continue;
    String sourceVdbName=pvdbToMerge.getFullPath().removeFileExtension().lastSegment().toString();
    if (!sourceVdbName.contains("String_Node_Str")) {
      vdb.addImportVdb(sourceVdbName);
    }
  }
  this.admin.undeploy(name + ModelerCore.VDB_FILE_EXTENSION);
  vdb.save(null);
  ptargetvdbToMerge.refreshLocal(IResource.DEPTH_INFINITE,null);
  deployVdb(vdb.getFile());
}

Fixed version (ground truth):
/** 
 * @param sourceVdbName (excluding .vdb extension) the name of the VDB being merged into the target VDB
 * @param sourceVdbVersion the version of the source VDB
 * @param targetVdbName (excluding .vdb extension) the name of the VDB being merged into
 * @param targetVdbVersion the version of the target VDB
 * @throws Exception if there is a problem with the merge
 */
public void mergeVdbs(List<IFile> pvdbsToMerge,String ptargetVdbName,int ptargetVdbVersion,IFile ptargetvdbToMerge) throws Exception {
  VDB projectVdb=getVdb(ptargetVdbName);
  String name=projectVdb.getPropertyValue("String_Node_Str");
  Vdb vdb=new Vdb(ptargetvdbToMerge,new NullProgressMonitor());
  for (  IFile pvdbToMerge : pvdbsToMerge) {
    if (ptargetvdbToMerge.equals(pvdbToMerge))     continue;
    String sourceVdbName=pvdbToMerge.getFullPath().removeFileExtension().lastSegment().toString();
    if (!sourceVdbName.contains("String_Node_Str")) {
      vdb.addImportVdb(sourceVdbName);
    }
  }
  this.admin.undeploy(appendVdbExtension(name));
  vdb.save(null);
  ptargetvdbToMerge.refreshLocal(IResource.DEPTH_INFINITE,null);
  deployVdb(vdb.getFile());
}
Program: 102254
Project: 102254
Buggy source:
private IFile getFile(Resource resource){
  IFile resultFile=null;
  if (resource != null) {
    URI uri=resource.getURI();
    String fileString=URI.decode(uri.path());
    resultFile=ModelerCore.getWorkspace().getRoot().getFileForLocation(new Path(fileString));
  }
  return resultFile;
}

Fixed version (ground truth):
private IFile getFile(Resource resource){
  IFile resultFile=null;
  if (resource != null) {
    IProject[] allProj=ModelerCore.getWorkspace().getRoot().getProjects();
    List<String> projNameList=new ArrayList();
    for (int i=0; i < allProj.length; i++) {
      projNameList.add(allProj[i].getName());
    }
    URI uri=resource.getURI();
    uri=validateURI(uri,projNameList);
    String fileString=URI.decode(uri.path());
    IResource iResc=ModelerCore.getWorkspace().getRoot().findMember(new Path(fileString));
    if (iResc instanceof IFile) {
      resultFile=(IFile)iResc;
    }
  }
  return resultFile;
}
Program: 102259
Project: 102259
Buggy source:
/** 
 * Test whether it's possible to read and write files in the specified directory.
 * @param dirPath Name of the directory to test
 * @throws MetaMatrixCoreException
 * @since 4.3
 */
public static void testDirectoryPermissions(final String dirPath) throws TeiidException {
  final File tmpFile=new File(dirPath + File.separatorChar + TEMP_FILE);
  boolean success=false;
  try {
    success=tmpFile.createNewFile();
  }
 catch (  final IOException e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  if (!tmpFile.canWrite()) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  if (!tmpFile.canRead()) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  final File newFile=new File(dirPath + File.separatorChar + TEMP_FILE_RENAMED);
  success=false;
  try {
    success=tmpFile.renameTo(newFile);
  }
 catch (  final Exception e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  success=false;
  try {
    success=newFile.delete();
  }
 catch (  final Exception e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
}

Fixed version (ground truth):
/** 
 * Test whether it's possible to read and write files in the specified directory.
 * @param dirPath Name of the directory to test
 * @throws TeiidException
 * @since 4.3
 */
public static void testDirectoryPermissions(final String dirPath) throws TeiidException {
  final File tmpFile=new File(dirPath + File.separatorChar + TEMP_FILE);
  boolean success=false;
  try {
    success=tmpFile.createNewFile();
  }
 catch (  final IOException e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  if (!tmpFile.canWrite()) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  if (!tmpFile.canRead()) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  final File newFile=new File(dirPath + File.separatorChar + TEMP_FILE_RENAMED);
  success=false;
  try {
    success=tmpFile.renameTo(newFile);
  }
 catch (  final Exception e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
  success=false;
  try {
    success=newFile.delete();
  }
 catch (  final Exception e) {
  }
  if (!success) {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",dirPath);
    throw new TeiidException(msg);
  }
}
Program: 102260
Project: 102260
Buggy source:
/** 
 * Copy a file
 * @param fromFileName
 * @param toFileName
 * @param overwrite whether to overwrite the destination file if it exists.
 * @throws MetaMatrixCoreException
 * @since 4.3
 */
public static void copy(final String fromFileName,final String toFileName,final boolean overwrite) throws IOException {
  final File toFile=new File(toFileName);
  if (toFile.exists())   if (overwrite)   toFile.delete();
 else {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",toFileName);
    throw new IOException(msg);
  }
  final File fromFile=new File(fromFileName);
  if (!fromFile.exists())   throw new FileNotFoundException(CoreModelerPlugin.Util.getString("String_Node_Str",fromFileName));
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(fromFile);
    write(fis,toFileName);
  }
  finally {
    if (fis != null)     fis.close();
  }
}

Fixed version (ground truth):
/** 
 * Copy a file
 * @param fromFileName
 * @param toFileName
 * @param overwrite whether to overwrite the destination file if it exists.
 * @throws IOException
 * @since 4.3
 */
public static void copy(final String fromFileName,final String toFileName,final boolean overwrite) throws IOException {
  final File toFile=new File(toFileName);
  if (toFile.exists())   if (overwrite)   toFile.delete();
 else {
    final String msg=CoreModelerPlugin.Util.getString("String_Node_Str",toFileName);
    throw new IOException(msg);
  }
  final File fromFile=new File(fromFileName);
  if (!fromFile.exists())   throw new FileNotFoundException(CoreModelerPlugin.Util.getString("String_Node_Str",fromFileName));
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(fromFile);
    write(fis,toFileName);
  }
  finally {
    if (fis != null)     fis.close();
  }
}
Program: 102261
Project: 102261
Buggy source:
/** 
 * Attempt to convert the specified string to the appropriate ObjectID instance. This method is called by the   {@link IDGenerator#stringToObject(String)} method, whichmust process the protocol to determine the correct parser to use.  As such, it guarantees that the parser that receives this call can assume that the protocol was equal to the protocol returned by the parser's  {@link ObjectIDDescriptor#getProtocol()}.
 * @param value the stringified id with the protocol and ObjectID.DELIMITER alreadyremoved, and should never null or zero length
 * @return the ObjectID instance for the stringified ID if this factory is ableto parse the string, or null if the factory is unaware of the specified format.
 * @throws InvalidIDException if the parser is aware of this protocol, but it is of the wrongformat for this type of ObjectID.
 */
@Override public ObjectID stringWithoutProtocolToObject(String value) throws InvalidIDException {
  try {
    return new IntegerID(Integer.parseInt(value));
  }
 catch (  NumberFormatException e) {
    throw new InvalidIDException(CorePlugin.Util.getString("String_Node_Str",value,getProtocol()));
  }
}

Fixed version (ground truth):
/** 
 * Attempt to convert the specified string to the appropriate ObjectID instance. This method is called by the   {@link IDGenerator#stringToObject(String)} method, whichmust process the protocol to determine the correct parser to use.  As such, it guarantees that the parser that receives this call can assume that the protocol was equal to the protocol returned by the parser's  {@link ParsedObjectID#getProtocol()}.
 * @param value the stringified id with the protocol and ObjectID.DELIMITER alreadyremoved, and should never null or zero length
 * @return the ObjectID instance for the stringified ID if this factory is ableto parse the string, or null if the factory is unaware of the specified format.
 * @throws InvalidIDException if the parser is aware of this protocol, but it is of the wrongformat for this type of ObjectID.
 */
@Override public ObjectID stringWithoutProtocolToObject(String value) throws InvalidIDException {
  try {
    return new IntegerID(Integer.parseInt(value));
  }
 catch (  NumberFormatException e) {
    throw new InvalidIDException(CorePlugin.Util.getString("String_Node_Str",value,getProtocol()));
  }
}