コード例 #1
0
  @Test
  public void test_equals_overriden() {
    FileHeader header1 = new FileHeader("hello", '%') {};
    FileHeader header2 = new FileHeader("hello", '%') {};

    assertTrue(header1.equals(header2));
  }
コード例 #2
0
  void configureNewFile() {

    blockSize(configImpl().blockSize());
    _fileHeader = FileHeader.newCurrentFileHeader();
    setRegularEndAddress(_fileHeader.length());

    newSystemData(configImpl().freespaceSystem(), configImpl().idSystemType());
    systemData().converterVersion(Converter.VERSION);
    createStringIO(_systemData.stringEncoding());
    createIdSystem();

    initializeClassMetadataRepository();
    initalizeWeakReferenceSupport();

    generateNewIdentity();

    AbstractFreespaceManager blockedFreespaceManager = AbstractFreespaceManager.createNew(this);
    installFreespaceManager(blockedFreespaceManager);

    initNewClassCollection();
    initializeEssentialClasses();

    _fileHeader.initNew(this);

    blockedFreespaceManager.start(0);
  }
コード例 #3
0
  @Test
  public void test_hashCode_overriden() {
    FileHeader header1 = new FileHeader("hello", '%') {};
    FileHeader header2 = new FileHeader("hello", '%') {};

    assertEquals(header1.hashCode(), header2.hashCode());
  }
コード例 #4
0
  @Test
  public void test_getRawContent_replaces_classname() throws ContentSyntaxErrorException {
    final String headerStr = "/* constant \n" + " * %classname% */";
    FileHeader header = new FileHeader(headerStr, '%') {};

    assertEquals(
        "/* constant \n * MyClass */",
        header.getRawContent(new HashMap<String, List<String>>(), "MyClass.cs"));
  }
コード例 #5
0
  @Test
  public void test_getContent_does_not_replace_id_of_alternating_part() {

    final String headerStr = "/* constant \n" + " * <description>%description%0%</description>*/";
    FileHeader header = new FileHeader(headerStr, '%') {};

    assertEquals(
        "/* constant \n * <description>%description%0%</description>*/", header.getContent());
  }
コード例 #6
0
 /**
  * To call this method the FileLogReader must have been created as writable.
  *
  * @param size
  * @throws IOException
  */
 public synchronized void truncate(long size) throws IOException {
   if (size < mRAF.length()) {
     mRAF.setLength(size);
     FileHeader hdr = getHeader();
     hdr.setFileSize(size);
     hdr.write(mRAF);
     mRAF.seek(size);
   }
 }
コード例 #7
0
  void readThis() throws OldFormatException {
    newSystemData(AbstractFreespaceManager.FM_LEGACY_RAM, StandardIdSystemFactory.LEGACY);
    blockSizeReadFromFile(1);

    _fileHeader = FileHeader.read(this);

    if (config().generateCommitTimestamps().isUnspecified()) {
      config().generateCommitTimestamps(_systemData.idToTimestampIndexId() != 0);
    }

    createStringIO(_systemData.stringEncoding());

    createIdSystem();

    initializeClassMetadataRepository();
    initalizeWeakReferenceSupport();

    setNextTimeStampId(systemData().lastTimeStampID());

    classCollection().setID(_systemData.classCollectionID());
    classCollection().read(systemTransaction());

    Converter.convert(new ConversionStage.ClassCollectionAvailableStage(this));

    _fileHeader.readIdentity(this);

    if (_config.isReadOnly()) {
      return;
    }

    if (!configImpl().commitRecoveryDisabled()) {
      _fileHeader.completeInterruptedTransaction(this);
    }

    FreespaceManager blockedFreespaceManager =
        AbstractFreespaceManager.createNew(this, _systemData.freespaceSystem());

    installFreespaceManager(blockedFreespaceManager);

    blockedFreespaceManager.read(this, _systemData.inMemoryFreespaceSlot());
    blockedFreespaceManager.start(_systemData.bTreeFreespaceId());

    _fileHeader = _fileHeader.convert(this);

    if (freespaceMigrationRequired(blockedFreespaceManager)) {
      migrateFreespace(blockedFreespaceManager);
    }

    writeHeader(true, false);

    if (Converter.convert(new ConversionStage.SystemUpStage(this))) {
      _systemData.converterVersion(Converter.VERSION);
      _fileHeader.writeVariablePart(this);
      transaction().commit();
    }
  }
