nus-yam/ex-repair huggingface dataset:
Program: 160303
Project: 160303
Buggy source:
public void testReplicatorErrorStatus() throws Exception {
  Map<String,Object> facebookTokenInfo=new HashMap<String,Object>();
  facebookTokenInfo.put("String_Node_Str","String_Node_Str");
  facebookTokenInfo.put("String_Node_Str",getReplicationURL().toExternalForm());
  facebookTokenInfo.put("String_Node_Str","String_Node_Str");
  String destUrl=String.format("String_Node_Str",DEFAULT_TEST_DB);
  Map<String,Object> result=(Map<String,Object>)sendBody("String_Node_Str",destUrl,facebookTokenInfo,Status.OK,null);
  Log.v(TAG,String.format("String_Node_Str",result));
  Map<String,Object> properties=getPullReplicationParsedJson();
  Replication replicator=manager.getReplicator(properties);
  replicator.start();
  boolean foundError=false;
  for (int i=0; i < 10; i++) {
    Thread.sleep(5 * 1000);
    ArrayList<Object> activeTasks=(ArrayList<Object>)send("String_Node_Str","String_Node_Str",Status.OK,null);
    Log.d(TAG,"String_Node_Str" + activeTasks);
    Map<String,Object> activeTaskReplication=(Map<String,Object>)activeTasks.get(0);
    foundError=(activeTaskReplication.get("String_Node_Str") != null);
    if (foundError == true) {
      break;
    }
  }
  assertTrue(foundError);
}

Fixed version (ground truth):
public void testReplicatorErrorStatus() throws Exception {
  Map<String,Object> facebookTokenInfo=new HashMap<String,Object>();
  facebookTokenInfo.put("String_Node_Str","String_Node_Str");
  facebookTokenInfo.put("String_Node_Str",getReplicationURL().toExternalForm());
  facebookTokenInfo.put("String_Node_Str","String_Node_Str");
  String destUrl=String.format("String_Node_Str",DEFAULT_TEST_DB);
  Map<String,Object> result=(Map<String,Object>)sendBody("String_Node_Str",destUrl,facebookTokenInfo,Status.OK,null);
  Log.v(TAG,String.format("String_Node_Str",result));
  Map<String,Object> properties=getPullReplicationParsedJson();
  Replication replicator=manager.getReplicator(properties);
  runReplication(replicator);
  assertNotNull(replicator.getLastError());
  assertTrue(replicator.getLastError() instanceof HttpResponseException);
  assertEquals(401,((HttpResponseException)replicator.getLastError()).getStatusCode());
}
Program: 160306
Project: 160306
Buggy source:
static Document createDocumentWithProperties(Database db,Map<String,Object> properties){
  Document doc=db.createDocument();
  Assert.assertNotNull(doc);
  Assert.assertNull(doc.getCurrentRevisionId());
  Assert.assertNull(doc.getCurrentRevision());
  Assert.assertNotNull("String_Node_Str",doc.getId());
  try {
    doc.putProperties(properties);
  }
 catch (  Exception e) {
    assertTrue("String_Node_Str" + db.getName() + "String_Node_Str"+ properties.toString(),false);
  }
  Assert.assertNotNull(doc.getId());
  Assert.assertNotNull(doc.getCurrentRevisionId());
  Assert.assertNotNull(doc.getUserProperties());
  Assert.assertEquals(db.getDocument(doc.getId()),doc);
  return doc;
}

