Exemplo n.º 1
0
  /** Set the preferences for this import object. */
  public void setPrefs(Prefs prefs, DataObject db) throws Exception {
    Errors.logInfo("ImportData.setPrefs(...) started");
    this.pid = Integer.valueOf(prefs.pid).toString();
    this.isid = Integer.valueOf(prefs.isid).toString();
    this.ifid = Integer.valueOf(prefs.ifid).toString();
    this.upPath = prefs.upPath;
    this.systemFileName = prefs.fileName;
    this.updateMethod = prefs.updateMethod;
    this.connection = prefs.connection;
    this.conn_viss = prefs.connViss;
    this.sampleUnitId = prefs.sampleUnitId;
    this.speciesId = prefs.speciesId;
    this.userId = prefs.userId;

    this.db = db;

    debug();

    if (!updateMethod.equals("CREATE")
        && !updateMethod.equals("UPDATE")
        && !updateMethod.equals("CREATE_OR_UPDATE"))
      throw new Exception("UpdateMethod is not CREATE, UPDATE, CREATE_OR_UPDATE");

    Errors.logInfo("ImportData.setPrefs(...) ended");
  }
Exemplo n.º 2
0
  public boolean isDeprecated() {
    boolean deprecated = false;
    if (!mDeprecatedKnown) {
      boolean commentDeprecated = comment().isDeprecated();
      boolean annotationDeprecated = false;
      for (AnnotationInstanceInfo annotation : annotations()) {
        if (annotation.type().qualifiedName().equals("java.lang.Deprecated")) {
          annotationDeprecated = true;
          break;
        }
      }

      if (commentDeprecated != annotationDeprecated) {
        Errors.error(
            Errors.DEPRECATION_MISMATCH,
            position(),
            "Method "
                + mContainingClass.qualifiedName()
                + "."
                + name()
                + ": @Deprecated annotation and @deprecated doc tag do not match");
      }

      mIsDeprecated = commentDeprecated | annotationDeprecated;
      mDeprecatedKnown = true;
    }
    return mIsDeprecated;
  }
Exemplo n.º 3
0
  public boolean imp() {
    boolean res = false;

    DbVariable dbVariable = null;
    String fullFileName = "";
    String errMessage = null;
    DbImportFile dbInFile = new DbImportFile();
    try {
      dbVariable = new DbVariable();

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

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

      dbVariable.CreateVariables(fileParser, connection, sampleUnitId, Integer.parseInt(userId));

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

      dbInFile.setStatus(conn_viss, ifid, "IMPORTED");
      // dbInFile.UpdateImportFile(connection,null,null,"Done",Integer.parseInt(ifid),Integer.parseInt(userId));

      // Add a message to the log
      dbInFile.addErrMsg(
          conn_viss,
          ifid,
          "File imported to sampling unit "
              + DbSamplingUnit.getSUName(conn_viss, Integer.toString(sampleUnitId))
              + "Note: Markers is always imported in Create mode.");
      res = true;
    } catch (Exception e) {
      Errors.logError("ImportVariables.imp(...)" + e.getMessage());

      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 files uploaded
         */
        File tmp = new File(fullFileName);
        tmp.delete();
      } catch (Exception ignore) {
      }
    }

    return res;
  }
Exemplo n.º 4
0
  /** Prints a debug information about the knowledge of this import module. */
  public void debug() {
    Errors.logInfo("ImportData.debug() started");

    if (connection == null) Errors.logDebug("connection is null");
    else Errors.logDebug("connection is not null");

    if (conn_viss == null) Errors.logDebug("conn_viss is null");
    else Errors.logDebug("conn_viss is not null");

    if (pid == null) Errors.logDebug("pid is null");
    else Errors.logDebug("pid=" + pid);

    if (isid == null) Errors.logDebug("isid is null");
    else Errors.logDebug("isid=" + isid);

    if (upPath == null) Errors.logDebug("upPath is null");
    else Errors.logDebug("upPath=" + upPath);

    Errors.logDebug("sampleUnitId=" + sampleUnitId);

    Errors.logDebug("speciesId=" + speciesId);

    if (userId == null) Errors.logDebug("userId is null");
    else Errors.logDebug("userId=" + userId);

    Errors.logDebug("level=" + level);

    Errors.logDebug("maxDev=" + maxDev);

    if (updateMethod == null) Errors.logDebug("updateMethod is null");
    else Errors.logDebug("updateMethod=" + updateMethod);

    Errors.logInfo("ImportData.debug() ended");
  }
