Program: 113718
Project: 113718
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    final xtreemfs_restore_databaseRequest rqArgs=(xtreemfs_restore_databaseRequest)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    if (vMan.getVolumes().size() != 0)     throw new UserException("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")) {
            final String id=attributes.getValue(attributes.getIndex("String_Node_Str"));
            final String name=attributes.getValue(attributes.getIndex("String_Node_Str"));
            final short acPol=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
            final short osdPol=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
            final String osdPolArgs=attributes.getIndex("String_Node_Str") == -1 ? null : attributes.getValue(attributes.getIndex("String_Node_Str"));
            state=new DBRestoreState();
            state.currentVolume=new VolumeInfo(){
              public short getAcPolicyId(){
                return acPol;
              }
              public String getId(){
                return id;
              }
              public String getName(){
                return name;
              }
              public String getOsdPolicyArgs(){
                return osdPolArgs;
              }
              public short getOsdPolicyId(){
                return osdPol;
              }
              public void setOsdPolicyArgs(              String osdPolicyArgs){
              }
              public void setOsdPolicyId(              short osdPolicyId){
              }
            }
;
          }
 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,this,"String_Node_Str");
          }
 else           handleNestedElement(qName,attributes,true);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
          Logging.logMessage(Logging.LEVEL_ERROR,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,this,"String_Node_Str");
          Logging.logMessage(Logging.LEVEL_ERROR,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.currentVolume.getId());
          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 (  UserException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getMessage(),exc));
  }
catch (  SAXException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getException().getMessage() == null ? "String_Node_Str" : exc.getException().getMessage(),exc.getException()));
  }
catch (  Exception exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,exc.getMessage() == null ? "String_Node_Str" : exc.getMessage(),exc));
  }
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq){
  try {
    final xtreemfs_restore_databaseRequest rqArgs=(xtreemfs_restore_databaseRequest)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    if (vMan.getVolumes().size() != 0)     throw new UserException("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")) {
            final String id=attributes.getValue(attributes.getIndex("String_Node_Str"));
            final String name=attributes.getValue(attributes.getIndex("String_Node_Str"));
            final short acPol=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
            final short osdPol=Short.parseShort(attributes.getValue(attributes.getIndex("String_Node_Str")));
            final String osdPolArgs=attributes.getIndex("String_Node_Str") == -1 ? null : attributes.getValue(attributes.getIndex("String_Node_Str"));
            state=new DBRestoreState();
            state.currentVolume=new VolumeInfo(){
              public short getAcPolicyId(){
                return acPol;
              }
              public String getId(){
                return id;
              }
              public String getName(){
                return name;
              }
              public String getOsdPolicyArgs(){
                return osdPolArgs;
              }
              public short getOsdPolicyId(){
                return osdPol;
              }
              public void setOsdPolicyArgs(              String osdPolicyArgs){
              }
              public void setOsdPolicyId(              short osdPolicyId){
              }
            }
;
          }
 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,this,"String_Node_Str");
          }
 else           handleNestedElement(qName,attributes,true);
        }
 catch (        Exception exc) {
          Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
          Logging.logMessage(Logging.LEVEL_ERROR,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,this,"String_Node_Str");
          Logging.logMessage(Logging.LEVEL_ERROR,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.currentVolume.getId());
          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 (  UserException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getMessage(),exc));
  }
catch (  SAXException exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getException().getMessage() == null ? "String_Node_Str" : exc.getException().getMessage(),exc.getException()));
  }
catch (  Throwable exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,exc.getMessage() == null ? "String_Node_Str" : exc.getMessage(),exc));
  }
}