Parses the given parameter string and caches the result.

@param s the parameter string to parse
@return a Map made up of parameter names their values
552470
private synchronized Map<String, String[]> parseParameters(String s)
    {
        Map<String, List<String>> parameterMap;
        Map<String, String[]> result;
        StringTokenizer st;

        parameterMap = new HashMap<>();
        result = new HashMap<>();

        if (s == null)
        {
            return result;
        }

        st = new StringTokenizer(s, "&");
        while (st.hasMoreTokens())
        {
            String parameter;
            Matcher parameterMatcher;
            String name;
            String value;
            List<String> values;

            parameter = st.nextToken();
            parameterMatcher = PARAMETER_PATTERN.matcher(parameter);
            if (parameterMatcher.matches())
            {
                try
                {
                    name = URLDecoder.decode(parameterMatcher.group(1), "UTF-8");
                    value = URLDecoder.decode(parameterMatcher.group(2), "UTF-8");
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }
            else
            {
                try
                {
                    name = URLDecoder.decode(parameter, "UTF-8");
                    value = "";
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }

            if (parameterMap.get(name) == null)
            {
                values = new ArrayList<>();
                values.add(value);
                parameterMap.put(name, values);
            }
            else
            {
                values = parameterMap.get(name);
                values.add(value);
            }
        }

        for (Map.Entry<String, List<String>> entry : parameterMap.entrySet())
        {
            String[] valueArray;

            valueArray = new String[entry.getValue().size()];
            result.put(entry.getKey(), entry.getValue().toArray(valueArray));
        }

        return result;
    }
744040
private static Map<String, Object> convert(
        final Map<CharSequence, Object> params) {
        final Map<String, Object> map = new HashMap<>(params.size());
        for (final Map.Entry<CharSequence, Object> ent : params.entrySet()) {
            map.put(ent.getKey().toString(), ent.getValue());
        }
        return map;
    }
682143
static private String findParamFor(String s)
	{
		int endClassIndex = s.indexOf('[');
		if (endClassIndex<0) return null;
		else {
			int endParamIndex = s.indexOf('=',endClassIndex+1);
			if (endParamIndex<0) throw new IllegalStateException("illegal class description '"+s+"'");
			return s.substring(endClassIndex+1,endParamIndex);
		}
	}
943544
private Map<String, String> getParameters(String param) {

        if (CmsStringUtil.isNotEmpty(param)) {
            return CmsStringUtil.splitAsMap(param, "|", "=");
        }
        return Collections.emptyMap();
    }
406310
static private String findParamValueFor(String s)
	{
		int endParamIndex = s.indexOf('=');
		int endValueIndex = s.indexOf(']',endParamIndex);
		if (endValueIndex<0) throw new IllegalStateException("illegal class description '"+s+"'");
		return s.substring(endParamIndex+1,endValueIndex);
	}
925299
@SuppressWarnings("unchecked")
    public Map<String, String[]> getParameters()
    {
        return (Map<String, String[]>) this.map.get(Parameter.ParameterValues.PARAMETERS);
    }
365806
public Map<String, T> parseMap(InputStream is) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(is);
        jsonParser.nextToken();
        return parseMap(jsonParser);
    }
473903
@Override
    public Map<String, String> deserialize(String s) {

        try {

            String input = multiline ? s : s.replace('&', '\n');

            Properties props = new Properties();
            if (s != null) {
                props.load(new StringReader(input));
            }

            LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
            for (Entry<Object, Object> entry : props.entrySet()) {
                result.put(entry.getKey().toString(), entry.getValue().toString());
            }
            return result;

        } catch (IOException e) {
            throw new IllegalStateException(e);
        }

    }
671166
public static int[] parseDestinationsString(String s) {
        if (!s.contains(",")) {
            return new int[]{Integer.valueOf(s.trim())};
        }
        String[] array = s.split(",");
        int[] destinations = new int[array.length];
        for (int i = 0; i < destinations.length; i++) {
            final String stringWithNoWhiteSpaces = array[i].replaceAll("\\s", "");
            if (stringWithNoWhiteSpaces.isEmpty()) {
                throw new IllegalArgumentException("Empty destination. Too many commas?");
            }
            destinations[i] = Integer.valueOf(stringWithNoWhiteSpaces);
        }
        return destinations;
    }
13854
public static String[] extractParameterMultiple(String name, Map parameters) {
		String paramValues = extractParameter(name, parameters);
		return StringUtils.stripAll(StringUtils.split(paramValues, ", "));
	}
671116
static Map<String,String> loadPropertiesMap(InputStream s) throws IOException {
        final Map<String, String> ordered = new LinkedHashMap<>();
        //Hack to use properties class to parse but our map for preserved order
        Properties bp = new Properties() {
            @Override
            public synchronized Object put(Object key, Object value) {
                ordered.put((String)key, (String)value);
                return super.put(key, value);
            }
        };
        bp.load(s);

        final Pattern propertyRegex = Pattern.compile(Pattern.quote("${") + "[^" + Pattern.quote("{[()]}") + "]*" + Pattern.quote("}"));

        final Map<String, String> resolved = new LinkedHashMap<>(ordered.size());

        for (String k : ordered.keySet()) {
            String value = ordered.get(k);

            Matcher matcher = propertyRegex.matcher(value);

            // cycles would loop indefinitely here :-|
            while (matcher.find()) {
                int start = matcher.start(0);
                int end = matcher.end(0);
                String subKey = value.substring(start + 2, end - 1);
                String subValue = resolved.get(subKey);
                if (subValue == null)
                    subValue = System.getProperty(subKey);
                value = value.substring(0, start) + subValue + value.substring(end);
            }

            resolved.put(k, value);
        }
        return resolved;
    }
483568
public static String [] parseArray(String s) {
		// a:2:{i:0;s:12:"PHPSUD_OBJ_2";i:1;s:12:"PHPSUD_OBJ_3";}
		String [] t = s.split(":");
		int z = Integer.parseInt(t[1]);
		String [] res = new String[z];
		for(int i = 0; i < z; i ++) {
			 String a = t[5 + 3*i].split(";")[0];
			 res[i] = a.substring(1).substring(0, a.length() - 2);
		}
		return res;
	}
1008017
@Nonnull
  @ReturnsMutableCopy
  public ICommonsMap <String, String> parse (@Nullable final String sStr, final char cSeparator)
  {
    final ICommonsMap <String, String> ret = new CommonsHashMap <> ();
    if (sStr != null)
    {
      final char [] aChars = sStr.toCharArray ();
      m_aChars = aChars;
      m_nPos = 0;
      m_nLen = sStr.length ();

      while (_hasChar ())
      {
        String sParamName = _parseToken ('=', cSeparator);
        String sParamValue = null;
        if (_hasChar () && aChars[m_nPos] == '=')
        {
          // skip '='
          m_nPos++;
          sParamValue = _parseQuotedToken (cSeparator);
        }
        if (_hasChar () && aChars[m_nPos] == cSeparator)
        {
          // skip separator
          m_nPos++;
        }
        if (StringHelper.hasText (sParamName))
        {
          if (m_bLowerCaseNames)
            sParamName = sParamName.toLowerCase (Locale.US);
          ret.put (sParamName, sParamValue);
        }
      }
    }
    return ret;
  }
1091613
public static Object parseStrict(String s) throws ParseException {
		return new JSONParser(MODE_RFC4627).parse(s, defaultReader.DEFAULT);
	}
377300
public final <R> Parser<R> map(final Function<? super T, ? extends R> map) {
    return new Parser<R>() {
      @Override boolean apply(final ParseContext ctxt) {
        final boolean r = Parser.this.apply(ctxt);
        if (r) {
          ctxt.result = map.apply(Parser.this.getReturn(ctxt));
        }
        return r;
      }
      @Override public String toString() {
        return map.toString();
      }
    };
  }
140052
public static Map<String, String> getUrlParams(String param) {
        Map<String, String> map = new HashMap<String, String>();
        if (StringUtils.isEmpty(param)) {
            return map;
        }
        String[] params = param.split("&");
        for (int i = 0; i < params.length; i++) {
            String[] p = params[i].split("=");
            if (p.length == 2) {
                map.put(p[0], p[1]);
            }
        }
        return map;
    }
663384
public static Map<String, QueryParameter> toMap(List<QueryParameter> parameters) {
        Map<String, QueryParameter> map = new HashMap<String, QueryParameter>();
        for (QueryParameter qp : parameters) {
            map.put(qp.getName(), qp);
        }
        return map;
    }