Exemplo n.º 5
0
  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;
  }
  //
  // Visitor generation methods
  //
  public void generateDepthFirstVisitor() throws FileExistsException {
    try {
      File file = new File(visitorDir, outFilename);

      if (Globals.noOverwrite && file.exists()) throw new FileExistsException(outFilename);

      PrintWriter out = new PrintWriter(new FileOutputStream(file), false);
      Spacing spc = new Spacing(INDENT_AMT);

      out.println(Globals.fileHeader(spc));
      out.println();
      out.println(spc.spc + "package " + Globals.visitorPackage + ";");
      if (!Globals.visitorPackage.equals(Globals.nodePackage))
        out.println(spc.spc + "import " + Globals.nodePackage + ".*;");
      out.println(spc.spc + "import java.util.*;\n");
      out.println(spc.spc + "/**");
      out.println(
          spc.spc
              + " * Provides default methods which visit each "
              + "node in the tree in depth-first");
      out.println(spc.spc + " * order.  Your visitors may extend this class.");
      out.println(spc.spc + " */");
      out.println(
          spc.spc
              + "public class "
              + visitorName
              + "<R,A> implements "
              + Globals.GJVisitorName
              + "<R,A> {");
      printAutoVisitorMethods(out);

      spc.updateSpc(+1);
      out.println(spc.spc + "//");
      out.println(spc.spc + "// User-generated visitor methods below");
      out.println(spc.spc + "//");
      out.println();

      for (Enumeration e = classList.elements(); e.hasMoreElements(); ) {
        ClassInfo cur = (ClassInfo) e.nextElement();
        String name = cur.getName();

        out.println(spc.spc + "/**");
        if (Globals.javaDocComments) out.println(spc.spc + " * <PRE>");
        out.println(cur.getEbnfProduction(spc));
        if (Globals.javaDocComments) out.println(spc.spc + " * </PRE>");
        out.println(spc.spc + " */");
        out.print(spc.spc + "public R visit");
        out.println("(" + name + " n, A argu) {");

        spc.updateSpc(+1);
        out.println(spc.spc + "R _ret=null;");
        for (Enumeration f = cur.getNameList().elements(); f.hasMoreElements(); )
          out.println(spc.spc + "n." + (String) f.nextElement() + ".accept(this, argu);");
        out.println(spc.spc + "return _ret;");
        spc.updateSpc(-1);
        out.println(spc.spc + "}\n");
      }

      spc.updateSpc(-1);
      out.println(spc.spc + "}");

      out.flush();
      out.close();
    } catch (IOException e) {
      Errors.hardErr("Could not generate " + outFilename);
    }
  }
