Beispiel #1
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param s
   * @param s1
   * @return
   */
  public static String UnicodeToString(String s, String s1) {
    try {
      if (s == null) return "";
      if (!isI18N(s)) /* change by dingbing.xu from isI18N */ {
        return s;
      }

      if (s1 == com.dragonflow.Utils.I18N.nullEncoding()) {
        com.dragonflow.Utils.I18N.test(s, 1);
      } else if (s1.length() == 0) {
        com.dragonflow.Utils.I18N.test(s, 0);
      }
      String s2;
      byte abyte0[] = s1 != null && s1.length() != 0 ? s.getBytes(s1) : s.getBytes();
      char ac[] = new char[abyte0.length];
      for (int i = 0; i < abyte0.length; i++) {
        ac[i] = (char) (abyte0[i] & 0xff);
      }

      s2 = new String(ac);
      com.dragonflow.Utils.I18N.test(s2, 2);
      return s2;
    } catch (Exception exception) {
      if (s1 != null && s1.length() > 0) {
        com.dragonflow.Log.LogManager.log(
            "Error", "I18N: Bad Encoding(" + s1 + ") " + exception.getMessage());
        com.dragonflow.Utils.TextUtils.debugPrint(
            "I18N: Bad Encoding(" + s1 + ") " + exception.getMessage());
        exception.printStackTrace();
      }
      return s;
    }
  }
Beispiel #2
0
  private void startXmlElement(String s, jgl.HashMap hashmap) {
    boolean flag = false;
    java.util.Vector vector = null;
    xmlResponse.append("<" + s);
    if (hashmap != null) {
      java.util.Enumeration enumeration = hashmap.keys();
      while (enumeration.hasMoreElements()) {
        String s1 = enumeration.nextElement().toString();
        Object obj = hashmap.get(s1);
        if (obj instanceof String[]) {
          flag = true;
          if (vector == null) {
            vector = new Vector();
          }
          vector.addElement(s1);
        } else if (obj instanceof String) {
          if (com.dragonflow.Utils.I18N.isNullEncoding(obj.toString())) {
            xmlResponse.append(
                " "
                    + s1
                    + "=\""
                    + com.dragonflow.Utils.TextUtils.escapeHTML(
                        com.dragonflow.Utils.I18N.toDefaultEncoding(obj.toString()))
                    + "\"");
          } else {
            xmlResponse.append(
                " "
                    + s1
                    + "=\""
                    + com.dragonflow.Utils.TextUtils.escapeHTML(obj.toString())
                    + "\"");
          }
        }
      }
      xmlResponse.append(">\r\n");
      if (flag) {
        for (int i = 0; i < vector.size(); i++) {
          String s2 = (String) vector.elementAt(i);
          String as[] = (String[]) hashmap.get(s2);
          xmlResponse.append("<property>\r\n");
          xmlResponse.append(s2 + "\r\n");
          for (int j = 0; j < as.length; j++) {
            if (as[j] == null) {
              continue;
            }
            if (encodeValues) {
              String s3 = com.dragonflow.XmlApi.XmlApiRequestXML.escapeXML(as[j]);
              xmlResponse.append("<value>" + s3 + "</value>\r\n");
            } else {
              xmlResponse.append("<value>" + as[j] + "</value>\r\n");
            }
          }

          xmlResponse.append("</property>\r\n");
        }
      }
    }
  }
Beispiel #3
0
 public static String toDefaultEncoding(String s) {
   if (!isI18N) {
     return s;
   } else {
     com.dragonflow.Utils.I18N.test(s, 1);
     String s1 =
         com.dragonflow.Utils.I18N.UnicodeToString(s, com.dragonflow.Utils.I18N.nullEncoding());
     return com.dragonflow.Utils.I18N.StringToUnicode(s1, "");
   }
 }
Beispiel #4
0
  public static jgl.Array toDefaultArray(jgl.Array array) {
    if (!isI18N) {
      return array;
    }
    jgl.Array array1 = new Array();
    for (int i = 0; i < array.size(); i++) {
      String s = (String) array.at(i);
      com.dragonflow.Utils.I18N.test(s, 1);
      array1.add(com.dragonflow.Utils.I18N.toDefaultEncoding((String) array.at(i)));
    }

    return array1;
  }
