nus-yam/ex-repair huggingface dataset:
Program: 160546
Project: 160546
Buggy source:
public FileJarClassLoader(ClassLoader parentClassLoader,File jarFile,File tempDir) throws FileNotFoundException, IOException {
  super(parentClassLoader);
  this.tempDir=tempDir;
  if (!tempDir.exists()) {
    tempDir.mkdir();
  }
  JarInputStream jarInputStream=new JarInputStream(new FileInputStream(jarFile));
  JarEntry entry=jarInputStream.getNextJarEntry();
  while (entry != null) {
    if (entry.getName().endsWith("String_Node_Str")) {
      ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
      IOUtils.copy(jarInputStream,byteArrayOutputStream);
      loadSubJars(byteArrayOutputStream.toByteArray());
    }
 else {
      if (!entry.isDirectory()) {
        addDataToMap(jarInputStream,entry);
      }
    }
    entry=jarInputStream.getNextJarEntry();
  }
  jarInputStream.close();
}

Fixed version (ground truth):
public FileJarClassLoader(ClassLoader parentClassLoader,File jarFile,File tempDir) throws FileNotFoundException, IOException {
  super(parentClassLoader);
  FileInputStream fis=new FileInputStream(jarFile);
  try {
    String md5=org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
    this.tempDir=new File(tempDir,md5);
  }
  finally {
    fis.close();
  }
  if (tempDir.exists()) {
    return;
  }
  tempDir.mkdir();
  JarInputStream jarInputStream=new JarInputStream(new FileInputStream(jarFile));
  JarEntry entry=jarInputStream.getNextJarEntry();
  while (entry != null) {
    if (entry.getName().endsWith("String_Node_Str")) {
      ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
      IOUtils.copy(jarInputStream,byteArrayOutputStream);
      loadSubJars(byteArrayOutputStream.toByteArray());
    }
 else {
      if (!entry.isDirectory()) {
        addDataToMap(jarInputStream,entry);
      }
    }
    entry=jarInputStream.getNextJarEntry();
  }
  jarInputStream.close();
}
Program: 160547
Project: 160547
Buggy source:
public SModelCheckerPluginDescriptor convertToSObject(ModelCheckerPluginDescriptor input){
  if (input == null) {
    return null;
  }
  SModelCheckerPluginDescriptor result=new SModelCheckerPluginDescriptor();
  result.setOid(input.getOid());
  result.setRid(input.getRid());
  result.setSimpleName(input.getSimpleName());
  result.setDefaultName(input.getDefaultName());
  result.setPluginClassName(input.getPluginClassName());
  result.setDescription(input.getDescription());
  result.setLocation(input.getLocation());
  result.setEnabled(input.getEnabled());
  result.setPluginInterfaceClassName(input.getPluginInterfaceClassName());
  List<Long> listconfigurations=new ArrayList<Long>();
  for (  PluginConfiguration v : input.getConfigurations()) {
    listconfigurations.add(v.getOid());
  }
  result.setConfigurations(listconfigurations);
  return result;
}

Fixed version (ground truth):
public SRemoteServiceCalled convertToSObject(RemoteServiceCalled input){
  if (input == null) {
    return null;
  }
  SRemoteServiceCalled result=new SRemoteServiceCalled();
  result.setOid(input.getOid());
  result.setRid(input.getRid());
  result.setDate(input.getDate());
  result.setAccessMethod(SAccessMethod.values()[input.getAccessMethod().ordinal()]);
  result.setState(SNotifictionResultEnum.values()[input.getState().ordinal()]);
  result.setPercentage(input.getPercentage());
  result.getInfos().addAll(input.getInfos());
  result.getWarnings().addAll(input.getWarnings());
  result.getErrors().addAll(input.getErrors());
  User executorVal=input.getExecutor();
  result.setExecutorId(executorVal == null ? -1 : executorVal.getOid());
  Service serviceVal=input.getService();
  result.setServiceId(serviceVal == null ? -1 : serviceVal.getOid());
  return result;
}
Program: 160548
Project: 160548
Buggy source:
public ModelCheckerPluginDescriptor convertFromSObject(SModelCheckerPluginDescriptor input,ModelCheckerPluginDescriptor result,DatabaseSession session) throws BimserverDatabaseException {
  if (input == null) {
    return null;
  }
  result.setSimpleName(input.getSimpleName());
  result.setDefaultName(input.getDefaultName());
  result.setPluginClassName(input.getPluginClassName());
  result.setDescription(input.getDescription());
  result.setLocation(input.getLocation());
  result.setEnabled(input.getEnabled());
  result.setPluginInterfaceClassName(input.getPluginInterfaceClassName());
  List<PluginConfiguration> listconfigurations=result.getConfigurations();
  for (  long oid : input.getConfigurations()) {
    listconfigurations.add((PluginConfiguration)session.get(StorePackage.eINSTANCE.getPluginConfiguration(),oid,Query.getDefault()));
  }
  return result;
}

