Program: 160584
Project: 160584
Buggy source:
@Override public void registerInternalNewRevisionHandler(ServiceDescriptor serviceDescriptor,final NewRevisionHandler newRevisionHandler){
  register(serviceDescriptor,new Bimsie1RemoteServiceInterfaceAdaptor(){
    @Override public void newRevision(    final Long poid,    final Long roid,    Long soid,    String serviceIdentifier,    String profileIdentifier,    final String userToken,    String token,    String apiUrl) throws UserException, ServerException {
      ServiceMapInterface serviceMapInterface=new ServiceMap(bimServer,null,AccessMethod.JSON);
      serviceMapInterface.add(Bimsie1RemoteServiceInterface.class,internalRemoteServiceInterfaces.get(serviceIdentifier));
      final InternalChannel internalChannel=new InternalChannel(bimServer.getServiceFactory(),bimServer.getServicesMap());
      try {
        internalChannel.connect(new SimpleTokenHolder());
      }
 catch (      ChannelConnectionException e) {
        LOGGER.error("String_Node_Str",e);
      }
      try {
        DatabaseSession session=bimServer.getDatabase().createSession();
        try {
          long profileId=Long.parseLong(profileIdentifier);
          EClass eClassForOid=session.getEClassForOid(profileId);
          InternalServicePluginConfiguration internalServicePluginConfiguration=null;
          if (eClassForOid == StorePackage.eINSTANCE.getInternalServicePluginConfiguration()) {
            internalServicePluginConfiguration=session.get(profileId,Query.getDefault());
          }
 else           if (eClassForOid == StorePackage.eINSTANCE.getService()) {
            Service service=session.get(profileId,Query.getDefault());
            internalServicePluginConfiguration=service.getInternalService();
          }
          final SObjectType settings=bimServer.getSConverter().convertToSObject(internalServicePluginConfiguration.getSettings());
          final InternalServicePluginConfiguration finalInternalServicePluginConfiguration=internalServicePluginConfiguration;
          BimServerClientInterface bimServerClient=null;
          if (apiUrl == null) {
            bimServerClient=bimServer.getBimServerClientFactory().create(new TokenAuthentication(token));
          }
 else {
            bimServerClient=new JsonBimServerClientFactory(apiUrl).create(new TokenAuthentication(token));
          }
          final BimServerClientInterface finalClient=bimServerClient;
          new Thread(){
            @Override public void run(){
              try {
                newRevisionHandler.newRevision(finalClient,poid,roid,userToken,finalInternalServicePluginConfiguration.getOid(),settings);
              }
 catch (              ServerException e) {
                LOGGER.error("String_Node_Str",e);
              }
catch (              UserException e) {
                LOGGER.error("String_Node_Str",e);
              }
            }
          }
.start();
        }
  finally {
          session.close();
        }
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void registerInternalNewRevisionHandler(ServiceDescriptor serviceDescriptor,final NewRevisionHandler newRevisionHandler){
  register(serviceDescriptor,new Bimsie1RemoteServiceInterfaceAdaptor(){
    @Override public void newRevision(    final Long poid,    final Long roid,    Long soid,    String serviceIdentifier,    String profileIdentifier,    final String userToken,    String token,    String apiUrl) throws UserException, ServerException {
      ServiceMapInterface serviceMapInterface=new ServiceMap(bimServer,null,AccessMethod.JSON);
      serviceMapInterface.add(Bimsie1RemoteServiceInterface.class,internalRemoteServiceInterfaces.get(serviceIdentifier));
      final InternalChannel internalChannel=new InternalChannel(bimServer.getServiceFactory(),bimServer.getServicesMap());
      try {
        internalChannel.connect(new SimpleTokenHolder());
      }
 catch (      ChannelConnectionException e) {
        LOGGER.error("String_Node_Str",e);
      }
      try {
        DatabaseSession session=bimServer.getDatabase().createSession();
        try {
          long profileId=Long.parseLong(profileIdentifier);
          EClass eClassForOid=session.getEClassForOid(profileId);
          InternalServicePluginConfiguration internalServicePluginConfiguration=null;
          if (eClassForOid == StorePackage.eINSTANCE.getInternalServicePluginConfiguration()) {
            internalServicePluginConfiguration=session.get(profileId,Query.getDefault());
          }
 else           if (eClassForOid == StorePackage.eINSTANCE.getService()) {
            Service service=session.get(profileId,Query.getDefault());
            internalServicePluginConfiguration=service.getInternalService();
          }
 else {
            throw new RuntimeException("String_Node_Str");
          }
          final SObjectType settings=bimServer.getSConverter().convertToSObject(internalServicePluginConfiguration.getSettings());
          final InternalServicePluginConfiguration finalInternalServicePluginConfiguration=internalServicePluginConfiguration;
          BimServerClientInterface bimServerClient=null;
          if (apiUrl == null) {
            bimServerClient=bimServer.getBimServerClientFactory().create(new TokenAuthentication(token));
          }
 else {
            bimServerClient=new JsonBimServerClientFactory(apiUrl).create(new TokenAuthentication(token));
          }
          final BimServerClientInterface finalClient=bimServerClient;
          new Thread(){
            @Override public void run(){
              try {
                newRevisionHandler.newRevision(finalClient,poid,roid,userToken,finalInternalServicePluginConfiguration.getOid(),settings);
              }
 catch (              ServerException e) {
                LOGGER.error("String_Node_Str",e);
              }
catch (              UserException e) {
                LOGGER.error("String_Node_Str",e);
              }
            }
          }
.start();
        }
  finally {
          session.close();
        }
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
  }
);
}