Пример #1
0
  public static String checkNames(String k) {
    String rebuilt = "";
    Pattern pattern = Pattern.compile("(\\[)(.*?)(\\])");
    Matcher matcher = pattern.matcher(k);

    while (matcher.find()) {
      String[] key = matcher.group(2).split("=");
      boolean prevCheck = PreventionManager.isPrevDisabled(key[0]);

      if (prevCheck == false) {
        rebuilt = rebuilt + "[" + key[1] + "]";
      }
    }

    return rebuilt;
  }
Пример #2
0
  public synchronized String getWarnings(String demo) {
    String ret = (String) mShell.get(PREVS).get(demo);

    if (ret == null) {
      try {

        Prevention prev = PreventionData.getLocalandRemotePreventions(Integer.parseInt(demo));
        pf.getMessages(prev);

        @SuppressWarnings("unchecked")
        Map<String, Object> m = prev.getWarningMsgs();

        @SuppressWarnings("rawtypes")
        Set set = m.entrySet();

        @SuppressWarnings("rawtypes")
        Iterator i = set.iterator();
        // Display elements
        String k = "";
        if (ret == null || ret.equals("null")) {
          ret = "";
        }

        while (i.hasNext()) {
          @SuppressWarnings("rawtypes")
          Map.Entry me = (Map.Entry) i.next();

          k = "[" + me.getKey() + "=" + me.getValue() + "]";
          boolean prevCheck = PreventionManager.isPrevDisabled(me.getKey().toString());
          if (prevCheck == false) {
            ret = ret + k;
          }
        }

        mShell.get(PREVS).put(demo, ret);

      } catch (Exception e) {
        ret = "";
        MiscUtils.getLogger().error("Error", e);
      }
    }

    return ret;
  }