Beispiel #5
0
 public static boolean test(String s, int i) {
   if (!testing) {
     return true;
   }
   if (s.length() > 0 && s.indexOf("SAP") >= 0) {
     int j = s.indexOf("SAP");
     int k = s.charAt(j + 3) & 0xff;
     if (k == 37) {
       return true;
     }
     if (i == 0 && (k == 146 || k == 184)) {
       return true;
     }
     if (i == 1 && k == 226) {
       return true;
     }
     if (i == 2 && k == 131) {
       return true;
     } else {
       com.dragonflow.Utils.I18N.dmp(
           "!!!!!!!!!!Bad encoding: Looking for "
               + (i != 0 ? i != 1 ? "STRING" : "NULL" : "DEFAULT"),
           s);
       return false;
     }
   } else {
     return true;
   }
 }
Beispiel #6
0
 public static String nullEncoding() {
   if (!isI18N && enc == null) {
     enc = com.dragonflow.Utils.I18N.getDefaultEncoding();
   }
   // return isI18N ? "Cp437" : enc;
   return "GBK";
 }
Beispiel #7
0
 public static String StringToUnicode(String s) {
   if (!isI18N) {
     return s;
   } else {
     return com.dragonflow.Utils.I18N.StringToUnicode(s, "");
   }
 }
Beispiel #8
0
 public static boolean isNullEncoding(String s) {
   try {
     String s1 = com.dragonflow.Utils.I18N.nullEncoding();
     byte abyte0[] = s1 != null && s1.length() != 0 ? s.getBytes(s1) : s.getBytes();
   } catch (Exception exception) {
     return false;
   }
   return true;
 }
Beispiel #9
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param s
   * @param s1
   * @return
   */
  public static String StringToUnicode(String s, String s1) {
    if (s == null || s.length() == 0) {
      return "";
    }

    if (!isI18N(s)) /*change By dingbing.xu*/ {
      return s;
    }
    String s2 = "";
    com.dragonflow.Utils.I18N.test(s, 2);
    String s3;

    try {
      byte abyte0[] = new byte[s.length()];
      for (int i = 0; i < s.length(); i++) {
        abyte0[i] = (byte) (s.charAt(i) & 0xff);
      }

      s3 = s1 != null && s1.length() != 0 ? new String(abyte0, s1) : new String(abyte0);
      if (s1 == com.dragonflow.Utils.I18N.nullEncoding()) {
        com.dragonflow.Utils.I18N.test(s3, 1);
      } else if (s1.length() == 0) {
        com.dragonflow.Utils.I18N.test(s3, 0);
      }
      return s3;
    } catch (Exception exception) {
      if (s1 != null && s1.length() > 0) {
        com.dragonflow.Log.LogManager.log(
            "Error", "I18N: Bad Encoding(" + s1 + ") " + exception.getMessage());
        com.dragonflow.Utils.TextUtils.debugPrint(
            "I18N: Bad Encoding(" + s1 + ") " + exception.getMessage());
        exception.printStackTrace();
      }
      return s;
    }
  }
Beispiel #10
0
 public static void dumpValues(String s, String as[], String s1) {
   String s2 = s1;
   if (s1.indexOf("#") >= 0) {
     s2 = s1.substring(s1.indexOf("#"));
   }
   for (int i = 0; i < as.length; i++) {
     String s3 = new String(s2);
     String s4 = s3;
     for (; s3.indexOf(as[i]) >= 0; s3 = s3.substring(s3.indexOf(as[i]) + as[i].length())) {
       String s5 = s3.substring(s3.indexOf(as[i]));
       s5 = s5.substring(0, Math.min(Math.max(s5.indexOf("\n"), 5), s5.length()));
       com.dragonflow.Utils.I18N.dmp(
           s + ": " + s5.substring(0, as[i].length()), s5.substring(as[i].length()));
     }
   }
 }