Fixed version (ground truth):
public RemoteServiceCalled convertFromSObject(SRemoteServiceCalled input,RemoteServiceCalled result,DatabaseSession session) throws BimserverDatabaseException {
  if (input == null) {
    return null;
  }
  result.setDate(input.getDate());
  result.setAccessMethod(AccessMethod.values()[input.getAccessMethod().ordinal()]);
  result.setState(NotifictionResultEnum.values()[input.getState().ordinal()]);
  result.setPercentage(input.getPercentage());
  result.getInfos().addAll(input.getInfos());
  result.getWarnings().addAll(input.getWarnings());
  result.getErrors().addAll(input.getErrors());
  result.setExecutor((User)session.get(StorePackage.eINSTANCE.getUser(),input.getExecutorId(),Query.getDefault()));
  result.setService((Service)session.get(StorePackage.eINSTANCE.getService(),input.getServiceId(),Query.getDefault()));
  return result;
}
Program: 160549
Project: 160549
Buggy source:
@Override public URL findResource(final String name){
  try {
    return new URL(new URL("String_Node_Str" + jarFile.toURI().toURL() + "String_Node_Str"+ name),name,new URLStreamHandler(){
      @Override protected URLConnection openConnection(      URL u) throws IOException {
        return new URLConnection(u){
          @Override public void connect() throws IOException {
          }
          @Override public InputStream getInputStream() throws IOException {
            return new FileInputStream(new File(tempDir,name));
          }
        }
;
      }
    }
);
  }
 catch (  MalformedURLException e) {
    LOGGER.error("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
@Override public URL findResource(final String name){
  try {
    return new URL(new URL("String_Node_Str" + this.tempDir.getAbsolutePath() + "String_Node_Str"+ name),name,new URLStreamHandler(){
      @Override protected URLConnection openConnection(      URL u) throws IOException {
        return new URLConnection(u){
          @Override public void connect() throws IOException {
          }
          @Override public InputStream getInputStream() throws IOException {
            return new FileInputStream(new File(tempDir,name));
          }
        }
;
      }
    }
);
  }
 catch (  MalformedURLException e) {
    LOGGER.error("String_Node_Str",e);
  }
  return null;
}
Program: 160550
Project: 160550
Buggy source:
private void writeReference(IdEObject object,Object value,ByteBuffer buffer,EStructuralFeature feature) throws BimserverDatabaseException {
  Short cid=database.getCidOfEClass(((EObject)value).eClass());
  buffer.putShort(cid);
  IdEObject idEObject=(IdEObject)value;
  if (idEObject.getOid() == -1) {
    ((IdEObjectImpl)idEObject).setOid(newOid(object.eClass()));
    ((IdEObjectImpl)idEObject).setPid(object.getPid());
    ((IdEObjectImpl)idEObject).setRid(object.getRid());
  }
  buffer.putLong(idEObject.getOid());
}

Fixed version (ground truth):
private void writeReference(IdEObject object,Object value,ByteBuffer buffer,EStructuralFeature feature) throws BimserverDatabaseException {
  Short cid=database.getCidOfEClass(((EObject)value).eClass());
  buffer.putShort(cid);
  IdEObject idEObject=(IdEObject)value;
  if (idEObject.getOid() == -1) {
    ((IdEObjectImpl)idEObject).setOid(newOid(idEObject.eClass()));
    ((IdEObjectImpl)idEObject).setPid(object.getPid());
    ((IdEObjectImpl)idEObject).setRid(object.getRid());
  }
  buffer.putLong(idEObject.getOid());
}
Program: 160553
Project: 160553
Buggy source:
public static void main(String[] args){
  FileOutputStream fos=null;
  try {
    fos=new FileOutputStream(new File("String_Node_Str"));
    new IfcSchemaToJson().convert(fos);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      fos.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  FileOutputStream fos=null;
  try {
    fos=new FileOutputStream(new File("String_Node_Str"));
    new IfcSchemaToJson().convert(fos);
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (fos != null) {
      try {
        fos.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 160554
Project: 160554
Buggy source:
@Override public void execute(IfcModelInterface model,Project project,ConcreteRevision concreteRevision,DatabaseSession databaseSession,Map<Long,IdEObject> created,Map<Long,IdEObject> deleted) throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  EClass eClass=databaseSession.getEClassForName(type);
  if (eClass == null) {
    throw new UserException("String_Node_Str" + type + "String_Node_Str");
  }
  eObject=(IdEObjectImpl)eClass.getEPackage().getEFactoryInstance().create(eClass);
  eObject.setOid(oid);
  eObject.setPid(project.getId());
  eObject.setRid(concreteRevision.getId());
  ((IdEObjectImpl)eObject).setLoaded();
  databaseSession.store(eObject,project.getId(),concreteRevision.getId());
  created.put(oid,eObject);
}

Fixed version (ground truth):
@Override public void execute(IfcModelInterface model,Project project,ConcreteRevision concreteRevision,DatabaseSession databaseSession,Map<Long,IdEObject> created,Map<Long,IdEObject> deleted) throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  EClass eClass=databaseSession.getEClassForName(type);
  if (eClass == null) {
    throw new UserException("String_Node_Str" + type + "String_Node_Str");
  }
  eObject=(IdEObjectImpl)eClass.getEPackage().getEFactoryInstance().create(eClass);
  eObject.setOid(oid);
  eObject.setPid(project.getId());
  eObject.setRid(concreteRevision.getId());
  eObject.setLoaded();
  databaseSession.store(eObject,project.getId(),concreteRevision.getId());
  created.put(oid,eObject);
}
Program: 160557
Project: 160557
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=Math.round(100L * total.get() / totalSize);
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=(int)Math.round(100.0 * total.get() / totalSize);
}
Program: 160559
Project: 160559
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=Math.round(100L * total.get() / totalSize);
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=(int)Math.round(100.0 * total.get() / totalSize);
}
Program: 160561
Project: 160561
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=Math.round(100L * total.get() / totalSize);
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  progress=(int)Math.round(100.0 * total.get() / totalSize);
}
Program: 160563
Project: 160563
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",Math.round(100L * total.get() / totalSize));
  }
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",(int)Math.round(100.0 * total.get() / totalSize));
  }
}
Program: 160565
Project: 160565
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",Math.round(100L * total.get() / totalSize));
  }
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",(int)Math.round(100.0 * total.get() / totalSize));
  }
}
Program: 160567
Project: 160567
Buggy source:
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(uoid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getCheckout_User(),user);
  Map<Long,Checkout> query=(Map<Long,Checkout>)getDatabaseSession().query(condition,Checkout.class,Query.getDefault());
  return CollectionUtils.mapToList(query);
}

