示例#1
0
  /* transform manifest in an array of byte
      if any code error, exit
      else if any error, show dialog, then return nil
  */
  public static byte[] s_toByteArray(Manifest man, Frame frmOwner) {
    String strMethod = _f_s_strClass + "s_toByteArray(...)";

    if (man == null) {
      MySystem.s_printOutExit(strMethod, "nil man");
    }

    ByteArrayOutputStream baoBuffer = new ByteArrayOutputStream();

    try {
      man.write(baoBuffer);
      baoBuffer.flush();
      baoBuffer.close();
    } catch (IOException excIO) {
      excIO.printStackTrace();
      MySystem.s_printOutExit(strMethod, "excIO caught");

      String strBody = "Got IO exception";

      OPAbstract.s_showDialogError(frmOwner, strBody);

      return null;
    }

    return baoBuffer.toByteArray();
  }
  /**
   * if any code error, exit else if any other error, show warning-error dialog, then return false
   * else return true
   */
  public boolean doJob() {
    String strMethod = "doJob()";

    // x) if pathAbsKeystore != nil, load keystore of type "JKS"
    java.security.KeyStore kstOpen = null;

    if (super._strPathAbsKst_ != null) {
      if (super._strProviderKst_ == null) {
        MySystem.s_printOutExit(this, strMethod, "nil super._strProviderKst_");
      }

      // if
      // (super._strProviderKst_.toLowerCase().compareTo(KTLAbs._f_s_strSecurityProviderSun_.toLowerCase()) != 0)
      //  MySystem.s_printOutExit(this, strMethod, "wrong value, super._strProviderKst_=" +
      // super._strProviderKst_);
      // MySystem.s_printOutWarning(this, strMethod, "should check for keystore of type JKS,
      // provider named SUN");

      // memo: keystore should be of type "JKS", provided by "SUN"
      File fleOpen = UtilJsrFile.s_getFileOpen(super._frmOwner_, super._strPathAbsKst_);

      if (fleOpen == null) {
        MySystem.s_printOutError(this, strMethod, "nil fleOpen");
        return false;
      }

      kstOpen =
          UtilKstJks.s_getKeystoreOpen(
              super._frmOwner_,
              fleOpen,
              (char[]) null // keystore's Password, not in use for verifying signed jarred file
              );

      if (kstOpen == null) {
        MySystem.s_printOutError(this, strMethod, "nil kstOpen");
        return false;
      }
    }

    super._setEnabledCursorWait_(true);

    if (!super._doJob_(kstOpen)) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    super._setEnabledCursorWait_(false);

    // ----
    return true;
  }
示例#3
0
  public static void s_fill(Manifest man) {
    String strMethod = _f_s_strClass + "s_fill(man)";

    if (man == null) {
      MySystem.s_printOutExit(strMethod, "nil man");
    }

    Attributes attAttributes = man.getMainAttributes();

    attAttributes.putValue(
        S_Manifest._f_s_strsDefaultEntryManifVersion[0],
        S_Manifest._f_s_strsDefaultEntryManifVersion[1]);

    attAttributes.putValue(
        S_Manifest._f_s_strsDefaultEntryManifCreator[0],
        S_Manifest._f_s_strsDefaultEntryManifCreator[1]);
  }