Beispiel #11
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @return
   */
  public static String getTestUnicode() {
    String s =
        "SAP\u0192W\u0192\u0192\u0192p\u0192\u201C\u0160\u201D\u017D\256\u2030\357\u017D\320";
    String s1 = com.dragonflow.Utils.I18N.UnicodeToString(s);
    try {
      byte abyte0[];
      char ac[] = s1.toCharArray();
      abyte0 = new byte[ac.length];
      for (int i = 0; i < ac.length; i++) {
        abyte0[i] = (byte) (ac[i] & 0xff);
      }

      return new String(abyte0, "shift_jis");
    } catch (Exception exception) {
      return "";
    }
  }
Beispiel #12
0
 public static String escapeString(String s, String s1) {
   return com.dragonflow.Utils.TextUtils.escapeHTML(
       com.dragonflow.Utils.I18N.StringToUnicode(
           com.dragonflow.Utils.I18N.UnicodeToString(s, com.dragonflow.Utils.I18N.nullEncoding()),
           s1));
 }
Beispiel #13
0
 public static String UnicodeToString(String s) {
   return com.dragonflow.Utils.I18N.UnicodeToString(s, "");
 }
Beispiel #14
0
  public void printBody() throws java.lang.Exception {
    if (!request.actionAllowed("_file")) {
      throw new HTTPRequestException(557);
    }
    java.lang.String s = request.getValue("operation");
    try {
      if (s.equals("run")) {
        java.lang.String s1 = request.getValue("command");
        java.lang.String s4 = request.getValue("machineID");
        jgl.HashMap hashmap = null;
        java.lang.String s6 = com.dragonflow.SiteView.Machine.getCommandString(s1, s4, hashmap);
        com.dragonflow.Utils.CommandLine commandline = new CommandLine();
        jgl.Array array2 = commandline.exec(s6, s4, com.dragonflow.SiteView.Platform.getLock(s4));
        outputStream.println("<PRE>");
        for (int k1 = 0; k1 < array2.size(); k1++) {
          outputStream.println(array2.at(k1));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("scripts")) {
        java.lang.String s2 = request.getValue("machineID");
        outputStream.println("<PRE>");
        java.util.Vector vector1 = com.dragonflow.Page.remoteOpPage.getScriptList(s2, request);
        for (int k = 0; k < vector1.size(); k++) {
          outputStream.println(vector1.elementAt(k));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("updateStaticPages")) {
        java.lang.String s3 =
            com.dragonflow.Utils.I18N.toDefaultEncoding(request.getValue("group"));
        if (s3.length() == 0) {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages();
        } else {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages(s3);
        }
      } else if (s.equals("getServers")) {
        java.util.Vector vector = com.dragonflow.SiteView.Platform.getServers();
        outputStream.println("<PRE>");
        for (int i = 0; i < vector.size(); i += 2) {
          outputStream.println(vector.elementAt(i));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("monitorClasses")) {
        outputStream.println("<PRE>");
        jgl.Array array = com.dragonflow.Page.monitorPage.getMonitorClasses();
        for (int j = 0; j < array.size(); j++) {
          java.lang.String s5 = ((java.lang.Class) array.at(j)).getName();
          int i1 = s5.lastIndexOf(".");
          if (i1 >= 0) {
            s5 = s5.substring(i1 + 1);
          }
          outputStream.println(s5);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("actionClasses")) {
        com.dragonflow.Page.alertPage alertpage = new alertPage();
        outputStream.println("<PRE>");
        jgl.Array array1 = alertpage.getActionClasses();
        for (int l = 0; l < array1.size(); l++) {
          java.lang.String s7 = ((java.lang.Class) array1.at(l)).getName();
          int j1 = s7.lastIndexOf(".");
          if (j1 >= 0) {
            s7 = s7.substring(j1 + 1);
          }
          outputStream.println(s7);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("platform")) {
        outputStream.println("<PRE>");
        outputStream.println("os.name=" + java.lang.System.getProperty("os.name"));
        outputStream.println("os.version=" + java.lang.System.getProperty("os.version"));
        outputStream.println("version=" + com.dragonflow.SiteView.Platform.getVersion());
        outputStream.println("</PRE>");
      } else {
        throw new Exception("unknown operation, " + s);
      }
    } catch (java.lang.Exception exception) {
      outputStream.println("error: " + exception + ", " + s);
    }
  }