Fixed version (ground truth):
static Document createDocumentWithProperties(Database db,Map<String,Object> properties){
  Document doc=db.createDocument();
  Assert.assertNotNull(doc);
  Assert.assertNull(doc.getCurrentRevisionId());
  Assert.assertNull(doc.getCurrentRevision());
  Assert.assertNotNull("String_Node_Str",doc.getId());
  try {
    doc.putProperties(properties);
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str",e);
    assertTrue("String_Node_Str" + db.getName() + "String_Node_Str"+ properties.toString(),false);
  }
  Assert.assertNotNull(doc.getId());
  Assert.assertNotNull(doc.getCurrentRevisionId());
  Assert.assertNotNull(doc.getUserProperties());
  Assert.assertEquals(db.getDocument(doc.getId()),doc);
  return doc;
}
Program: 160307
Project: 160307
Buggy source:
@Override public void changed(Database.ChangeEvent event){
  List<DocumentChange> changes=event.getChanges();
  for (  DocumentChange change : changes) {
    RevisionInternal rev=change.getRevisionInternal();
    assertNotNull(rev);
    assertNotNull(rev.getDocId());
    assertNotNull(rev.getRevId());
    assertEquals(rev.getDocId(),rev.getProperties().get("String_Node_Str"));
    assertEquals(rev.getRevId(),rev.getProperties().get("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void changed(Database.ChangeEvent event){
  List<DocumentChange> changes=event.getChanges();
  for (  DocumentChange change : changes) {
    RevisionInternal rev=change.getAddedRevision();
    assertNotNull(rev);
    assertNotNull(rev.getDocId());
    assertNotNull(rev.getRevId());
    assertEquals(rev.getDocId(),rev.getProperties().get("String_Node_Str"));
    assertEquals(rev.getRevId(),rev.getProperties().get("String_Node_Str"));
  }
}
Program: 160311
Project: 160311
Buggy source:
@Override protected void onPostExecute(Object o){
  StatusLine statusLine=(StatusLine)o;
  Assert.assertEquals(HttpStatus.SC_NOT_FOUND,statusLine.getStatusCode());
}

Fixed version (ground truth):
@Override protected void onPostExecute(Object o){
  Log.d(TAG,"String_Node_Str" + o);
  StatusLine statusLine=(StatusLine)o;
  Assert.assertEquals(HttpStatus.SC_NOT_FOUND,statusLine.getStatusCode());
}
Program: 160313
Project: 160313
Buggy source:
public void testChangeTrackerLongPoll() throws Throwable {
}

Fixed version (ground truth):
public void testChangeTrackerLongPoll() throws Throwable {
  URL testURL=getReplicationURL();
  CBLChangeTrackerClient client=new CBLChangeTrackerClient(){
    @Override public void changeTrackerStopped(    CBLChangeTracker tracker){
      Log.v(TAG,"String_Node_Str");
    }
    @Override public void changeTrackerReceivedChange(    Map<String,Object> change){
      Object seq=change.get("String_Node_Str");
      Log.v(TAG,"String_Node_Str" + seq.toString());
    }
    @Override public HttpClient getHttpClient(){
      return new DefaultHttpClient();
    }
  }
;
  final CBLChangeTracker changeTracker=new CBLChangeTracker(testURL,TDChangeTrackerMode.LongPoll,0,client,null);
  runTestOnUiThread(new Runnable(){
    @Override public void run(){
      changeTracker.start();
    }
  }
);
  Thread.sleep(10 * 1000);
}
Program: 160314
Project: 160314
Buggy source:
public void testChangeTrackerContinuous() throws Throwable {
}

Fixed version (ground truth):
public void testChangeTrackerContinuous() throws Throwable {
  URL testURL=getReplicationURL();
  CBLChangeTrackerClient client=new CBLChangeTrackerClient(){
    @Override public void changeTrackerStopped(    CBLChangeTracker tracker){
      Log.v(TAG,"String_Node_Str");
    }
    @Override public void changeTrackerReceivedChange(    Map<String,Object> change){
      Object seq=change.get("String_Node_Str");
      Log.v(TAG,"String_Node_Str" + seq.toString());
    }
    @Override public HttpClient getHttpClient(){
      return new DefaultHttpClient();
    }
  }
;
  final CBLChangeTracker changeTracker=new CBLChangeTracker(testURL,TDChangeTrackerMode.Continuous,0,client,null);
  runTestOnUiThread(new Runnable(){
    @Override public void run(){
      changeTracker.start();
    }
  }
);
  Thread.sleep(10 * 1000);
}
Program: 160315
Project: 160315
Buggy source:
public void testChangeTracker() throws Throwable {
}

Fixed version (ground truth):
public void testChangeTracker() throws Throwable {
  URL testURL=getReplicationURL();
  CBLChangeTrackerClient client=new CBLChangeTrackerClient(){
    @Override public void changeTrackerStopped(    CBLChangeTracker tracker){
      Log.v(TAG,"String_Node_Str");
    }
    @Override public void changeTrackerReceivedChange(    Map<String,Object> change){
      Object seq=change.get("String_Node_Str");
      Log.v(TAG,"String_Node_Str" + seq.toString());
    }
    @Override public HttpClient getHttpClient(){
      return new DefaultHttpClient();
    }
  }
;
  final CBLChangeTracker changeTracker=new CBLChangeTracker(testURL,TDChangeTrackerMode.OneShot,0,client,null);
  runTestOnUiThread(new Runnable(){
    @Override public void run(){
      changeTracker.start();
    }
  }
);
  while (changeTracker.isRunning()) {
    Thread.sleep(1000);
  }
}
Program: 160316
Project: 160316
Buggy source:
public void testChangeTrackerWithFilterURL() throws Throwable {
}

Fixed version (ground truth):
public void testChangeTrackerWithFilterURL() throws Throwable {
  URL testURL=getReplicationURL();
  CBLChangeTracker changeTracker=new CBLChangeTracker(testURL,TDChangeTrackerMode.Continuous,0,null,null);
  changeTracker.setFilterName("String_Node_Str");
  Map<String,Object> filterMap=new HashMap<String,Object>();
  filterMap.put("String_Node_Str","String_Node_Str");
  changeTracker.setFilterParams(filterMap);
  Assert.assertEquals("String_Node_Str",changeTracker.getChangesFeedPath());
}
Program: 160317
Project: 160317
Buggy source:
public void testStreamAttachmentBlobStoreWriter(){
  try {
    CBLBlobStore attachments=database.getAttachments();
    CBLBlobStoreWriter blobWriter=new CBLBlobStoreWriter(attachments);
    String testBlob="String_Node_Str";
    blobWriter.appendData(new String(testBlob).getBytes());
    blobWriter.finish();
    String sha1Base64Digest="String_Node_Str";
    Assert.assertEquals(blobWriter.sHA1DigestString(),sha1Base64Digest);
    Assert.assertEquals(blobWriter.mD5DigestString(),"String_Node_Str");
    blobWriter.install();
    CBLBlobKey blobKey=new CBLBlobKey(sha1Base64Digest);
    byte[] blob=attachments.blobForKey(blobKey);
    Assert.assertTrue(Arrays.equals(testBlob.getBytes(Charset.forName("String_Node_Str")),blob));
  }
 catch (  IOException e) {
    Assert.assertTrue(e.getMessage(),false);
  }
}

Fixed version (ground truth):
public void testStreamAttachmentBlobStoreWriter(){
  CBLBlobStore attachments=database.getAttachments();
  CBLBlobStoreWriter blobWriter=new CBLBlobStoreWriter(attachments);
  String testBlob="String_Node_Str";
  blobWriter.appendData(new String(testBlob).getBytes());
  blobWriter.finish();
  String sha1Base64Digest="String_Node_Str";
  Assert.assertEquals(blobWriter.sHA1DigestString(),sha1Base64Digest);
  Assert.assertEquals(blobWriter.mD5DigestString(),"String_Node_Str");
  blobWriter.install();
  CBLBlobKey blobKey=new CBLBlobKey(sha1Base64Digest);
  byte[] blob=attachments.blobForKey(blobKey);
  Assert.assertTrue(Arrays.equals(testBlob.getBytes(Charset.forName("String_Node_Str")),blob));
}
Program: 160318
Project: 160318
Buggy source:
public void testForceInsertEmptyHistory(){
  List<String> revHistory=null;
  CBLRevision rev=new CBLRevision("String_Node_Str","String_Node_Str",false);
  CBLStatus status=database.forceInsert(rev,revHistory,null);
  Assert.assertEquals(201,status.getCode());
}

Fixed version (ground truth):
public void testForceInsertEmptyHistory(){
  List<String> revHistory=null;
  CBLRevision rev=new CBLRevision("String_Node_Str","String_Node_Str",false);
  Map<String,Object> revProperties=new HashMap<String,Object>();
  revProperties.put("String_Node_Str",rev.getDocId());
  revProperties.put("String_Node_Str",rev.getRevId());
  revProperties.put("String_Node_Str","String_Node_Str");
  rev.setProperties(revProperties);
  CBLStatus status=database.forceInsert(rev,revHistory,null);
  Assert.assertEquals(201,status.getCode());
}
Program: 160320
Project: 160320
Buggy source:
public IsAProviderDecider(Set<String> qualifierAnnotations,List<PsiType> typeParameters){
  this.qualifierAnnotations=qualifierAnnotations;
  this.typeParameters=typeParameters;
}

Fixed version (ground truth):
public IsAProviderDecider(PsiElement element){
  this.qualifierAnnotations=PsiConsultantImpl.getQualifierAnnotations(element);
  this.typeParameters=PsiConsultantImpl.getTypeParameters(element);
}
Program: 160321
Project: 160321
Buggy source:
public ConstructorParameterInjectDecider(PsiParameter psiParameter){
  super(PsiConsultantImpl.getQualifierAnnotations(psiParameter),PsiConsultantImpl.getTypeParameters(psiParameter));
}

Fixed version (ground truth):
public ConstructorParameterInjectDecider(PsiParameter psiParameter){
  super(psiParameter);
}
Program: 160322
Project: 160322
Buggy source:
public FieldInjectDecider(PsiField psiField){
  super(PsiConsultantImpl.getQualifierAnnotations(psiField),PsiConsultantImpl.getTypeParameters(psiField));
}

Fixed version (ground truth):
public FieldInjectDecider(PsiField psiField){
  super(psiField);
}
Program: 160323
Project: 160323
Buggy source:
/** 
 * Check the element. If the element is a PsiMethod, than we want to know if it's a Constructor annotated w/ @Inject. If element is a field, than we only want to see if it is annotated with @Inject.
 * @return a {@link com.intellij.codeInsight.daemon.GutterIconNavigationHandler} for theappropriate type, or null if we don't care about it.
 */
@Nullable @Override public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element){
  if (element instanceof PsiMethod) {
    PsiMethod methodElement=(PsiMethod)element;
    if (methodElement.isConstructor() && PsiConsultantImpl.hasAnnotation(element,CLASS_INJECT)) {
      PsiIdentifier nameIdentifier=methodElement.getNameIdentifier();
      if (nameIdentifier != null) {
        return new LineMarkerInfo<PsiElement>(element,nameIdentifier.getTextRange(),ICON,UPDATE_ALL,null,new ConstructorInjectToProvidesHandler(),LEFT);
      }
    }
  }
 else   if (element instanceof PsiField) {
    PsiField fieldElement=(PsiField)element;
    PsiTypeElement typeElement=fieldElement.getTypeElement();
    if (PsiConsultantImpl.hasAnnotation(element,CLASS_INJECT) && typeElement != null) {
      return new LineMarkerInfo<PsiElement>(element,typeElement.getTextRange(),ICON,UPDATE_ALL,null,new FieldInjectToProvidesHandler(),LEFT);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Check the element. If the element is a PsiMethod, than we want to know if it's a Constructor annotated w/ @Inject. If element is a field, than we only want to see if it is annotated with @Inject.
 * @return a {@link com.intellij.codeInsight.daemon.GutterIconNavigationHandler} for theappropriate type, or null if we don't care about it.
 */
@Nullable @Override public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element){
  if (element instanceof PsiMethod) {
    PsiMethod methodElement=(PsiMethod)element;
    if (methodElement.isConstructor() && PsiConsultantImpl.hasAnnotation(element,CLASS_INJECT) && methodElement.getParameterList().getParametersCount() > 0) {
      PsiIdentifier nameIdentifier=methodElement.getNameIdentifier();
      if (nameIdentifier != null) {
        return new LineMarkerInfo<PsiElement>(element,nameIdentifier.getTextRange(),ICON,UPDATE_ALL,null,new ConstructorInjectToProvidesHandler(),LEFT);
      }
    }
    if (!methodElement.isConstructor() && PsiConsultantImpl.hasAnnotation(element,CLASS_PROVIDES) && methodElement.getParameterList().getParametersCount() > 0) {
      PsiIdentifier nameIdentifier=methodElement.getNameIdentifier();
      if (nameIdentifier != null) {
        return new LineMarkerInfo<PsiElement>(element,nameIdentifier.getTextRange(),ICON,UPDATE_ALL,null,new ConstructorInjectToProvidesHandler(),LEFT);
      }
    }
  }
 else   if (element instanceof PsiField) {
    PsiField fieldElement=(PsiField)element;
    PsiTypeElement typeElement=fieldElement.getTypeElement();
    if (PsiConsultantImpl.hasAnnotation(element,CLASS_INJECT) && typeElement != null) {
      return new LineMarkerInfo<PsiElement>(element,typeElement.getTextRange(),ICON,UPDATE_ALL,null,new FieldInjectToProvidesHandler(),LEFT);
    }
  }
  return null;
}
Program: 160324
Project: 160324
Buggy source:
@Override public void navigate(final MouseEvent mouseEvent,PsiElement psiElement){
  if (!(psiElement instanceof PsiMethod)) {
    throw new IllegalStateException("String_Node_Str" + psiElement);
  }
  PsiMethod psiMethod=(PsiMethod)psiElement;
  if (!psiMethod.isConstructor()) {
    throw new IllegalStateException("String_Node_Str" + psiElement);
  }
  PsiParameter[] parameters=psiMethod.getParameterList().getParameters();
  if (parameters.length == 1) {
    showUsages(mouseEvent,parameters[0]);
  }
 else {
    new PickTypeAction().startPickTypes(new RelativePoint(mouseEvent),parameters,new PickTypeAction.Callback(){
      @Override public void onParameterChosen(      PsiParameter selected){
        showUsages(mouseEvent,selected);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void navigate(final MouseEvent mouseEvent,PsiElement psiElement){
  if (!(psiElement instanceof PsiMethod)) {
    throw new IllegalStateException("String_Node_Str" + psiElement);
  }
  PsiMethod psiMethod=(PsiMethod)psiElement;
  PsiParameter[] parameters=psiMethod.getParameterList().getParameters();
  if (parameters.length == 1) {
    showUsages(mouseEvent,parameters[0]);
  }
 else {
    new PickTypeAction().startPickTypes(new RelativePoint(mouseEvent),parameters,new PickTypeAction.Callback(){
      @Override public void onParameterChosen(      PsiParameter selected){
        showUsages(mouseEvent,selected);
      }
    }
);
  }
}
Program: 160325
Project: 160325
Buggy source:
private void showUsages(MouseEvent mouseEvent,PsiParameter psiParameter){
  new ShowUsagesAction(new Decider.ConstructorParameterInjectDecider(psiParameter)).startFindUsages(PsiConsultantImpl.checkForLazyOrProvider(psiParameter),new RelativePoint(mouseEvent),PsiUtilBase.findEditor(psiParameter),MAX_USAGES);
}

Fixed version (ground truth):
private void showUsages(MouseEvent mouseEvent,PsiParameter psiParameter){
  if (navigateToConstructorIfProvider(psiParameter)) {
    return;
  }
  new ShowUsagesAction(new Decider.ConstructorParameterInjectDecider(psiParameter)).startFindUsages(PsiConsultantImpl.checkForLazyOrProvider(psiParameter),new RelativePoint(mouseEvent),PsiUtilBase.findEditor(psiParameter),MAX_USAGES);
}
Program: 160326
Project: 160326
Buggy source:
@Override @Nullable protected PsiElement getPsiElementForHint(Object selectedValue){
  if (selectedValue instanceof UsageNode) {
    final Usage usage=((UsageNode)selectedValue).getUsage();
    if (usage instanceof UsageInfo2UsageAdapter) {
      final PsiElement element=((UsageInfo2UsageAdapter)usage).getElement();
      if (element != null) {
        final PsiElement view=UsageToPsiElementProvider.findAppropriateParentFrom(element);
        return view == null ? element : view;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable protected PsiElement getPsiElementForHint(Object selectedValue){
  if (selectedValue instanceof UsageNode) {
    final Usage usage=((UsageNode)selectedValue).getUsage();
    if (usage instanceof UsageInfo2UsageAdapter) {
      final PsiElement element=((UsageInfo2UsageAdapter)usage).getElement();
      if (element != null) {
        final PsiElement view=UsageToPsiElementProvider.findAppropriateParentFrom(element);
        return view == null ? element : view;
      }
    }
  }
  return null;
}
Program: 160327
Project: 160327
Buggy source:
private void initIndirectSubClasses(EClass eClass){
  HashSet<EClass> set=new HashSet<EClass>();
  indirectSubClasses.put(eClass,set);
  set.add(eClass);
  for (  EClassifier eClassifier : eClass.getEPackage().getEClassifiers()) {
    if (eClassifier instanceof EClass) {
      EClass e=(EClass)eClassifier;
      if (eClass.isSuperTypeOf(e)) {
        set.add(e);
      }
    }
  }
}

Fixed version (ground truth):
private Set<EClass> initIndirectSubClasses(EClass eClass){
  HashSet<EClass> set=new HashSet<EClass>();
  indirectSubClasses.put(eClass,set);
  set.add(eClass);
  for (  EClassifier eClassifier : eClass.getEPackage().getEClassifiers()) {
    if (eClassifier instanceof EClass) {
      EClass e=(EClass)eClassifier;
      if (eClass.isSuperTypeOf(e)) {
        set.add(e);
      }
    }
  }
  return set;
}
Program: 160328
Project: 160328
Buggy source:
public Set<EClass> getSubClasses(EClass eClass){
  return indirectSubClasses.get(eClass);
}

Fixed version (ground truth):
public Set<EClass> getSubClasses(EClass eClass){
  Set<EClass> set=indirectSubClasses.get(eClass);
  if (set == null) {
    return initIndirectSubClasses(eClass);
  }
  return set;
}
Program: 160329
Project: 160329
Buggy source:
public QueryOidsAndTypesStackFrame(QueryObjectProvider queryObjectProvider,EClass eClass,QueryPart queryPart,QueryContext reusable,List<Long> oids) throws BimserverLockConflictException, BimserverDatabaseException, QueryException {
  super(reusable,queryObjectProvider,queryPart);
  this.eClass=eClass;
  String tableName=eClass.getEPackage().getName() + "String_Node_Str" + eClass.getName();
  if (getReusable().getOidCounters() != null) {
    if (!getReusable().getOidCounters().containsKey(eClass)) {
      return;
    }
    long startOid=getReusable().getOidCounters().get(eClass) + 1;
    oidIterator=oids.iterator();
    long firstOid=oidIterator.next();
    if (firstOid >= startOid) {
      startOid=firstOid;
    }
 else {
    }
    ByteBuffer tmp=ByteBuffer.allocate(12);
    tmp.putInt(getReusable().getPid());
    tmp.putLong(startOid);
    typeRecordIterator=queryObjectProvider.getDatabaseSession().getKeyValueStore().getRecordIterator(tableName,BinUtils.intToByteArray(getReusable().getPid()),tmp.array(),queryObjectProvider.getDatabaseSession());
    record=typeRecordIterator.next();
  }
 else {
    oidIterator=oids.iterator();
    typeRecordIterator=queryObjectProvider.getDatabaseSession().getKeyValueStore().getRecordIterator(tableName,BinUtils.intToByteArray(getReusable().getPid()),BinUtils.intToByteArray(getReusable().getPid()),queryObjectProvider.getDatabaseSession());
    record=typeRecordIterator.next();
  }
}

Fixed version (ground truth):
public QueryOidsAndTypesStackFrame(QueryObjectProvider queryObjectProvider,EClass eClass,QueryPart queryPart,QueryContext reusable,List<Long> oids) throws BimserverLockConflictException, BimserverDatabaseException, QueryException {
  super(reusable,queryObjectProvider,queryPart);
  this.eClass=eClass;
  String tableName=eClass.getEPackage().getName() + "String_Node_Str" + eClass.getName();
  if (getReusable().getOidCounters() != null) {
    if (!getReusable().getOidCounters().containsKey(eClass)) {
      return;
    }
    long startOid=getReusable().getOidCounters().get(eClass);
    oidIterator=oids.iterator();
    long firstOid=oidIterator.next();
    if (firstOid >= startOid) {
      startOid=firstOid;
    }
 else {
    }
    ByteBuffer tmp=ByteBuffer.allocate(12);
    tmp.putInt(getReusable().getPid());
    tmp.putLong(startOid);
    typeRecordIterator=queryObjectProvider.getDatabaseSession().getKeyValueStore().getRecordIterator(tableName,BinUtils.intToByteArray(getReusable().getPid()),tmp.array(),queryObjectProvider.getDatabaseSession());
    record=typeRecordIterator.next();
  }
 else {
    oidIterator=oids.iterator();
    typeRecordIterator=queryObjectProvider.getDatabaseSession().getKeyValueStore().getRecordIterator(tableName,BinUtils.intToByteArray(getReusable().getPid()),BinUtils.intToByteArray(getReusable().getPid()),queryObjectProvider.getDatabaseSession());
    record=typeRecordIterator.next();
  }
}
Program: 160332
Project: 160332
Buggy source:
@Override public void align4() throws IOException {
  int extra=4 - (growingByteBuffer.position() % 4);
  if (extra > 0 && extra != 8) {
    growingByteBuffer.ensureExtraCapacity(extra);
    dataOutputStream.write(new byte[extra]);
  }
}

Fixed version (ground truth):
@Override public void align4() throws IOException {
  int extra=4 - (growingByteBuffer.position() % 4);
  if (extra > 0 && extra != 4) {
    growingByteBuffer.ensureExtraCapacity(extra);
    dataOutputStream.write(new byte[extra]);
  }
}
Program: 160333
Project: 160333
Buggy source:
@Override public void align4() throws IOException {
  int extra=4 - (bytesWritten % 4);
  if (extra > 0 && extra != 8) {
    write(new byte[extra]);
  }
}

Fixed version (ground truth):
@Override public void align4() throws IOException {
  int extra=4 - (bytesWritten % 4);
  if (extra > 0 && extra != 4) {
    write(new byte[extra]);
  }
}
Program: 160334
Project: 160334
Buggy source:
@Override public Long addNewServiceToProject(Long poid,SNewService sService,SAction sAction) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    Action action=null;
    if (sAction instanceof SCheckinRevision) {
      action=(Action)session.create(StorePackage.eINSTANCE.getCheckinRevision());
    }
 else     if (sAction instanceof SStoreExtendedData) {
      action=(Action)session.create(StorePackage.eINSTANCE.getStoreExtendedData());
    }
    getBimServer().getSConverter().convertFromSObject(sAction,action,session);
    NewService service=(NewService)session.create(StorePackage.eINSTANCE.getNewService());
    getBimServer().getSConverter().convertFromSObject(sService,service,session);
    AddNewServiceToProjectDatabaseAction dbAction=new AddNewServiceToProjectDatabaseAction(session,getInternalAccessMethod(),poid,service,action,getAuthorization());
    return session.executeAndCommitAction(dbAction);
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public Long addNewServiceToProject(Long poid,SNewService sService,SAction sAction) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    NewService service=(NewService)session.create(StorePackage.eINSTANCE.getNewService());
    getBimServer().getSConverter().convertFromSObject(sService,service,session);
    AddNewServiceToProjectDatabaseAction dbAction=new AddNewServiceToProjectDatabaseAction(session,getInternalAccessMethod(),poid,service,service.getAction(),getAuthorization());
    return session.executeAndCommitAction(dbAction);
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160336
Project: 160336
Buggy source:
@Override public void writeUTF(String str) throws IOException {
  outputStream.write(str.getBytes(Charsets.UTF_8));
}

Fixed version (ground truth):
@Override public void writeUTF(String str) throws IOException {
  new DataOutputStream(outputStream).writeUTF(str);
}
Program: 160337
Project: 160337
Buggy source:
public GenerateGeometryResult(){
  min=new double[3];
  max=new double[3];
}

Fixed version (ground truth):
public GenerateGeometryResult(){
  min=new double[]{Double.MAX_VALUE,Double.MAX_VALUE,Double.MAX_VALUE};
  max=new double[]{-Double.MAX_VALUE,-Double.MAX_VALUE,-Double.MAX_VALUE};
}
Program: 160338
Project: 160338
Buggy source:
private void fixInverses(PackageMetaData packageMetaData,long newRoid,Map<Long,HashMapVirtualObject> cache,HashMapVirtualObject next,EReference eReference,long refOid) throws JsonParseException, JsonMappingException, IOException, QueryException, BimserverDatabaseException {
  HashMapVirtualObject referencedObject=cache.get(refOid);
  if (referencedObject == null) {
    referencedObject=getByOid(packageMetaData,getDatabaseSession(),newRoid,refOid);
    cache.put(refOid,referencedObject);
  }
  EReference oppositeReference=packageMetaData.getInverseOrOpposite(referencedObject.eClass(),eReference);
  if (oppositeReference == null) {
    if (eReference.getName().equals("String_Node_Str") && referencedObject.eClass().getName().equals("String_Node_Str")) {
    }
 else {
      LOGGER.error("String_Node_Str" + eReference.getName() + "String_Node_Str");
    }
  }
 else {
    if (oppositeReference.isMany()) {
      Object existingList=referencedObject.eGet(oppositeReference);
      if (existingList != null) {
        int currentSize=((List<?>)existingList).size();
        referencedObject.setListItemReference(oppositeReference,currentSize,next.eClass(),next.getOid(),0);
      }
 else {
        referencedObject.setListItemReference(oppositeReference,0,next.eClass(),next.getOid(),0);
      }
    }
 else {
      referencedObject.setReference(oppositeReference,next.getOid(),0);
    }
  }
}

Fixed version (ground truth):
private void fixInverses(PackageMetaData packageMetaData,long newRoid,Map<Long,HashMapVirtualObject> cache,HashMapVirtualObject next,EReference eReference,long refOid) throws JsonParseException, JsonMappingException, IOException, QueryException, BimserverDatabaseException {
  HashMapVirtualObject referencedObject=cache.get(refOid);
  if (referencedObject == null) {
    referencedObject=getByOid(packageMetaData,getDatabaseSession(),newRoid,refOid);
    cache.put(refOid,referencedObject);
  }
  EReference oppositeReference=packageMetaData.getInverseOrOpposite(referencedObject.eClass(),eReference);
  if (oppositeReference == null) {
    if (eReference.getName().equals("String_Node_Str") && referencedObject.eClass().getName().equals("String_Node_Str")) {
    }
 else {
    }
  }
 else {
    if (oppositeReference.isMany()) {
      Object existingList=referencedObject.eGet(oppositeReference);
      if (existingList != null) {
        int currentSize=((List<?>)existingList).size();
        referencedObject.setListItemReference(oppositeReference,currentSize,next.eClass(),next.getOid(),0);
      }
 else {
        referencedObject.setListItemReference(oppositeReference,0,next.eClass(),next.getOid(),0);
      }
    }
 else {
      referencedObject.setReference(oppositeReference,next.getOid(),0);
    }
  }
}
Program: 160339
Project: 160339
Buggy source:
private void processDownload(Long download) throws UserException, ServerException, PublicInterfaceNotFoundException, IfcModelInterfaceException, IOException {
  InputStream downloadData=bimServerClient.getDownloadData(download,getJsonSerializerOid());
  try {
    new SharedJsonDeserializer(true).read(downloadData,this,false);
  }
 catch (  DeserializeException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    if (downloadData != null) {
      downloadData.close();
    }
  }
}

Fixed version (ground truth):
private void processDownload(Long download) throws UserException, ServerException, PublicInterfaceNotFoundException, IfcModelInterfaceException, IOException {
  InputStream downloadData=bimServerClient.getDownloadData(download,getJsonSerializerOid());
  if (downloadData == null) {
    throw new IfcModelInterfaceException("String_Node_Str");
  }
  try {
    new SharedJsonDeserializer(true).read(downloadData,this,false);
  }
 catch (  DeserializeException e) {
    throw new IfcModelInterfaceException(e);
  }
 finally {
    if (downloadData != null) {
      downloadData.close();
    }
  }
}
Program: 160340
Project: 160340
Buggy source:
public IfcModelInterfaceException(String message){
  super(message);
}

Fixed version (ground truth):
public IfcModelInterfaceException(Exception e){
  super(e);
}
Program: 160342
Project: 160342
Buggy source:
@Override public InputStream getInputStream() throws IOException {
  return null;
}

Fixed version (ground truth):
@Override public InputStream getInputStream() throws IOException {
  return serializer.getInputStream();
}
Program: 160346
Project: 160346
Buggy source:
public long register(EndPoint endPoint){
  long id=idCounter.incrementAndGet();
  endPoints.put(id,endPoint);
  return id;
}

Fixed version (ground truth):
public long register(EndPoint endPoint){
  long id=idCounter.incrementAndGet();
  endPoints.forcePut(id,endPoint);
  return id;
}
Program: 160347
Project: 160347
Buggy source:
public void ensureExtraCapacity(int nrExtraBytes){
  if (byteBuffer.capacity() <= byteBuffer.position() + nrExtraBytes) {
    ByteBuffer oldBuffer=byteBuffer;
    byteBuffer=ByteBuffer.allocate(oldBuffer.position() * 2);
    int oldPos=oldBuffer.position();
    oldBuffer.position(0);
    byteBuffer.put(oldBuffer.array(),0,oldPos);
  }
}

Fixed version (ground truth):
public void ensureExtraCapacity(int nrExtraBytes){
  if (byteBuffer.capacity() <= byteBuffer.position() + nrExtraBytes) {
    ByteBuffer oldBuffer=byteBuffer;
    byteBuffer=ByteBuffer.allocate(Math.max(oldBuffer.position() * 2,byteBuffer.position() + nrExtraBytes));
    int oldPos=oldBuffer.position();
    oldBuffer.position(0);
    byteBuffer.put(oldBuffer.array(),0,oldPos);
    byteBuffer.position(oldPos);
  }
}
Program: 160349
Project: 160349
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("String_Node_Str") public PluginBundleVersion getInstalledVersion(){
  return (PluginBundleVersion)eGet(StorePackage.Literals.PLUGIN_BUNDLE__INSTALLED_VERSION,true);
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public PluginBundleVersion getInstalledVersion(){
  return (PluginBundleVersion)eGet(StorePackage.Literals.PLUGIN_BUNDLE__INSTALLED_VERSION,true);
}
Program: 160351
Project: 160351
Buggy source:
private Type cloneAndAdd(DatabaseSession session,Type input) throws BimserverDatabaseException {
  if (input instanceof BooleanType) {
    BooleanType booleanType=session.create(BooleanType.class);
    booleanType.setValue(((BooleanType)input).isValue());
    session.store(booleanType);
    return booleanType;
  }
 else   if (input instanceof StringType) {
    StringType stringType=session.create(StringType.class);
    stringType.setValue(((StringType)input).getValue());
    session.store(stringType);
    return stringType;
  }
 else   if (input instanceof DoubleType) {
    DoubleType doubleType=session.create(DoubleType.class);
    doubleType.setValue(((DoubleType)input).getValue());
    session.store(doubleType);
    return doubleType;
  }
 else   if (input instanceof LongType) {
    LongType longType=session.create(LongType.class);
    longType.setValue(((LongType)input).getValue());
    session.store(longType);
    return longType;
  }
  return null;
}

Fixed version (ground truth):
public Type cloneAndAdd(DatabaseSession session,Type input) throws BimserverDatabaseException {
  if (input instanceof BooleanType) {
    BooleanType booleanType=session.create(BooleanType.class);
    booleanType.setValue(((BooleanType)input).isValue());
    session.store(booleanType);
    return booleanType;
  }
 else   if (input instanceof StringType) {
    StringType stringType=session.create(StringType.class);
    stringType.setValue(((StringType)input).getValue());
    session.store(stringType);
    return stringType;
  }
 else   if (input instanceof DoubleType) {
    DoubleType doubleType=session.create(DoubleType.class);
    doubleType.setValue(((DoubleType)input).getValue());
    session.store(doubleType);
    return doubleType;
  }
 else   if (input instanceof LongType) {
    LongType longType=session.create(LongType.class);
    longType.setValue(((LongType)input).getValue());
    session.store(longType);
    return longType;
  }
  return null;
}
Program: 160354
Project: 160354
Buggy source:
private ObjectType convertSettings(DatabaseSession session,Plugin plugin) throws BimserverDatabaseException {
  ObjectType settings=session.create(ObjectType.class);
  ObjectDefinition settingsDefinition=plugin.getSettingsDefinition();
  if (plugin.getSettingsDefinition() != null) {
    for (    ParameterDefinition parameterDefinition : settingsDefinition.getParameters()) {
      Parameter parameter=session.create(Parameter.class);
      parameter.setName(parameterDefinition.getName());
      parameter.setIdentifier(parameterDefinition.getIdentifier());
      if (parameterDefinition.getDefaultValue() != null) {
        Type value=cloneAndAdd(session,parameterDefinition.getDefaultValue());
        parameter.setValue(value);
      }
      settings.getParameters().add(parameter);
    }
  }
  return settings;
}

Fixed version (ground truth):
public ObjectType convertSettings(DatabaseSession session,Plugin plugin) throws BimserverDatabaseException {
  ObjectType settings=session.create(ObjectType.class);
  ObjectDefinition settingsDefinition=plugin.getSettingsDefinition();
  if (plugin.getSettingsDefinition() != null) {
    for (    ParameterDefinition parameterDefinition : settingsDefinition.getParameters()) {
      Parameter parameter=session.create(Parameter.class);
      parameter.setName(parameterDefinition.getName());
      parameter.setIdentifier(parameterDefinition.getIdentifier());
      if (parameterDefinition.getDefaultValue() != null) {
        Type value=cloneAndAdd(session,parameterDefinition.getDefaultValue());
        parameter.setValue(value);
      }
      settings.getParameters().add(parameter);
    }
  }
  return settings;
}
Program: 160356
Project: 160356
Buggy source:
public AddInternalServiceDatabaseAction(DatabaseSession databaseSession,AccessMethod accessMethod,Authorization authorization,InternalServicePluginConfiguration eService){
  super(databaseSession,accessMethod,eService);
  this.authorization=authorization;
}

Fixed version (ground truth):
public AddInternalServiceDatabaseAction(BimServer bimServer,DatabaseSession databaseSession,AccessMethod accessMethod,Authorization authorization,InternalServicePluginConfiguration eService){
  super(databaseSession,accessMethod,eService);
  this.bimServer=bimServer;
  this.authorization=authorization;
}
Program: 160357
Project: 160357
Buggy source:
@Override public Long execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getDatabaseSession().get(StorePackage.eINSTANCE.getUser(),authorization.getUoid(),OldQuery.getDefault());
  user.getUserSettings().getServices().add(getIdEObject());
  getDatabaseSession().store(user.getUserSettings());
  return super.execute();
}

Fixed version (ground truth):
@Override public Long execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getDatabaseSession().get(StorePackage.eINSTANCE.getUser(),authorization.getUoid(),OldQuery.getDefault());
  InternalServicePluginConfiguration idEObject=getIdEObject();
  idEObject.setUserSettings(user.getUserSettings());
  Plugin plugin=bimServer.getPluginManager().getPlugin(idEObject.getPluginDescriptor().getIdentifier(),true);
  ObjectType settings=bimServer.convertSettings(getDatabaseSession(),plugin);
  user.getUserSettings().getServices().add(idEObject);
  idEObject.setSettings(settings);
  getDatabaseSession().store(user.getUserSettings());
  return super.execute();
}
Program: 160358
Project: 160358
Buggy source:
@Override public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
  PluginConfiguration pluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getPluginConfiguration(),oid,OldQuery.getDefault());
  UserSettings settings=(UserSettings)pluginConfiguration.eGet(pluginConfiguration.eClass().getEStructuralFeature("String_Node_Str"));
  settings.getSerializers().remove(pluginConfiguration);
  getDatabaseSession().store(settings);
  pluginConfiguration.remove();
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
  PluginConfiguration pluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getPluginConfiguration(),oid,OldQuery.getDefault());
  UserSettings settings=(UserSettings)pluginConfiguration.eGet(pluginConfiguration.eClass().getEStructuralFeature("String_Node_Str"));
  if (settings == null) {
    throw new UserException("String_Node_Str");
  }
  for (  EReference eReference : settings.eClass().getEAllReferences()) {
    if (eReference.getEType() == pluginConfiguration.eClass() && eReference.isMany()) {
      List list=(List)settings.eGet(eReference);
      list.remove(pluginConfiguration);
    }
  }
  getDatabaseSession().store(settings);
  pluginConfiguration.remove();
  return null;
}
Program: 160359
Project: 160359
Buggy source:
@Override public void addRenderEngine(SRenderEnginePluginConfiguration renderEngine) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    RenderEnginePluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(renderEngine,session);
    session.executeAndCommitAction(new AddRenderEngineDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public Long addRenderEngine(SRenderEnginePluginConfiguration renderEngine) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    RenderEnginePluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(renderEngine,session);
    return session.executeAndCommitAction(new AddRenderEngineDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160360
Project: 160360
Buggy source:
@Override public void setPluginSettings(Long poid,SObjectType settings) throws ServerException, UserException {
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    ObjectType convertedSettings=getBimServer().getSConverter().convertFromSObject(settings,session);
    SetPluginSettingsDatabaseAction action=new SetPluginSettingsDatabaseAction(session,getInternalAccessMethod(),poid,convertedSettings);
    session.executeAndCommitAction(action);
  }
 catch (  Exception e) {
    handleException(e);
  }
 finally {
    session.close();
  }
  session=getBimServer().getDatabase().createSession();
  try {
    PluginConfiguration pluginConfiguration=session.get(StorePackage.eINSTANCE.getPluginConfiguration(),poid,OldQuery.getDefault());
    ServicePlugin servicePlugin=getBimServer().getPluginManager().getServicePlugin(pluginConfiguration.getPluginDescriptor().getPluginClassName(),true);
    SInternalServicePluginConfiguration sInternalService=(SInternalServicePluginConfiguration)getBimServer().getSConverter().convertToSObject(pluginConfiguration);
    servicePlugin.unregister(sInternalService);
    servicePlugin.register(getAuthorization().getUoid(),sInternalService,new org.bimserver.plugins.PluginConfiguration(settings));
  }
 catch (  BimserverDatabaseException e) {
    handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public void setPluginSettings(Long poid,SObjectType settings) throws ServerException, UserException {
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    ObjectType convertedSettings=getBimServer().getSConverter().convertFromSObject(settings,session);
    SetPluginSettingsDatabaseAction action=new SetPluginSettingsDatabaseAction(session,getInternalAccessMethod(),poid,convertedSettings);
    session.executeAndCommitAction(action);
  }
 catch (  Exception e) {
    handleException(e);
  }
 finally {
    session.close();
  }
  session=getBimServer().getDatabase().createSession();
  try {
    PluginConfiguration pluginConfiguration=session.get(StorePackage.eINSTANCE.getPluginConfiguration(),poid,OldQuery.getDefault());
    if (pluginConfiguration instanceof InternalServicePluginConfiguration) {
      ServicePlugin servicePlugin=getBimServer().getPluginManager().getServicePlugin(pluginConfiguration.getPluginDescriptor().getPluginClassName(),true);
      SInternalServicePluginConfiguration sInternalService=(SInternalServicePluginConfiguration)getBimServer().getSConverter().convertToSObject(pluginConfiguration);
      servicePlugin.unregister(sInternalService);
      servicePlugin.register(getAuthorization().getUoid(),sInternalService,new org.bimserver.plugins.PluginConfiguration(settings));
    }
  }
 catch (  BimserverDatabaseException e) {
    handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160361
Project: 160361
Buggy source:
@Override public void addSerializer(SSerializerPluginConfiguration serializer) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    SerializerPluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(serializer,session);
    session.executeAndCommitAction(new AddSerializerDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public Long addSerializer(SSerializerPluginConfiguration serializer) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    SerializerPluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(serializer,session);
    return session.executeAndCommitAction(new AddSerializerDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160362
Project: 160362
Buggy source:
@Override public SInternalServicePluginConfiguration getInternalServiceById(Long oid) throws ServerException, UserException {
  requireAuthenticationAndRunningServer();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    SInternalServicePluginConfiguration convertToSObject=getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetByIdDatabaseAction<InternalServicePluginConfiguration>(session,getInternalAccessMethod(),oid,StorePackage.eINSTANCE.getInternalServicePluginConfiguration())));
    return convertToSObject;
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public SInternalServicePluginConfiguration getInternalServiceById(Long oid) throws ServerException, UserException {
  requireAuthenticationAndRunningServer();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    InternalServicePluginConfiguration internalPlugin=session.executeAndCommitAction(new GetByIdDatabaseAction<InternalServicePluginConfiguration>(session,getInternalAccessMethod(),oid,StorePackage.eINSTANCE.getInternalServicePluginConfiguration()));
    if (internalPlugin == null) {
      throw new UserException("String_Node_Str" + oid);
    }
    SInternalServicePluginConfiguration convertToSObject=getBimServer().getSConverter().convertToSObject(internalPlugin);
    return convertToSObject;
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160363
Project: 160363
Buggy source:
@Override public List<SPluginDescriptor> getAllServicePluginDescriptors() throws ServerException, UserException {
  requireRealUserAuthentication();
  return getBimServer().getSerializerFactory().getAllServicePluginDescriptors();
}

Fixed version (ground truth):
@Override public List<SPluginDescriptor> getAllServicePluginDescriptors() throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    return session.executeAndCommitAction(new GetAllPluginDescriptorsDatabaseAction(session,getInternalAccessMethod(),getBimServer(),ServicePlugin.class.getName()));
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}
Program: 160364
Project: 160364
Buggy source:
@Override public void addModelCompare(SModelComparePluginConfiguration modelCompare) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    ModelComparePluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(modelCompare,session);
    session.executeAndCommitAction(new AddModelCompareDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    handleException(e);
  }
 finally {
    session.close();
  }
}

Fixed version (ground truth):
@Override public Long addModelCompare(SModelComparePluginConfiguration modelCompare) throws ServerException, UserException {
  requireRealUserAuthentication();
  DatabaseSession session=getBimServer().getDatabase().createSession();
  try {
    ModelComparePluginConfiguration convert=getBimServer().getSConverter().convertFromSObject(modelCompare,session);
    return session.executeAndCommitAction(new AddModelCompareDatabaseAction(session,getInternalAccessMethod(),getAuthorization(),convert));
  }
 catch (  Exception e) {
    return handleException(e);
  }
 finally {
    session.close();
  }
}