Exemplo n.º 1
0
  /**
   * エラーリストを XMLとして出力する。
   *
   * @param el エラーリスト
   */
  public static void outputError(UDF_ErrorList el) {

    Document doc = UDF_Util.genDocument();
    Element root = doc.createElement("udf-error");

    for (int i = 0; i < el.getSize(); i++) {
      el.getError(i).toXML(doc, root);
    }

    doc.appendChild(root);

    try {
      OutputFormat format = new OutputFormat(doc, "UTF-8", true);
      format.setLineWidth(0);
      OutputStreamWriter osw = new OutputStreamWriter(System.out, "UTF-8");
      XMLSerializer serial = new XMLSerializer(osw, format);
      serial.serialize(doc.getDocumentElement());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  // begin:add your code here
  public UDF_ErrorList verify() throws UDF_Exception {

    UDF_ErrorList el = super.verify();

    if (env.udf_revision != 0x260) return el;

    // リビジョンチェック
    if (getUDFRevision().getIntValue() != 0x260) {

      el.addError(
          new UDF_Error(
              UDF_Error.C_UDF260,
              UDF_Error.L_ERROR,
              "UDF Revision",
              "The UDFRevision field shall contain #0260 to indicate revision 2.60.",
              "2.1.5.3",
              String.valueOf(getUDFRevision().getIntValue()),
              "608"));
    }

    el.addError(verifyBase(UDF_Error.C_UDF260, "2.1.5.3"));
    el.setGlobalPoint(getGlobalPoint());
    return el;
  }
Exemplo n.º 3
0
  public UDF_ErrorList verify() throws UDF_Exception {

    UDF_ErrorList el = new UDF_ErrorList();

    if (env.udf_revision != 0x150) return super.verify();

    el.addError(verifyBase(UDF_Error.C_UDF150));

    el.addError(getPartMaps().verify("PartitionMaps"));

    el.setRName("Logical Volume Descriptor");
    el.addError(super.verify());
    el.setGlobalPoint(getGlobalPoint());
    return el;
  }
Exemplo n.º 4
0
  /** UDF 2.50規格に準じた検証を行います。 */
  public UDF_ErrorList verify() throws UDF_Exception {

    UDF_ErrorList el = new UDF_ErrorList();
    boolean error_flag = false;

    if (env.udf_revision != 0x250) return super.verify();

    //  CRC 計算を行う範囲はLengthOfAllocationDescriptorの数を含んだ分になります //
    UDF_tag tag = (UDF_tag) getDescTag();
    int crc_length = tag.getDescCRCLen().getIntValue();
    int length_of_ad = getLenOfAllocDesc().getIntValue();

    if (crc_length != 8 && crc_length != (8 + length_of_ad)) {

      el.addError(
          new UDF_Error(
              UDF_Error.C_UDF250,
              UDF_Error.L_ERROR,
              "Descriptor Tag",
              "The DescriptorCRCLength of the DescriptorTag should include the Allocation Descriptors following the Allocation Extent Descriptor. The DescriptorCRCLength shall be either 8 or 8 + LengthOfAllocationDescriptors.",
              "2.3.11.1"));
      error_flag = true;
    }

    //  PreviousAlloctionExtentLocation は使うべきではない //
    int pre_loc = getPreviousAllocExtentLoc().getIntValue();
    if (0 != pre_loc) {

      el.addError(
          new UDF_Error(
              UDF_Error.C_UDF250,
              UDF_Error.L_ERROR,
              "PreviousAlloctionExtentLocation",
              "Shall be set to 0.",
              "2.3.11.2",
              pre_loc,
              0));
      error_flag = true;
    }

    if (error_flag) {
      el.setRName("Allocation Extent Descriptor");
    }

    //  Allocation Extent Descriptorのサイズは1論理ブロックを超えてはならない //
    if (getSize() > env.LBS) {

      el.addError(
          new UDF_Error(
              UDF_Error.C_UDF250,
              UDF_Error.L_ERROR,
              "Allocation Extent Descriptor",
              "The length of an extent of allocation descriptors shall not exceed the logical block size.",
              "2.3.11"));
    }

    el.addError(super.verify());
    el.setGlobalPoint(getGlobalPoint());

    return el;
  }