コード例 #8
0
ファイル: Directory.java プロジェクト: nathan-boyd/schoolCode
  public void print() {
    FileHeader hdr = new FileHeader();

    System.out.println("Directory contents:");
    for (int i = 0; i < tableSize; i++)
      if (table[i].inUse) {
        Debug.printf('+', "Name: %s, Sector: %d\n", table[i].name, new Integer(table[i].sector));
        hdr.fetchFrom(table[i].sector);
        hdr.print();
      }
    System.out.println("");
  }
コード例 #9
0
  public void writeHeader(boolean startFileLockingThread, boolean shuttingDown) {
    if (shuttingDown) {
      _freespaceManager.write(this);
      _freespaceManager = null;
    }

    StatefulBuffer writer = createStatefulBuffer(systemTransaction(), 0, _fileHeader.length());

    _fileHeader.writeFixedPart(this, startFileLockingThread, shuttingDown, writer, blockSize());

    if (shuttingDown) {
      ensureLastSlotWritten();
    }
    syncFiles();
  }
コード例 #10
0
  @Test
  public void test_getRawContent_replaces_back_alternating_parts()
      throws ContentSyntaxErrorException {

    Map<String, List<String>> altData = new HashMap<String, List<String>>();
    List<String> value = new Vector<String>();
    value.add("real-value");
    altData.put("description", value);

    final String headerStr = "/* constant \n" + " * <description>%description%0%</description>*/";
    FileHeader header = new FileHeader(headerStr, '%') {};

    assertEquals(
        "/* constant \n * <description>real-value</description>*/", header.getRawContent(altData));
  }