Fixed version (ground truth):
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(uoid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getCheckout_User(),user);
  Map<Long,Checkout> query=getDatabaseSession().query(condition,Checkout.class,Query.getDefault());
  return CollectionUtils.mapToList(query);
}
Program: 160568
Project: 160568
Buggy source:
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Project project=getProjectByPoid(poid);
  Set<Project> projects=new HashSet<Project>();
  if (checkSubProjects) {
    getSubProjects(project,projects);
  }
 else {
    projects.add(project);
  }
  Condition condition=new HasReferenceToInCondition(StorePackage.eINSTANCE.getCheckout_Project(),projects);
  Map<Long,Checkout> query=(Map<Long,Checkout>)getDatabaseSession().query(condition,Checkout.class,Query.getDefault());
  return CollectionUtils.mapToList(query);
}

Fixed version (ground truth):
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Project project=getProjectByPoid(poid);
  Set<Project> projects=new HashSet<Project>();
  if (checkSubProjects) {
    getSubProjects(project,projects);
  }
 else {
    projects.add(project);
  }
  Condition condition=new HasReferenceToInCondition(StorePackage.eINSTANCE.getCheckout_Project(),projects);
  Map<Long,Checkout> query=getDatabaseSession().query(condition,Checkout.class,Query.getDefault());
  return CollectionUtils.mapToList(query);
}
Program: 160569
Project: 160569
Buggy source:
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Revision revision=getRevisionByRoid(roid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getCheckout_Revision(),revision);
  return CollectionUtils.mapToList((Map<Long,Checkout>)getDatabaseSession().query(condition,Checkout.class,Query.getDefault()));
}

Fixed version (ground truth):
@Override public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Revision revision=getRevisionByRoid(roid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getCheckout_Revision(),revision);
  return CollectionUtils.mapToList(getDatabaseSession().query(condition,Checkout.class,Query.getDefault()));
}
Program: 160570
Project: 160570
Buggy source:
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Condition condition=new Not(new HasReferenceToCondition(StorePackage.eINSTANCE.getProject_HasAuthorizedUsers(),getUserByUoid(uoid))).and(new Not(new AttributeCondition(StorePackage.eINSTANCE.getProject_Name(),new StringLiteral(Database.STORE_PROJECT_NAME))));
  return CollectionUtils.mapToSet((Map<Long,Project>)getDatabaseSession().query(condition,Project.class,Query.getDefault()));
}

Fixed version (ground truth):
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Condition condition=new Not(new HasReferenceToCondition(StorePackage.eINSTANCE.getProject_HasAuthorizedUsers(),getUserByUoid(uoid))).and(new Not(new AttributeCondition(StorePackage.eINSTANCE.getProject_Name(),new StringLiteral(Database.STORE_PROJECT_NAME))));
  return CollectionUtils.mapToSet(getDatabaseSession().query(condition,Project.class,Query.getDefault()));
}
Program: 160571
Project: 160571
Buggy source:
@Override public Set<User> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Project project=getProjectByPoid(poid);
  if (project == null) {
    throw new UserException("String_Node_Str" + poid + "String_Node_Str");
  }
  Condition condition=new AndCondition(new AndCondition(new Not(new HasReferenceToCondition(StorePackage.eINSTANCE.getUser_HasRightsOn(),project)),new AttributeCondition(StorePackage.eINSTANCE.getUser_State(),new EnumLiteral(ObjectState.ACTIVE))),new Not(new AttributeCondition(StorePackage.eINSTANCE.getUser_UserType(),new EnumLiteral(UserType.SYSTEM))));
  return CollectionUtils.mapToSet((Map<Long,User>)getDatabaseSession().query(condition,User.class,Query.getDefault()));
}