Exemplo n.º 7
0
  public boolean isConsistent(MethodInfo mInfo) {
    boolean consistent = true;
    if (this.mReturnType != mInfo.mReturnType && !this.mReturnType.equals(mInfo.mReturnType)) {
      if (!mReturnType.isPrimitive() && !mInfo.mReturnType.isPrimitive()) {
        // Check to see if our class extends the old class.
        ApiInfo infoApi = mInfo.containingClass().containingPackage().containingApi();
        ClassInfo infoReturnClass = infoApi.findClass(mInfo.mReturnType.qualifiedTypeName());
        // Find the classes.
        consistent =
            infoReturnClass != null
                && infoReturnClass.isAssignableTo(mReturnType.qualifiedTypeName());
      } else {
        consistent = false;
      }

      if (!consistent) {
        Errors.error(
            Errors.CHANGED_TYPE,
            mInfo.position(),
            "Method "
                + mInfo.qualifiedName()
                + " has changed return type from "
                + mReturnType
                + " to "
                + mInfo.mReturnType);
      }
    }

    if (mIsAbstract != mInfo.mIsAbstract) {
      consistent = false;
      Errors.error(
          Errors.CHANGED_ABSTRACT,
          mInfo.position(),
          "Method " + mInfo.qualifiedName() + " has changed 'abstract' qualifier");
    }

    if (mIsNative != mInfo.mIsNative) {
      consistent = false;
      Errors.error(
          Errors.CHANGED_NATIVE,
          mInfo.position(),
          "Method " + mInfo.qualifiedName() + " has changed 'native' qualifier");
    }

    if (!mIsStatic) {
      // Compiler-generated methods vary in their 'final' qualifier between versions of
      // the compiler, so this check needs to be quite narrow. A change in 'final'
      // status of a method is only relevant if (a) the method is not declared 'static'
      // and (b) the method is not already inferred to be 'final' by virtue of its class.
      if (!isEffectivelyFinal() && mInfo.isEffectivelyFinal()) {
        consistent = false;
        Errors.error(
            Errors.ADDED_FINAL,
            mInfo.position(),
            "Method " + mInfo.qualifiedName() + " has added 'final' qualifier");
      } else if (isEffectivelyFinal() && !mInfo.isEffectivelyFinal()) {
        consistent = false;
        Errors.error(
            Errors.REMOVED_FINAL,
            mInfo.position(),
            "Method " + mInfo.qualifiedName() + " has removed 'final' qualifier");
      }
    }

    if (mIsStatic != mInfo.mIsStatic) {
      consistent = false;
      Errors.error(
          Errors.CHANGED_STATIC,
          mInfo.position(),
          "Method " + mInfo.qualifiedName() + " has changed 'static' qualifier");
    }

    if (!scope().equals(mInfo.scope())) {
      consistent = false;
      Errors.error(
          Errors.CHANGED_SCOPE,
          mInfo.position(),
          "Method "
              + mInfo.qualifiedName()
              + " changed scope from "
              + scope()
              + " to "
              + mInfo.scope());
    }

    if (!isDeprecated() == mInfo.isDeprecated()) {
      Errors.error(
          Errors.CHANGED_DEPRECATED,
          mInfo.position(),
          "Method "
              + mInfo.qualifiedName()
              + " has changed deprecation state "
              + isDeprecated()
              + " --> "
              + mInfo.isDeprecated());
      consistent = false;
    }

    // see JLS 3 13.4.20 "Adding or deleting a synchronized modifier of a method does not break "
    // "compatibility with existing binaries."
    /*
    if (mIsSynchronized != mInfo.mIsSynchronized) {
      Errors.error(Errors.CHANGED_SYNCHRONIZED, mInfo.position(), "Method " + mInfo.qualifiedName()
          + " has changed 'synchronized' qualifier from " + mIsSynchronized + " to "
          + mInfo.mIsSynchronized);
      consistent = false;
    }
    */

    for (ClassInfo exception : thrownExceptions()) {
      if (!mInfo.throwsException(exception)) {
        // exclude 'throws' changes to finalize() overrides with no arguments
        if (!name().equals("finalize") || (!mParameters.isEmpty())) {
          Errors.error(
              Errors.CHANGED_THROWS,
              mInfo.position(),
              "Method "
                  + mInfo.qualifiedName()
                  + " no longer throws exception "
                  + exception.qualifiedName());
          consistent = false;
        }
      }
    }

    for (ClassInfo exec : mInfo.thrownExceptions()) {
      // exclude 'throws' changes to finalize() overrides with no arguments
      if (!throwsException(exec)) {
        if (!name().equals("finalize") || (!mParameters.isEmpty())) {
          Errors.error(
              Errors.CHANGED_THROWS,
              mInfo.position(),
              "Method "
                  + mInfo.qualifiedName()
                  + " added thrown exception "
                  + exec.qualifiedName());
          consistent = false;
        }
      }
    }

    return consistent;
  }
Exemplo n.º 8
0
  public ParamTagInfo[] paramTags() {
    if (mParamTags == null) {
      final int N = mParameters.size();

      String[] names = new String[N];
      String[] comments = new String[N];
      SourcePositionInfo[] positions = new SourcePositionInfo[N];

      // get the right names so we can handle our names being different from
      // our parent's names.
      int i = 0;
      for (ParameterInfo param : mParameters) {
        names[i] = param.name();
        comments[i] = "";
        positions[i] = param.position();
        i++;
      }

      // gather our comments, and complain about misnamed @param tags
      for (ParamTagInfo tag : comment().paramTags()) {
        int index = indexOfParam(tag.parameterName(), names);
        if (index >= 0) {
          comments[index] = tag.parameterComment();
          positions[index] = tag.position();
        } else {
          Errors.error(
              Errors.UNKNOWN_PARAM_TAG_NAME,
              tag.position(),
              "@param tag with name that doesn't match the parameter list: '"
                  + tag.parameterName()
                  + "'");
        }
      }

      // get our parent's tags to fill in the blanks
      MethodInfo overridden = this.findOverriddenMethod(name(), signature());
      if (overridden != null) {
        ParamTagInfo[] maternal = overridden.paramTags();
        for (i = 0; i < N; i++) {
          if (comments[i].equals("")) {
            comments[i] = maternal[i].parameterComment();
            positions[i] = maternal[i].position();
          }
        }
      }

      // construct the results, and cache them for next time
      mParamTags = new ParamTagInfo[N];
      for (i = 0; i < N; i++) {
        mParamTags[i] =
            new ParamTagInfo(
                "@param", "@param", names[i] + " " + comments[i], parent(), positions[i]);

        // while we're here, if we find any parameters that are still undocumented at this
        // point, complain. (this warning is off by default, because it's really, really
        // common; but, it's good to be able to enforce it)
        if (comments[i].equals("")) {
          Errors.error(
              Errors.UNDOCUMENTED_PARAMETER,
              positions[i],
              "Undocumented parameter '" + names[i] + "' on method '" + name() + "'");
        }
      }
    }
    return mParamTags;
  }
Exemplo n.º 9
0
  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;
  }
Exemplo n.º 10
0
  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;
  }