Program: 48202
Project: 48202
Buggy source:
@Override public synchronized boolean createResource(final ResourceConfiguration resConfig){
  assertNotClosed();
  boolean returnVal=true;
  final Path path=mDBConfig.getFile().resolve(DatabaseConfiguration.DatabasePaths.DATA.getFile()).resolve(resConfig.mPath);
  if (Files.exists(path)) {
    return false;
  }
 else {
    try {
      Files.createDirectory(path);
    }
 catch (    UnsupportedOperationException|IOException|SecurityException e) {
      returnVal=false;
    }
    if (returnVal) {
      try {
        for (        final ResourceConfiguration.ResourcePaths resourcePath : ResourceConfiguration.ResourcePaths.values()) {
          final Path toCreate=path.resolve(resourcePath.getFile());
          if (resourcePath.isFolder()) {
            Files.createDirectory(toCreate);
          }
 else {
            Files.createFile(toCreate);
          }
          if (!returnVal)           break;
        }
      }
 catch (      UnsupportedOperationException|IOException|SecurityException e) {
        returnVal=false;
      }
    }
  }
  if (returnVal) {
    mResourceID.set(mDBConfig.getMaxResourceID());
    ResourceConfiguration.serialize(resConfig.setID(mResourceID.getAndIncrement()));
    mDBConfig.setMaximumResourceID(mResourceID.get());
    mResources.forcePut(mResourceID.get(),resConfig.getResource().getFileName().toString());
    try {
      try (final ResourceManager resourceTrxManager=this.getResourceManager(resConfig.getResource().getFileName().toString());final XdmNodeWriteTrx wtx=resourceTrxManager.beginNodeWriteTrx()){
        wtx.commit();
      }
     }
 catch (    final SirixException e) {
      LOGWRAPPER.error(e.getMessage(),e);
      returnVal=false;
    }
  }
  if (!returnVal) {
    SirixFiles.recursiveRemove(resConfig.mPath);
  }
  return returnVal;
}

Fixed version (ground truth):
@Override public synchronized boolean createResource(final ResourceConfiguration resConfig){
  assertNotClosed();
  boolean returnVal=true;
  final Path path=mDBConfig.getFile().resolve(DatabaseConfiguration.DatabasePaths.DATA.getFile()).resolve(resConfig.mPath);
  if (Files.exists(path)) {
    return false;
  }
 else {
    try {
      Files.createDirectory(path);
    }
 catch (    UnsupportedOperationException|IOException|SecurityException e) {
      returnVal=false;
    }
    if (returnVal) {
      try {
        for (        final ResourceConfiguration.ResourcePaths resourcePath : ResourceConfiguration.ResourcePaths.values()) {
          final Path toCreate=path.resolve(resourcePath.getPath());
          if (resourcePath.isFolder()) {
            Files.createDirectory(toCreate);
          }
 else {
            Files.createFile(toCreate);
          }
          if (!returnVal)           break;
        }
      }
 catch (      UnsupportedOperationException|IOException|SecurityException e) {
        returnVal=false;
      }
    }
  }
  if (returnVal) {
    mResourceID.set(mDBConfig.getMaxResourceID());
    ResourceConfiguration.serialize(resConfig.setID(mResourceID.getAndIncrement()));
    mDBConfig.setMaximumResourceID(mResourceID.get());
    mResources.forcePut(mResourceID.get(),resConfig.getResource().getFileName().toString());
    try {
      try (final ResourceManager resourceTrxManager=this.getResourceManager(resConfig.getResource().getFileName().toString());final XdmNodeWriteTrx wtx=resourceTrxManager.beginNodeWriteTrx()){
        wtx.commit();
      }
     }
 catch (    final SirixException e) {
      LOGWRAPPER.error(e.getMessage(),e);
      returnVal=false;
    }
  }
  if (!returnVal) {
    SirixFiles.recursiveRemove(resConfig.mPath);
  }
  return returnVal;
}