Fixed version (ground truth):
@Override public Set<User> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  Project project=getProjectByPoid(poid);
  if (project == null) {
    throw new UserException("String_Node_Str" + poid + "String_Node_Str");
  }
  Condition condition=new AndCondition(new AndCondition(new Not(new HasReferenceToCondition(StorePackage.eINSTANCE.getUser_HasRightsOn(),project)),new AttributeCondition(StorePackage.eINSTANCE.getUser_State(),new EnumLiteral(ObjectState.ACTIVE))),new Not(new AttributeCondition(StorePackage.eINSTANCE.getUser_UserType(),new EnumLiteral(UserType.SYSTEM))));
  return CollectionUtils.mapToSet(getDatabaseSession().query(condition,User.class,Query.getDefault()));
}
Program: 160572
Project: 160572
Buggy source:
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(authorization.getUoid());
  Not notStoreProject=new Not(new AttributeCondition(StorePackage.eINSTANCE.getProject_Name(),new StringLiteral(Database.STORE_PROJECT_NAME)));
  HasReferenceToCondition authorized=new HasReferenceToCondition(StorePackage.eINSTANCE.getProject_HasAuthorizedUsers(),user);
  Condition condition=new IsOfTypeCondition(StorePackage.eINSTANCE.getProject()).and(notStoreProject);
  if (onlyActive) {
    condition=new AndCondition(condition,new AttributeCondition(StorePackage.eINSTANCE.getProject_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  if (user.getUserType() != UserType.ADMIN && user.getUserType() != UserType.SYSTEM) {
    condition=condition.and(authorized);
    condition=condition.and(new AttributeCondition(StorePackage.eINSTANCE.getProject_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  Map<Long,Project> results=(Map<Long,Project>)getDatabaseSession().query(condition,Project.class,Query.getDefault());
  Set<Project> resultSet=new HashSet<Project>();
  for (  Project p : results.values()) {
    if (p.getParent() == null || !onlyTopLevel) {
      resultSet.add(p);
    }
  }
  for (  Project project : results.values()) {
    addParentProjects(resultSet,project);
  }
  return resultSet;
}

Fixed version (ground truth):
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(authorization.getUoid());
  Not notStoreProject=new Not(new AttributeCondition(StorePackage.eINSTANCE.getProject_Name(),new StringLiteral(Database.STORE_PROJECT_NAME)));
  HasReferenceToCondition authorized=new HasReferenceToCondition(StorePackage.eINSTANCE.getProject_HasAuthorizedUsers(),user);
  Condition condition=new IsOfTypeCondition(StorePackage.eINSTANCE.getProject()).and(notStoreProject);
  if (onlyActive) {
    condition=new AndCondition(condition,new AttributeCondition(StorePackage.eINSTANCE.getProject_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  if (user.getUserType() != UserType.ADMIN && user.getUserType() != UserType.SYSTEM) {
    condition=condition.and(authorized);
    condition=condition.and(new AttributeCondition(StorePackage.eINSTANCE.getProject_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  Map<Long,Project> results=getDatabaseSession().query(condition,Project.class,Query.getDefault());
  Set<Project> resultSet=new HashSet<Project>();
  for (  Project p : results.values()) {
    if (p.getParent() == null || !onlyTopLevel) {
      resultSet.add(p);
    }
  }
  for (  Project project : results.values()) {
    addParentProjects(resultSet,project);
  }
  return resultSet;
}
Program: 160573
Project: 160573
Buggy source:
@Override public Set<Revision> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(uoid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getRevision_User(),user);
  return CollectionUtils.mapToSet((Map<Long,Revision>)getDatabaseSession().query(condition,Revision.class,Query.getDefault()));
}

Fixed version (ground truth):
@Override public Set<Revision> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(uoid);
  Condition condition=new HasReferenceToCondition(StorePackage.eINSTANCE.getRevision_User(),user);
  return CollectionUtils.mapToSet(getDatabaseSession().query(condition,Revision.class,Query.getDefault()));
}
Program: 160574
Project: 160574
Buggy source:
@Override public Set<User> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User actingUser=getUserByUoid(authorization.getUoid());
  Condition condition=new IsOfTypeCondition(StorePackage.eINSTANCE.getUser());
  condition=condition.and(new Not(new AttributeCondition(StorePackage.eINSTANCE.getUser_UserType(),new EnumLiteral(UserType.SYSTEM))));
  if (actingUser.getUserType() != UserType.ADMIN) {
    condition=condition.and(new AttributeCondition(StorePackage.eINSTANCE.getUser_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  return CollectionUtils.mapToSet((Map<Long,User>)getDatabaseSession().query(condition,User.class,Query.getDefault()));
}

Fixed version (ground truth):
@Override public Set<User> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User actingUser=getUserByUoid(authorization.getUoid());
  Condition condition=new IsOfTypeCondition(StorePackage.eINSTANCE.getUser());
  condition=condition.and(new Not(new AttributeCondition(StorePackage.eINSTANCE.getUser_UserType(),new EnumLiteral(UserType.SYSTEM))));
  if (actingUser.getUserType() != UserType.ADMIN) {
    condition=condition.and(new AttributeCondition(StorePackage.eINSTANCE.getUser_State(),new EnumLiteral(ObjectState.ACTIVE)));
  }
  return CollectionUtils.mapToSet(getDatabaseSession().query(condition,User.class,Query.getDefault()));
}
Program: 160576
Project: 160576
Buggy source:
@Override public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  RenderEnginePluginConfiguration oldRenderEngine=getDatabaseSession().get(StorePackage.eINSTANCE.getRenderEnginePluginConfiguration(),renderEngine.getOid(),Query.getDefault());
  if (oldRenderEngine.getEnabled() == true && renderEngine.getEnabled() == false && !renderEngine.getSerializers().isEmpty()) {
    throw new UserException("String_Node_Str");
  }
  return super.execute();
}

Fixed version (ground truth):
@Override public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  RenderEnginePluginConfiguration oldRenderEngine=getDatabaseSession().get(StorePackage.eINSTANCE.getRenderEnginePluginConfiguration(),renderEngine.getOid(),Query.getDefault());
  if (oldRenderEngine.getEnabled() && !renderEngine.getEnabled() && !renderEngine.getSerializers().isEmpty()) {
    throw new UserException("String_Node_Str");
  }
  return super.execute();
}
Program: 160577
Project: 160577
Buggy source:
@Override public SearchingRecordIterator getRecordIterator(String tableName,byte[] mustStartWith,byte[] startSearchingAt,DatabaseSession databaseSession) throws BimserverLockConflictException, BimserverDatabaseException {
  Cursor cursor=null;
  try {
    cursor=getDatabase(tableName).openCursor(getTransaction(databaseSession),cursorConfig);
    return new BerkeleySearchingRecordIterator(cursor,mustStartWith,startSearchingAt);
  }
 catch (  BimserverLockConflictException e) {
    try {
      cursor.close();
      throw e;
    }
 catch (    DatabaseException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
  }
catch (  DatabaseException e1) {
    LOGGER.error("String_Node_Str",e1);
  }
  return null;
}

Fixed version (ground truth):
@Override public SearchingRecordIterator getRecordIterator(String tableName,byte[] mustStartWith,byte[] startSearchingAt,DatabaseSession databaseSession) throws BimserverLockConflictException, BimserverDatabaseException {
  Cursor cursor=null;
  try {
    cursor=getDatabase(tableName).openCursor(getTransaction(databaseSession),cursorConfig);
    return new BerkeleySearchingRecordIterator(cursor,mustStartWith,startSearchingAt);
  }
 catch (  BimserverLockConflictException e) {
    if (cursor != null) {
      try {
        cursor.close();
        throw e;
      }
 catch (      DatabaseException e1) {
        LOGGER.error("String_Node_Str",e1);
      }
    }
  }
catch (  DatabaseException e1) {
    LOGGER.error("String_Node_Str",e1);
  }
  return null;
}
Program: 160578
Project: 160578
Buggy source:
@SuppressWarnings("String_Node_Str") private Migration getMigration(int number){
  String name="String_Node_Str" + StringUtils.leftPad("String_Node_Str" + number,4,"String_Node_Str");
  try {
    Class<Migration> migrationClass=(Class<Migration>)Class.forName(name);
    return (Migration)migrationClass.newInstance();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Migration getMigration(int number){
  String name="String_Node_Str" + StringUtils.leftPad("String_Node_Str" + number,4,"String_Node_Str");
  try {
    Class<Migration> migrationClass=(Class<Migration>)Class.forName(name);
    return migrationClass.newInstance();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    return null;
  }
}
Program: 160580
Project: 160580
Buggy source:
public synchronized void start(final LongAction<?> longAction) throws CannotBeScheduledException {
  if (running) {
    Thread thread=new Thread(new Runnable(){
      @Override public void run(){
        longAction.execute();
      }
    }
);
    longAction.init();
    thread.setDaemon(true);
    thread.setName(longAction.getDescription());
    actions.put(longAction.getProgressTopic().getKey().getId(),longAction);
    thread.start();
  }
 else {
    throw new CannotBeScheduledException();
  }
}

Fixed version (ground truth):
public synchronized void start(final LongAction<?> longAction) throws CannotBeScheduledException {
  if (running) {
    Thread thread=new Thread(new Runnable(){
      @Override public void run(){
        longAction.execute();
      }
    }
,"String_Node_Str");
    longAction.init();
    thread.setDaemon(true);
    thread.setName(longAction.getDescription());
    actions.put(longAction.getProgressTopic().getKey().getId(),longAction);
    thread.start();
  }
 else {
    throw new CannotBeScheduledException();
  }
}
Program: 160586
Project: 160586
Buggy source:
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",Math.round(100L * total.get() / totalSize));
  }
}

Fixed version (ground truth):
@Override public void objectAdded(){
  total.incrementAndGet();
  if (totalSize == 0) {
    setProgress("String_Node_Str",0);
  }
 else {
    setProgress("String_Node_Str",(int)Math.round(100.0 * total.get() / totalSize));
  }
}
Program: 160588
Project: 160588
Buggy source:
public boolean updateNeeded(){
  SVersion localVersion=getLocalVersion();
  SVersion onlineVersion=getOnlineVersion();
  if (localVersion.getMajor() < onlineVersion.getMajor()) {
    return true;
  }
 else   if (localVersion.getMajor() == onlineVersion.getMajor()) {
    if (localVersion.getMinor() < onlineVersion.getMinor()) {
      return true;
    }
 else     if (localVersion.getMinor() == onlineVersion.getMinor()) {
      if (onlineVersion.getRevision() != null && localVersion.getRevision() < onlineVersion.getRevision()) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean updateNeeded(){
  SVersion localVersion=getLocalVersion();
  SVersion onlineVersion=getOnlineVersion();
  if (localVersion.getMajor().compareTo(onlineVersion.getMajor()) < 0) {
    return true;
  }
 else   if (localVersion.getMajor() == onlineVersion.getMajor()) {
    if (localVersion.getMinor().compareTo(onlineVersion.getMinor()) > 0) {
      return true;
    }
 else     if (localVersion.getMinor().equals(onlineVersion.getMinor())) {
      if (onlineVersion.getRevision() != null && localVersion.getRevision() < onlineVersion.getRevision()) {
        return true;
      }
    }
  }
  return false;
}
Program: 160591
Project: 160591
Buggy source:
@Override public void run(){
  try {
    newRevisionHandler.newRevision(bimServerClient,poid,roid,service.getOid(),settings);
  }
 catch (  ServerException e) {
    LOGGER.error("String_Node_Str",e);
  }
catch (  UserException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    newRevisionHandler.newRevision(bimServerClient,poid,roid,internalServicePluginConfiguration.getOid(),settings);
  }
 catch (  ServerException e) {
    LOGGER.error("String_Node_Str",e);
  }
catch (  UserException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 160593
Project: 160593
Buggy source:
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(authorization.getUoid());
  IfcModelInterface projectsModel=getDatabaseSession().getAllOfType(StorePackage.eINSTANCE.getProject(),Query.getDefault());
  Set<Project> result=new HashSet<Project>();
  for (  IdEObject idEObject : projectsModel.getValues()) {
    if (idEObject instanceof Project) {
      Project project=(Project)idEObject;
      if ((user.getUserType() == UserType.ADMIN || (project.getState() == ObjectState.ACTIVE) && authorization.hasRightsOnProjectOrSuperProjects(user,project))) {
        result.add(project);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public Set<Project> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(authorization.getUoid());
  IfcModelInterface projectsModel=getDatabaseSession().getAllOfType(StorePackage.eINSTANCE.getProject(),Query.getDefault());
  Set<Project> result=new HashSet<Project>();
  for (  IdEObject idEObject : projectsModel.getValues()) {
    if (idEObject instanceof Project) {
      Project project=(Project)idEObject;
      if (!project.getName().equals("String_Node_Str")) {
        if ((user.getUserType() == UserType.ADMIN || (project.getState() == ObjectState.ACTIVE) && authorization.hasRightsOnProjectOrSuperProjects(user,project))) {
          result.add(project);
        }
      }
    }
  }
  return result;
}
Program: 160594
Project: 160594
Buggy source:
private void processMultiRequest(JsonArray requests,String jsonToken,HttpServletRequest httpRequest,JsonWriter out) throws Exception {
  out.name("String_Node_Str");
  out.beginArray();
  for (int r=0; r < requests.size(); r++) {
    processSingleRequest((JsonObject)requests.get(r),jsonToken,httpRequest,out);
  }
  out.endArray();
}

Fixed version (ground truth):
private void processMultiRequest(JsonArray requests,String jsonToken,HttpServletRequest httpRequest,JsonWriter out) throws Exception {
  out.name("String_Node_Str");
  out.beginArray();
  for (int r=0; r < requests.size(); r++) {
    try {
      processSingleRequest((JsonObject)requests.get(r),jsonToken,httpRequest,out);
    }
 catch (    Exception e) {
      handleException(out,e);
    }
  }
  out.endArray();
}
Program: 160597
Project: 160597
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Reference reAttach(IdEObject mainObject){
  List list=(List)getIdEObject().eGet(geteReference());
  list.remove(getReferredObject());
  list.add(mainObject);
  return new SingleReference(getIdEObject(),mainObject,geteReference());
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Reference reAttach(IdEObject mainObject){
  AbstractEList list=(AbstractEList)getIdEObject().eGet(geteReference());
  int index=list.indexOf(getReferredObject());
  list.set(index,mainObject);
  while (list.contains(getReferredObject())) {
    list.remove(getReferredObject());
  }
  return new MultiReference(getIdEObject(),mainObject,geteReference());
}
Program: 160599
Project: 160599
Buggy source:
private Map<String,List<IdEObject>> buildIdentifierMap(){
  Map<String,List<IdEObject>> map=new HashMap<String,List<IdEObject>>();
  for (  IfcModelInterface model : modelSet) {
    for (    IdEObject idEObject : model.getValues()) {
      if (idEObject instanceof IfcRoot) {
        IfcRoot ifcRoot=(IfcRoot)idEObject;
        String identifier=getIdentifier(idEObject);
        if (identifier != null) {
          if (!processedIdentifiers.contains(identifier)) {
            if (map.containsKey(identifier)) {
              if (map.get(identifier).get(0).eClass() != ifcRoot.eClass()) {
                LOGGER.info("String_Node_Str" + identifier + "String_Node_Str"+ map.get(identifier).get(0).eClass().getName()+ "String_Node_Str"+ ifcRoot.eClass().getName());
              }
 else {
                if (model.contains(ifcRoot)) {
                  map.get(identifier).add(ifcRoot);
                }
              }
            }
 else {
              if (model.contains(ifcRoot)) {
                List<IdEObject> list=new ArrayList<IdEObject>();
                list.add(ifcRoot);
                map.put(identifier,list);
              }
            }
          }
        }
      }
    }
  }
  return map;
}

Fixed version (ground truth):
private Map<String,List<IdEObject>> buildIdentifierMap(){
  Map<String,List<IdEObject>> map=new HashMap<String,List<IdEObject>>();
  for (  IdEObject idEObject : model.getValues()) {
    if (idEObject instanceof IfcRoot) {
      IfcRoot ifcRoot=(IfcRoot)idEObject;
      String identifier=getIdentifier(idEObject);
      if (identifier != null) {
        if (map.containsKey(identifier)) {
          if (map.get(identifier).get(0).eClass() != ifcRoot.eClass()) {
            LOGGER.info("String_Node_Str" + identifier + "String_Node_Str"+ map.get(identifier).get(0).eClass().getName()+ "String_Node_Str"+ ifcRoot.eClass().getName());
          }
 else {
            if (model.contains(ifcRoot)) {
              map.get(identifier).add(ifcRoot);
            }
          }
        }
 else {
          if (model.contains(ifcRoot)) {
            List<IdEObject> list=new ArrayList<IdEObject>();
            list.add(ifcRoot);
            map.put(identifier,list);
          }
        }
      }
    }
  }
  return map;
}
Program: 160600
Project: 160600
Buggy source:
private void removeReplaceLinks(IdEObject mainObject,IdEObject objectToRemove){
  if (mainObject.eClass() != objectToRemove.eClass()) {
    throw new RuntimeException("String_Node_Str");
  }
  Set<Reference> referencesTo=referenceCounter.getReferencesTo(objectToRemove);
  if (referencesTo != null) {
    Iterator<Reference> referenceIterator=referencesTo.iterator();
    Set<Reference> newReferences=new HashSet<Reference>();
    while (referenceIterator.hasNext()) {
      Reference reference=referenceIterator.next();
      newReferences.add(reference.reAttach(mainObject));
      referenceIterator.remove();
    }
    for (    Reference reference : newReferences) {
      referenceCounter.addReference(reference);
    }
  }
  model.remove(objectToRemove);
}

Fixed version (ground truth):
private void removeReplaceLinks(IdEObject mainObject,IdEObject objectToRemove){
  if (mainObject.eClass() != objectToRemove.eClass()) {
    throw new RuntimeException("String_Node_Str");
  }
  Set<Reference> referencesTo=referenceCounter.getReferencesTo(objectToRemove);
  if (referencesTo != null) {
    Iterator<Reference> referenceIterator=referencesTo.iterator();
    Set<Reference> newReferences=new HashSet<Reference>();
    while (referenceIterator.hasNext()) {
      Reference reference=referenceIterator.next();
      newReferences.add(reference.reAttach(mainObject));
      referenceIterator.remove();
    }
    for (    Reference reference : newReferences) {
      referenceCounter.addReference(reference);
    }
  }
  LOGGER.info("String_Node_Str" + objectToRemove);
  referenceCounter.remove(objectToRemove);
  model.remove(objectToRemove);
}
Program: 160601
Project: 160601
Buggy source:
public IfcModelInterface merge(Project project,IfcModelSet modelSet,ModelHelper modelHelper) throws MergeException {
  this.modelSet=modelSet;
  if (modelSet.size() == 1) {
    return modelSet.iterator().next();
  }
  modelSet.sortByDate();
  model=mergeScales(project,modelSet,modelHelper);
  LOGGER.info("String_Node_Str");
  referenceCounter=new ReferenceCounter(model);
  referenceCounter.updateReferences();
  Map<String,List<IdEObject>> identifierMap=buildIdentifierMap();
  cleanIdentifierMap(identifierMap);
  LOGGER.info("String_Node_Str" + model.size());
  return model;
}

Fixed version (ground truth):
public IfcModelInterface merge(Project project,IfcModelSet modelSet,ModelHelper modelHelper) throws MergeException {
  if (modelSet.size() == 1) {
    return modelSet.iterator().next();
  }
  modelSet.sortByDate();
  model=mergeScales(project,modelSet,modelHelper);
  LOGGER.info("String_Node_Str");
  referenceCounter=new ReferenceCounter(model);
  referenceCounter.updateReferences();
  Map<String,List<IdEObject>> identifierMap=buildIdentifierMap();
  cleanIdentifierMap(identifierMap);
  LOGGER.info("String_Node_Str" + model.size());
  return model;
}
Program: 160604
Project: 160604
Buggy source:
public SRemoteServiceCalled convertToSObject(RemoteServiceCalled input){
  if (input == null) {
    return null;
  }
  SRemoteServiceCalled result=new SRemoteServiceCalled();
  result.setOid(input.getOid());
  result.setRid(input.getRid());
  result.setDate(input.getDate());
  result.setAccessMethod(SAccessMethod.values()[input.getAccessMethod().ordinal()]);
  result.setState(SNotifictionResultEnum.values()[input.getState().ordinal()]);
  result.setPercentage(input.getPercentage());
  result.getInfos().addAll(input.getInfos());
  result.getWarnings().addAll(input.getWarnings());
  result.getErrors().addAll(input.getErrors());
  User executorVal=input.getExecutor();
  result.setExecutorId(executorVal == null ? -1 : executorVal.getOid());
  Service serviceVal=input.getService();
  result.setServiceId(serviceVal == null ? -1 : serviceVal.getOid());
  return result;
}

Fixed version (ground truth):
public SProjectSmall convertToSObject(ProjectSmall input){
  if (input == null) {
    return null;
  }
  SProjectSmall result=new SProjectSmall();
  result.setOid(input.getOid());
  result.setRid(input.getRid());
  result.setName(input.getName());
  result.setParentId(input.getParentId());
  return result;
}
Program: 160605
Project: 160605
Buggy source:
public RemoteServiceCalled convertFromSObject(SRemoteServiceCalled input,RemoteServiceCalled result,DatabaseSession session) throws BimserverDatabaseException {
  if (input == null) {
    return null;
  }
  result.setDate(input.getDate());
  result.setAccessMethod(AccessMethod.values()[input.getAccessMethod().ordinal()]);
  result.setState(NotifictionResultEnum.values()[input.getState().ordinal()]);
  result.setPercentage(input.getPercentage());
  result.getInfos().addAll(input.getInfos());
  result.getWarnings().addAll(input.getWarnings());
  result.getErrors().addAll(input.getErrors());
  result.setExecutor((User)session.get(StorePackage.eINSTANCE.getUser(),input.getExecutorId(),Query.getDefault()));
  result.setService((Service)session.get(StorePackage.eINSTANCE.getService(),input.getServiceId(),Query.getDefault()));
  return result;
}

Fixed version (ground truth):
public ProjectSmall convertFromSObject(SProjectSmall input,ProjectSmall result,DatabaseSession session) throws BimserverDatabaseException {
  if (input == null) {
    return null;
  }
  result.setName(input.getName());
  result.setParentId(input.getParentId());
  return result;
}
Program: 160606
Project: 160606
Buggy source:
public static void loadPlugins(PluginManager pluginManager) throws PluginException {
  pluginManager.loadAllPluginsFromEclipseWorkspace(new File("String_Node_Str"));
  File gitDirectory=new File("String_Node_Str");
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
}

Fixed version (ground truth):
public static void loadPlugins(PluginManager pluginManager) throws PluginException {
  pluginManager.loadAllPluginsFromEclipseWorkspace(new File("String_Node_Str"));
  File gitDirectory=new File("String_Node_Str");
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
  pluginManager.loadPluginsFromEclipseProjectNoExceptions(new File(gitDirectory,"String_Node_Str"));
}
Program: 160608
Project: 160608
Buggy source:
@Override public void execute(int pid,int rid,DatabaseSession databaseSession,Map<Long,IdEObject> created) throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  EClass eClass=databaseSession.getEClassForName(type);
  if (eClass == null) {
    throw new UserException("String_Node_Str" + type + "String_Node_Str");
  }
  eObject=(IdEObjectImpl)eClass.getEPackage().getEFactoryInstance().create(eClass);
  eObject.setOid(oid);
  eObject.setPid(pid);
  eObject.setRid(rid);
  databaseSession.store(eObject,pid,rid);
  created.put(oid,eObject);
}

Fixed version (ground truth):
@Override public void execute(int pid,int rid,DatabaseSession databaseSession,Map<Long,IdEObject> created) throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  EClass eClass=databaseSession.getEClassForName(type);
  if (eClass == null) {
    throw new UserException("String_Node_Str" + type + "String_Node_Str");
  }
  eObject=(IdEObjectImpl)eClass.getEPackage().getEFactoryInstance().create(eClass);
  eObject.setOid(oid);
  eObject.setPid(pid);
  eObject.setRid(rid);
  ((IdEObjectImpl)eObject).setLoaded();
  databaseSession.store(eObject,pid,rid);
  created.put(oid,eObject);
}
Program: 160609
Project: 160609
Buggy source:
public long store(IdEObject object,int pid,int rid) throws BimserverDatabaseException {
  checkOpen();
  if (!objectsToCommit.containsObject(object)) {
    if (object.getOid() == -1) {
      long newOid=newOid(object.eClass());
      ((IdEObjectImpl)object).setOid(newOid);
    }
    object.load();
    ((IdEObjectImpl)object).setPid(pid);
    if (rid == Integer.MAX_VALUE) {
      ((IdEObjectImpl)object).setRid(object.getRid() + 1);
    }
 else {
      ((IdEObjectImpl)object).setRid(rid);
    }
    addToObjectsToCommit(object);
  }
  return object.getOid();
}

Fixed version (ground truth):
public long store(IdEObject object,int pid,int rid) throws BimserverDatabaseException {
  checkOpen();
  if (!objectsToCommit.containsObject(object)) {
    objectCache.put(new RecordIdentifier(pid,object.getOid(),rid),object);
    boolean wrappedValue=Ifc2x3tc1Package.eINSTANCE.getWrappedValue().isSuperTypeOf(object.eClass());
    if (!wrappedValue) {
      if (object.getOid() == -1) {
        long newOid=newOid(object.eClass());
        ((IdEObjectImpl)object).setOid(newOid);
      }
      object.load();
      ((IdEObjectImpl)object).setPid(pid);
      if (rid == Integer.MAX_VALUE) {
        ((IdEObjectImpl)object).setRid(object.getRid() + 1);
      }
 else {
        ((IdEObjectImpl)object).setRid(rid);
      }
      addToObjectsToCommit(object);
    }
  }
  return object.getOid();
}
Program: 160610
Project: 160610
Buggy source:
private Schema upgrade(DatabaseSession databaseSession,int applicationSchemaVersion,int databaseSchemaVersion) throws MigrationException, InconsistentModelsException {
  Schema schema=new Schema();
  for (int i=0; i <= applicationSchemaVersion; i++) {
    Migration migration=getMigration(i);
    if (migration != null) {
      migration.migrate(schema);
      if (i > databaseSchemaVersion) {
        schema.upgradeDatabase(database,i,databaseSession);
      }
      schema.clearUpdates();
    }
 else {
      throw new MigrationException("String_Node_Str" + i);
    }
  }
  return schema;
}

Fixed version (ground truth):
private Schema upgrade(DatabaseSession databaseSession,int applicationSchemaVersion,int databaseSchemaVersion) throws MigrationException, InconsistentModelsException {
  Schema schema=new Schema();
  for (int i=0; i <= applicationSchemaVersion; i++) {
    Migration migration=getMigration(i);
    if (migration != null) {
      migration.migrate(schema);
      if (i > databaseSchemaVersion) {
        schema.upgradeDatabase(database,i,databaseSession);
      }
      schema.clearUpdates();
    }
 else {
      throw new MigrationException("String_Node_Str" + i);
    }
  }
  Schema emfSchema=new Schema();
  emfSchema.addEPackage(StorePackage.eINSTANCE);
  emfSchema.addEPackage(LogPackage.eINSTANCE);
  emfSchema.addEPackage(Ifc2x3tc1Package.eINSTANCE);
  return schema;
}