コード例 #11
0
ファイル: ImportData.java プロジェクト: bioit/crezoo
  /** Check if object support this format. If a match is found return true else return false */
  public boolean supportFormat(FileHeader hdr) {
    boolean out = false;
    try {
      for (int i = 0; i < headers.size(); i++) {
        if ((headers.get(i).formatTypeName().equals(hdr.formatTypeName()))
            && (headers.get(i).objectTypeName().equals(hdr.objectTypeName()))
            && (headers.get(i).version() == hdr.version())) {
          return true;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return false;
  }
コード例 #12
0
 public synchronized void open() throws IOException {
   mRAF = new RandomAccessFile(mFile, mReadOnly ? "r" : "rw");
   mIN = new RedoLogInput(mRAF, mFile.getPath());
   mHeader.read(mRAF);
   mHeaderRead = true;
   mFileSizeAtOpen = mRAF.length();
 }
コード例 #13
0
ファイル: CompressedFile.java プロジェクト: popitsch/codoc
 /**
  * Store to file.
  *
  * @param out
  * @throws Throwable
  */
 public void toFile(File fout) throws Throwable {
   List<File> files = new ArrayList<File>();
   files.add(header.getF1());
   for (FileDataOutputBlock<?> b : header.getBlocks()) {
     if (b instanceof TripleFileDataOutputBlock<?>) {
       files.add(b.getF1());
       files.add(((TripleFileDataOutputBlock<?>) b).getF2());
       files.add(((TripleFileDataOutputBlock<?>) b).getF3());
     } else if (b instanceof HeterogenousFileDataOutputBlock<?>) {
       files.add(b.getF1());
       files.add(((HeterogenousFileDataOutputBlock<?>) b).getF2());
     } else {
       files.add(b.getF1());
     }
   }
   // System.out.println("Concatenate: " +
   // Arrays.toString(files.toArray()));
   FileUtils.concatenateFile(fout, false, files);
 }
コード例 #14
0
  public void setIdentity(Db4oDatabase identity) {
    synchronized (lock()) {
      _systemData.identity(identity);

      // The dirty TimeStampIdGenerator triggers writing of
      // the variable part of the systemdata. We need to
      // make it dirty here, so the new identity is persisted:
      _timeStampIdGenerator.generate();

      _fileHeader.writeVariablePart(this);
    }
  }
コード例 #15
0
  @Test
  public void tets_getRawContent_replaces_two_block_with_same_id_correctly()
      throws ContentSyntaxErrorException {
    Map<String, List<String>> altData = new HashMap<String, List<String>>();
    List<String> value = new Vector<String>();
    value.add("real-value");
    value.add("real-value2");
    altData.put("description", value);

    final String headerStr =
        "/* constant \n"
            + " * <description>%description%1%</description> \n"
            + " * <description>%description%0%</description> */";
    FileHeader header = new FileHeader(headerStr, '%') {};

    assertEquals(
        "/* constant \n"
            + " * <description>real-value2</description> \n"
            + " * <description>real-value</description> */",
        header.getRawContent(altData));
  }
コード例 #16
0
  private void migrateFreespace(FreespaceManager oldFreespaceManager) {

    FreespaceManager newFreespaceManager =
        AbstractFreespaceManager.createNew(this, configImpl().freespaceSystem());
    newFreespaceManager.start(0);

    systemData().freespaceSystem(configImpl().freespaceSystem());

    installFreespaceManager(newFreespaceManager);

    AbstractFreespaceManager.migrate(oldFreespaceManager, newFreespaceManager);
    _fileHeader.writeVariablePart(this);
  }
コード例 #17
0
 public Runnable commitHook() {
   _systemData.lastTimeStampID(_timeStampIdGenerator.last());
   return _fileHeader.commit(false);
 }
コード例 #18
0
 public final void writeTransactionPointer(int pointer) {
   _fileHeader.writeTransactionPointer(systemTransaction(), pointer);
 }
コード例 #19
0
  @Test
  public void test_getNewlinesCount() throws ContentSyntaxErrorException {
    FileHeader header1 = new FileHeader("lin1\n line2 \n adsadasd \n", '%') {};

    assertEquals(3, header1.getNewlinesCount(new Hashtable<String, List<String>>()));
  }
コード例 #20
0
  @Override
  protected FileHeader getNewHeader(FileHeader oldHeader) {

    FileHeader result = new FileHeader();

    FileHeader newHeader = getFileHeader();

    FileHeaderTransformer transformer = getTransformer();

    boolean modified = false;

    // by default, reuse the old header
    result.setDescription(oldHeader.getDescription());
    result.setCopyrightFirstYear(oldHeader.getCopyrightFirstYear());
    result.setCopyrightLastYear(oldHeader.getCopyrightLastYear());
    result.setCopyrightHolder(oldHeader.getCopyrightHolder());
    result.setLicense(oldHeader.getLicense());

    if (isUpdateDescription() && !transformer.isDescriptionEquals(oldHeader, newHeader)) {

      // can update description and it has changed

      if (log.isDebugEnabled()) {
        log.debug(
            "description has changed from ["
                + oldHeader.getDescription()
                + "] to ["
                + newHeader.getDescription()
                + "]");
      }

      // description has changed, mark header to be updated
      modified = true;

      // use the new description
      result.setDescription(newHeader.getDescription());
    }

    if (isUpdateCopyright() && !transformer.isCopyrightEquals(oldHeader, newHeader)) {

      // can update copyright and it has changed

      if (log.isDebugEnabled()) {
        log.debug(
            "copyright has changed from ["
                + oldHeader.getCopyright()
                + "] to ["
                + newHeader.getCopyright()
                + "]");
      }

      // description has changed, mark header to be updated
      modified = true;

      // use the new copyright
      result.setCopyrightFirstYear(result.getCopyrightFirstYear());
      result.setCopyrightLastYear(result.getCopyrightLastYear());
      result.setCopyrightHolder(result.getCopyrightHolder());
    }

    if (isUpdateLicense() && !transformer.isLicenseEquals(oldHeader, newHeader)) {

      // can update license and it has changed

      if (log.isDebugEnabled()) {
        log.debug(
            "license has changed from ["
                + oldHeader.getLicense()
                + "] to ["
                + newHeader.getLicense()
                + "]");
      }

      // description has changed, mark header to be updated
      modified = true;

      // use the new license
      result.setLicense(newHeader.getLicense());
    }

    if (!modified) {

      // nothing has to be updated, so return a {@code null} result
      result = null;
    }

    return result;
  }
コード例 #21
0
ファイル: ImportVariables.java プロジェクト: bioit/crezoo
  public boolean check() {
    Errors.logDebug("CheckVariables started");
    boolean res = false;
    DbImportFile dbInFile = new DbImportFile();
    String fullFileName = "";
    String checkFileName = "";
    String errMessage = null;

    try {
      // Create the variable
      DbVariable dbVariable = new DbVariable();

      dbInFile.setStatus(conn_viss, ifid, "0%");

      // Store the file on server filesystem
      fullFileName = dbInFile.storeImportFileBLOB(conn_viss, ifid);
      checkFileName = fullFileName + "_checked";

      FileHeader header = FileParser.scanFileHeader(fullFileName);
      String type = header.formatTypeName().toUpperCase();
      char delimiter = header.delimiter().charValue();

      FileParser fileParser = new FileParser(fullFileName);
      fileParser.Parse(
          FileTypeDefinitionList.matchingDefinitions(
              FileTypeDefinition.VARIABLE, FileTypeDefinition.LIST));

      // Write out the result to a new file
      FileWriter fileOut = new FileWriter(checkFileName);
      fileOut.write(
          header.objectTypeName()
              + "/"
              + header.formatTypeName()
              + "/"
              + header.version()
              + "/"
              + header.delimiter()
              + "\n");

      String titles[] = fileParser.columnTitles();
      for (int j = 0; j < titles.length; j++) {
        fileOut.write(titles[j] + delimiter);
      }
      fileOut.write("\n");

      String errorMsg = "";
      errorMsg = checkList(fileParser, fileOut, delimiter);
      fileOut.close();

      /*
       * Save the file to database
       */
      dbInFile.saveCheckedFile(conn_viss, ifid, checkFileName);

      if (errorMsg.startsWith("ERROR:")) {
        res = false;
        dbInFile.setStatus(conn_viss, ifid, "ERROR");

        // Add a message to the log
        dbInFile.addErrMsg(
            conn_viss,
            ifid,
            "File checked failed for sampling unit "
                + DbSamplingUnit.getSUName(conn_viss, Integer.toString(sampleUnitId))
                + ". <br>"
                + errorMsg);
        Errors.logDebug("ErrorMsg=" + errorMsg);
      } else if (errorMsg.startsWith("WARNING:")) {
        dbInFile.setStatus(conn_viss, ifid, "WARNING");
        res = true;

        // Add a message to the log
        dbInFile.addErrMsg(conn_viss, ifid, "Warnings exists: " + errorMsg);
      } else {
        dbInFile.setStatus(conn_viss, ifid, "CHECKED");
        res = true;

        // Add a message to the log
        dbInFile.addErrMsg(
            conn_viss,
            ifid,
            "File checked for sampling unit "
                + DbSamplingUnit.getSUName(conn_viss, Integer.toString(sampleUnitId))
                + ".<br>"
                + errorMsg);
      }

      /*
      if (errorMsg.length()>0)
      {
          res = false;
          dbInFile.setStatus(conn_viss,ifid,"ERROR");
          // Add a message to the log
          dbInFile.addErrMsg(conn_viss,ifid,"File failed the check for sampling unit "+DbSamplingUnit.getSUName(conn_viss,Integer.toString(sampleUnitId)) +"<br>"+errorMsg);
      }
      else
      {
          res = true;
          dbInFile.setStatus(conn_viss,ifid,"CHECKED");
          // Add a message to the log
          dbInFile.addErrMsg(conn_viss,ifid,"File checked for sampling unit "+DbSamplingUnit.getSUName(conn_viss,Integer.toString(sampleUnitId)) +"<br>"+errorMsg);
      }*/
    } catch (Exception e) {
      dbInFile.setStatus(conn_viss, ifid, "ERROR");

      // Add a message to the log
      dbInFile.addErrMsg(conn_viss, ifid, e.getMessage());

      e.printStackTrace(System.err);
      if (errMessage == null) {
        errMessage = e.getMessage();
      }
    } finally {
      try {
        /*
         * Delete files uploaded
         */
        File tmp = new File(checkFileName);
        tmp.delete();

        tmp = new File(fullFileName);
        tmp.delete();
      } catch (Exception ignore) {
      }
    }

    Errors.logDebug("CheckVariables completed");
    return res;
  }
コード例 #22
0
ファイル: ImportPhenotypes.java プロジェクト: bioit/crezoo
  public boolean check() {
    Errors.logDebug("CheckPhenotype started");

    boolean res = false;

    String errMessage = null;
    FileWriter fileOut = null;
    DbImportFile dbInFile = new DbImportFile();

    String fullFileName = "";
    String checkFileName = "";
    try {
      dbInFile.setStatus(conn_viss, ifid, "0%");

      fullFileName = dbInFile.storeImportFileBLOB(conn_viss, ifid);
      checkFileName = fullFileName + "_checked";

      // Create the Phenotype
      DbPhenotype dbPhenotype = new DbPhenotype();

      FileHeader header = FileParser.scanFileHeader(fullFileName);
      String type = header.formatTypeName().toUpperCase();
      char delimiter = header.delimiter().charValue();

      // AbstractValueFileParser fp = null;
      FileParser fp = null;

      if (type.equals("LIST")) {
        fp = new FileParser(fullFileName);
        fp.Parse(
            FileTypeDefinitionList.matchingDefinitions(
                FileTypeDefinition.PHENOTYPE, FileTypeDefinition.LIST));
      } else if (type.equals("MATRIX")) {
        fp = new FileParser(fullFileName);
        fp.Parse(
            FileTypeDefinitionList.matchingDefinitions(
                FileTypeDefinition.PHENOTYPE, FileTypeDefinition.MATRIX));
      }

      // Write out the result to a new file
      fileOut = new FileWriter(checkFileName);
      fileOut.write(
          header.objectTypeName()
              + "/"
              + header.formatTypeName()
              + "/"
              + header.version()
              + "/"
              + header.delimiter()
              + "\n");

      String titles[] = fp.columnTitles();
      for (int j = 0; j < titles.length; j++) {
        fileOut.write(titles[j] + delimiter);
      }
      fileOut.write("\n");

      // Garbage collect the unused variables
      header = null;
      // fullFileName = null;
      // checkFileName = null;

      // Fix to upper case
      updateMethod = updateMethod.toUpperCase();

      Vector fatalErrors = new Vector();

      if (type.equals("LIST")) checkListTitles(titles, fatalErrors);
      else checkMatrixTitles(titles, fatalErrors);

      writeTitleErrors(fileOut, fatalErrors);

      String indId;

      if (titles[0].equals("IDENTITY")) indId = "IDENTITY";
      else indId = "Alias";

      String errMsg = "";
      if (type.equals("LIST")) errMsg = checkList((FileParser) fp, fileOut, delimiter, indId);
      // errMsg = checkList((FileParser)fp, fatalErrors,fileOut,delimiter,indId);
      else if (type.equals("MATRIX"))
        errMsg = checkMatrix((FileParser) fp, fatalErrors, fileOut, delimiter, indId);

      // Close the file
      fileOut.close();

      /*
       * Save the file to database
       */
      dbInFile.saveCheckedFile(conn_viss, ifid, checkFileName);

      // Get the error message from the database object. If it is set an
      // error occured during the operation so an error is thrown.
      // errMessage = dbIndividual.getErrorMessage();
      // Assertion.assertMsg(errMessage == null ||
      //                     errMessage.trim().equals(""), errMessage);

      if (errMsg.startsWith("ERROR:")) {
        dbInFile.setStatus(conn_viss, ifid, "ERROR");
        res = false;
      } else if (errMsg.startsWith("WARNING:")) {
        dbInFile.setStatus(conn_viss, ifid, "WARNING");
        res = true;
      } else {
        dbInFile.setStatus(conn_viss, ifid, "CHECKED");
        res = true;
      }

      // Add a message to the log
      dbInFile.addErrMsg(
          conn_viss,
          ifid,
          "File checked for sampling unit "
              + DbSamplingUnit.getSUName(conn_viss, Integer.toString(sampleUnitId))
              + "<br>\n"
              + errMsg);

    } catch (Exception e) {
      // Flag for error and set the errMessage if it has not been set
      // isOk = false;
      dbInFile.setStatus(conn_viss, ifid, "ERROR");
      // dbInFile.UpdateImportFile(connection,null,null,e.getMessage(),Integer.parseInt(ifid),Integer.parseInt(userId));

      // Add a message to the log
      dbInFile.addErrMsg(conn_viss, ifid, e.getMessage());

      e.printStackTrace(System.err);
      if (errMessage == null) {
        errMessage = e.getMessage();
      }
    } finally {
      try {

        /*
         * Delete temporary file
         */
        File tmp = new File(fullFileName);
        tmp.delete();
        tmp = null;

        tmp = new File(checkFileName);
        tmp.delete();
        tmp = null;
      } catch (Exception ignore) {
      }
    }

    Errors.logDebug("CheckPhenotype completed");

    return res;
  }
コード例 #23
0
ファイル: ImportPhenotypes.java プロジェクト: bioit/crezoo
  public boolean imp() {
    boolean res = false;
    String errMessage = null;

    DbImportFile dbInFile = new DbImportFile();
    DbPhenotype dbp = new DbPhenotype();
    String fullFileName = null;

    try {
      Errors.logInfo("CheckPhenotype started");
      // connection.setAutoCommit(false);
      dbInFile.setStatus(conn_viss, ifid, "0%");

      fullFileName = dbInFile.storeImportFileBLOB(conn_viss, ifid);

      FileHeader header = FileParser.scanFileHeader(fullFileName);
      FileParser fileParser = new FileParser(fullFileName);

      // Set status
      dbInFile.setStatus(conn_viss, ifid, "10%");

      // Ensure file format is list or matrix
      Assertion.assertMsg(
          header.formatTypeName().equalsIgnoreCase(FileTypeDefinition.LIST)
              || header.formatTypeName().equalsIgnoreCase(FileTypeDefinition.MATRIX),
          "Format type name should be list or matrix "
              + "but found found "
              + header.formatTypeName());

      // If file is a list
      if (header.formatTypeName().equalsIgnoreCase(FileTypeDefinition.LIST)) {
        fileParser.Parse(
            FileTypeDefinitionList.matchingDefinitions(
                FileTypeDefinition.PHENOTYPE, FileTypeDefinition.LIST));
        dbInFile.setStatus(conn_viss, ifid, "20%");

        if (updateMethod.equals("CREATE")) {
          dbp.CreatePhenotypesList(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        } else if (updateMethod.equals("UPDATE")) {
          dbp.UpdatePhenotypesList(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        } else if (updateMethod.equals("CREATE_OR_UPDATE")) {
          dbp.CreateOrUpdatePhenotypesList(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        }
      }

      // If file is a matrix
      else if (header.formatTypeName().equalsIgnoreCase(FileTypeDefinition.MATRIX)) {
        fileParser.Parse(
            FileTypeDefinitionList.matchingDefinitions(
                FileTypeDefinition.PHENOTYPE, FileTypeDefinition.MATRIX));
        dbInFile.setStatus(conn_viss, ifid, "20%");

        if (updateMethod.equals("CREATE")) {
          dbp.CreatePhenotypesMatrix(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        } else if (updateMethod.equals("UPDATE")) {
          dbp.UpdatePhenotypesMatrix(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        } else if (updateMethod.equals("CREATE_OR_UPDATE")) {
          dbp.CreateOrUpdatePhenotypesMatrix(
              fileParser, connection, sampleUnitId, Integer.valueOf(userId).intValue());
        }
      }
      errMessage = dbp.getErrorMessage();

      Assertion.assertMsg(errMessage == null || errMessage.trim().equals(""), errMessage);

      dbInFile.setStatus(conn_viss, ifid, "IMPORTED");

      // Add a message to the log
      dbInFile.addErrMsg(
          conn_viss,
          ifid,
          "File imported for sampling unit "
              + DbSamplingUnit.getSUName(conn_viss, Integer.toString(sampleUnitId)));
      res = true;

      Errors.logInfo("Check Phenotype ended");
    } catch (Exception e) {
      // Flag for error and set the errMessage if it has not been set
      // isOk = false;
      dbInFile.setStatus(conn_viss, ifid, "ERROR");

      // Add a message to the log
      dbInFile.addErrMsg(conn_viss, ifid, e.getMessage());

      e.printStackTrace(System.err);
      if (errMessage == null) {
        errMessage = e.getMessage();
      }
    }

    return res;
  }