Program: 113599
Project: 113599
Buggy source:
@Override public void startRequest(MRCRequest rq) throws Throwable {
  try {
    final xtreemfs_restore_databaseRequest rqArgs=(xtreemfs_restore_databaseRequest)rq.getRequestArgs();
    if (master.getConfig().getAdminPassword() != null && !master.getConfig().getAdminPassword().equals(rq.getDetails().password))     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    final VolumeManager vMan=master.getVolumeManager();
    if (vMan.getStorageManagers().size() != 0)     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    SAXParserFactory spf=SAXParserFactory.newInstance();
    SAXParser sp=spf.newSAXParser();
    sp.parse(new File(rqArgs.getDump_file()),new DefaultHandler(){
      private DBRestoreState state;
      private int dbVersion=1;
      public void startElement(      String uri,      String localName,      String qName,      Attributes attributes) throws SAXException {
        try {
          if (qName.equals("String_Node_Str")) {
            state=new DBRestoreState();
            state.currentVolumeId=attributes.getValue(attributes.getIndex("String_Node_Str"));
            state.currentVolumeName=attributes.getValue(attributes.getIndex("String_Node_Str"));
            state.currentVolumeACPolicy=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
          }
 else           if (qName.equals("String_Node_Str"))           try {
            dbVersion=Integer.parseInt(attributes.getValue(attributes.getIndex("String_Node_Str")));
          }
 catch (          Exception exc) {
            Logging.logMessage(Logging.LEVEL_WARN,Category.db,this,"String_Node_Str");
          }
 else           handleNestedElement(qName,attributes,true);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.db,this,"String_Node_Str");
          Logging.logUserError(Logging.LEVEL_ERROR,Category.db,this,exc);
          throw new SAXException(exc);
        }
      }
      public void endElement(      String uri,      String localName,      String qName) throws SAXException {
        try {
          if (qName.equals("String_Node_Str") || qName.equals("String_Node_Str"))           return;
          handleNestedElement(qName,null,false);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.db,this,"String_Node_Str");
          Logging.logUserError(Logging.LEVEL_ERROR,Category.db,this,exc);
          throw new SAXException(exc);
        }
      }
      private void handleNestedElement(      String qName,      Attributes attributes,      boolean openTag) throws UserException, DatabaseException {
        if (qName.equals("String_Node_Str")) {
          StorageManager sMan=vMan.getStorageManager(state.currentVolumeId);
          AtomicDBUpdate update=sMan.createAtomicDBUpdate(null,null);
          sMan.setLastFileId(state.largestFileId,update);
          update.execute();
          state.largestFileId=0;
        }
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreDir(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreFile(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreXLocList(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreXLoc(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreOSD(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreACL(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreEntry(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equals("String_Node_Str"))         DBAdminHelper.restoreAttr(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
      }
    }
);
    rq.setResponse(new xtreemfs_restore_databaseResponse());
    finishRequest(rq);
  }
 catch (  SAXException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getException().getMessage() == null ? "String_Node_Str" : exc.getException().getMessage(),exc.getException()));
  }
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq) throws Throwable {
  try {
    final xtreemfs_restore_databaseRequest rqArgs=(xtreemfs_restore_databaseRequest)rq.getRequestArgs();
    if (master.getConfig().getAdminPassword() != null && !master.getConfig().getAdminPassword().equals(rq.getDetails().password))     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    final VolumeManager vMan=master.getVolumeManager();
    if (vMan.getStorageManagers().size() != 0)     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    SAXParserFactory spf=SAXParserFactory.newInstance();
    SAXParser sp=spf.newSAXParser();
    sp.parse(new File(rqArgs.getDump_file()),new DefaultHandler(){
      private DBRestoreState state;
      private int dbVersion=1;
      public void startElement(      String uri,      String localName,      String qName,      Attributes attributes) throws SAXException {
        try {
          if (qName.equals("String_Node_Str")) {
            state=new DBRestoreState();
            state.currentVolumeId=attributes.getValue(attributes.getIndex("String_Node_Str"));
            state.currentVolumeName=attributes.getValue(attributes.getIndex("String_Node_Str"));
            state.currentVolumeACPolicy=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
          }
 else           if (qName.equals("String_Node_Str"))           try {
            dbVersion=Integer.parseInt(attributes.getValue(attributes.getIndex("String_Node_Str")));
          }
 catch (          Exception exc) {
            Logging.logMessage(Logging.LEVEL_WARN,Category.db,this,"String_Node_Str");
          }
 else           handleNestedElement(qName,attributes,true);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.db,this,"String_Node_Str");
          Logging.logUserError(Logging.LEVEL_ERROR,Category.db,this,exc);
          throw new SAXException(exc);
        }
      }
      public void endElement(      String uri,      String localName,      String qName) throws SAXException {
        try {
          if (qName.equals("String_Node_Str") || qName.equals("String_Node_Str"))           return;
          handleNestedElement(qName,null,false);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.db,this,"String_Node_Str");
          Logging.logUserError(Logging.LEVEL_ERROR,Category.db,this,exc);
          throw new SAXException(exc);
        }
      }
      private void handleNestedElement(      String qName,      Attributes attributes,      boolean openTag) throws UserException, DatabaseException {
        if (qName.equalsIgnoreCase("String_Node_Str")) {
          StorageManager sMan=vMan.getStorageManager(state.currentVolumeId);
          AtomicDBUpdate update=sMan.createAtomicDBUpdate(null,null);
          sMan.setLastFileId(state.largestFileId,update);
          update.execute();
          state.largestFileId=0;
        }
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreDir(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreFile(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreXLocList(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreXLoc(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreOSD(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreACL(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreEntry(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
 else         if (qName.equalsIgnoreCase("String_Node_Str"))         DBAdminHelper.restoreAttr(vMan,master.getFileAccessManager(),attributes,state,dbVersion,openTag);
      }
    }
);
    rq.setResponse(new xtreemfs_restore_databaseResponse());
    finishRequest(rq);
  }
 catch (  SAXException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getException().getMessage() == null ? "String_Node_Str" : exc.getException().getMessage(),exc.getException()));
  }
}