expand a keyString that may contain referecnes to other properties
@param keyString string containing props
@param project Ant project
@return expanded string
173286
public static String expand(String keyString, Project project) {
        return expand(keyString, project.getProperties());
    }
984222
function stringifyString( v , runtime , isTemplateSentence ) {
	var maybeDollar = '' ;

	if ( isTemplateSentence ) {
		if ( v.key ) {
			v = v.key ;
			maybeDollar = '$' ;
		}
		else {
			runtime.str += runtime.depth ? ' <Sentence>' : '<Sentence>' ;
			return ;
		}
	}

	if ( runtime.preferQuotes ) {
		return stringifyStringMaybeQuotes( v , runtime , maybeDollar ) ;
	}

	return stringifyStringMaybeStringLine( v , runtime , maybeDollar ) ;

}
1290237
public static Properties toProperties(String propString) {
		Properties prop = new Properties();
		try {
			prop.load(new StringReader(propString));
			return prop;
		} catch (IOException e) {
			JK.throww(e);
			return null;
		}
	}
1208229
public static String[] getArgs(final String patternString, final String sourceString, final String[] keywordPrecedence) {

        log.debug("Util getArgs String[] with pattern: " + patternString + " and sourceStr: "
                + sourceString);

        String[] rtn = null;

        ArrayList<String> argsList = null;

        String patternCopy = new String(patternString);
        if (keywordPrecedence != null && StringUtils.startsWithAny(patternString, keywordPrecedence)){
            //
            for (String s : keywordPrecedence){


                patternCopy = StringUtils.removeStart(patternCopy, s);
            }

            patternCopy = "(?:" + StringUtils.join(keywordPrecedence, "|") + ")" + patternCopy;
        }


        final Pattern pattern = Pattern.compile(patternCopy);
        final Matcher matcher = pattern.matcher(sourceString);

        final int groupCount = matcher.groupCount();

        // TODO - this doesn't work if we're not doing strict matching
        if (matcher.find()) {

            for (int i = 1; i <= groupCount; i++) {
                final String arg = matcher.group(i);

                if (arg != null) {
                    if (argsList == null) {
                        argsList = new ArrayList<String>();
                    }
                    argsList.add(arg);
                }
            }
        }

        if (argsList != null) {
            rtn = argsList.toArray(new String[argsList.size()]);

            if (log.isDebugEnabled()) {

                final StringBuilder buf = new StringBuilder();
                buf.append("returning args: ");

                for (final String s : argsList) {

                    buf.append("[").append(s).append("] ");
                }

                log.debug(buf.toString());
            }

        }

        return rtn;
    }
130766
public Query addRefinementsByString(String refinementString) {
    if (refinementString == null) {
      return this;
    }
    String[] filterStrings = splitRefinements(refinementString);
    for (String filterString : filterStrings) {
      if (StringUtils.isBlank(filterString) || "=".equals(filterString)) {
        continue;
      }
      int colon = filterString.indexOf(":");
      int equals = filterString.indexOf("=");
      boolean isRange = colon != -1 && equals == -1;
      String[] nameValue = filterString.split("[:=]", 2);
      Refinement refinement;
      if (isRange) {
        RefinementRange rr = new RefinementRange();
        if (nameValue[1].endsWith("..")) {
          rr.setLow(nameValue[1].split(DOTS)[0]);
          rr.setHigh("");
        } else if (nameValue[1].startsWith("..")) {
          rr.setLow("");
          rr.setHigh(nameValue[1].split(DOTS)[1]);
        } else {
          String[] lowHigh = nameValue[1].split(DOTS);
          rr.setLow(lowHigh[0]);
          rr.setHigh(lowHigh[1]);
        }
        refinement = rr;
      } else {
        refinement = new RefinementValue();
        ((RefinementValue) refinement).setValue(nameValue[1]);
      }
      if (StringUtils.isNotBlank(nameValue[0])) {
        addRefinement(nameValue[0], refinement);
      }
    }
    return this;
  }
489048
void put(HashMap<String, String> props, Names name, String value) {
        // BUGZILLA 1610 - "java.util.Properties" ist von Hashtable abgeleitet und unterstuetzt keine NULL-Werte
        if (value == null)
            return;

        props.put(name.getValue(), value);
    }
871095
private static String updatedField( Properties props, String fieldName ) {

		String property = props.getProperty( fieldName );
		if( property != null )
			property = property.replace( "\\:", ":" );

		return property;
	}
574412
public PrimaryKey addComponent(String keyAttributeName, Object keyAttributeValue) {
        components.put(keyAttributeName,
            new KeyAttribute(keyAttributeName, keyAttributeValue));
        return this;
    }
327892
public static void setCustomProperties(Map<String, Object> d) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "setCustomProperties");
        }

        String ky;
        String propertyKey;

        // For comparison purposes we need the mixed case key strings coming from metatype.xml and server.xml to be in lower case.
        Set<String> newKeySet = new HashSet<String>();                                                
        for (String key:d.keySet()) {                                                                 
            newKeySet.add(key.toLowerCase());                                                         
        }                                                                                             

        // go through each entry that is in the set of keys that we are getting from metatype.xml and server.xml
        for (Map.Entry<String, Object> entry : d.entrySet()) {
            ky = entry.getKey();
            Object value = entry.getValue();
        
            // using the lower case value of short or long name that was configured
            // see if the string maps to one of the short names in our table.
            // if it matches then get the long name back.  otherwise keep the name as is.
            propertyKey = getStringKey(ky.toLowerCase());
            
            if (!ky.equalsIgnoreCase(propertyKey)) {
                // found in map - check existence of fully qualified prop as well
                // if we mapped to a new long name, see if it is already in the passed in data because
                // configured long names have priority, and if it is in the table elsewhere, then don't use
                // this mapped short name value, because the long name was set in server.xml
                if (newKeySet.contains(propertyKey)) {                                           
                    continue;
                }
            }
            
            // store all values as lower case, so as to read them later in a consistent fashion
            propertyKey =  propertyKey.toLowerCase();
            
            if (value instanceof String) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Key: " + propertyKey + "  type: String  value: " + value);
                }
                customProps.setProperty(propertyKey, (String) value);

            } else if (value instanceof Boolean) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Key: " + propertyKey + "  type: Boolean  value: " + ((Boolean) value).toString());
                }
                customProps.setProperty(propertyKey, ((Boolean) value).toString());

            } else if (value instanceof Integer) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Key: " + propertyKey + "  type: Integer  value: " + ((Integer) value).toString());
                }
                customProps.setProperty(propertyKey, ((Integer) value).toString());
            } else {
                // don't update, not a custom property we care about here
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Key not processed due to type, Key: " + propertyKey);
                }
            }
        }

        setCustomPropertyVariables(); //Need to update all the variables.

        setCustomizedDefaultValues(); //Customize default value depending on servlet level, initial size....etc..

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "setCustomProperties");
        }

    }
1112594
private void convertPropertiesMap(CompilerOptions options) {
    @SuppressWarnings("unchecked")
    Map<String, Object> props = getProject().getProperties();
    for (Map.Entry<String, Object> entry : props.entrySet()) {
      String key = entry.getKey();
      Object value = entry.getValue();

      if (key.startsWith(replacePropertiesPrefix)) {
        key = key.substring(replacePropertiesPrefix.length());

        if (!setDefine(options, key, value)) {
          log("Unexpected property value for key=" + key + "; value=" + value);
        }
      }
    }
  }
484047
public static String updateProperties( String propertiesContent, Map<String,String> keyToNewValue ) {

		for( Map.Entry<String,String> entry : keyToNewValue.entrySet()) {
			propertiesContent = propertiesContent.replaceFirst(
					"(?mi)^\\s*" + entry.getKey() + "\\s*[:=][^\n]*$",
					entry.getKey() + " = " + entry.getValue());
		}

		return propertiesContent;
	}
1263197
public static Properties propertiesFromString(String propString) throws IOException {
        Properties props = new Properties();


        String pstring = URLDecoder.decode(propString, "ISO-8859-1");


        props.load(new ByteArrayInputStream(pstring.getBytes()));
        return props;
    }
82160
private void putPropertyStrings(Service s) {
        String type = s.getType();
        String algorithm = s.getAlgorithm();
        // use super() to avoid permission check and other processing
        super.put(type + "." + algorithm, s.getClassName());
        for (String alias : s.getAliases()) {
            super.put(ALIAS_PREFIX + type + "." + alias, algorithm);
        }
        for (Map.Entry<UString,String> entry : s.attributes.entrySet()) {
            String key = type + "." + algorithm + " " + entry.getKey();
            super.put(key, entry.getValue());
        }
        if (registered) {
            Security.increaseVersion();
        }
    }
927598
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) {
    if (propsMap == null) {
      return null;
    }

    final String source = (String) propsMap.get("source");
    final Map<String, String> propsParams =
        (Map<String, String>) propsMap.get("props");

    final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent");
    final Props parentProps = fromHierarchicalMap(parent);

    final Props props = new Props(parentProps, propsParams);
    props.setSource(source);
    return props;
  }
510152
protected StringConcatenationClient generateKeyword(final String keyword, final String comment, Map<String, String> getters) {
		final String fieldName = keyword.toUpperCase().replaceAll("[^a-zA-Z0-9_]+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
		final String methodName = Strings.toFirstUpper(keyword.replaceAll("[^a-zA-Z0-9_]+", "_")) //$NON-NLS-1$ //$NON-NLS-2$
				+ "Keyword"; //$NON-NLS-1$
		if (getters != null) {
			getters.put(methodName, keyword);
		}
		return new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("\tprivate static final String "); //$NON-NLS-1$
				it.append(fieldName);
				it.append(" = \""); //$NON-NLS-1$
				it.append(Strings.convertToJavaString(keyword));
				it.append("\";"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Keyword: {@code "); //$NON-NLS-1$
				it.append(protectCommentKeyword(keyword));
				it.append("}."); //$NON-NLS-1$
				it.newLine();
				if (!Strings.isEmpty(comment)) {
					it.append("\t * Source: "); //$NON-NLS-1$
					it.append(comment);
					it.newLine();
				}
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\tpublic String get"); //$NON-NLS-1$
				it.append(methodName);
				it.append("() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn "); //$NON-NLS-1$
				it.append(fieldName);
				it.append(";"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}
		};
	}
18705
public String shortKey(String keyName) {

        String value = keyDefault(keyName + CmsMessages.KEY_SHORT_SUFFIX, (String)null);
        if (value == null) {
            // short key value not found, return "long" key value
            return key(keyName);
        }
        return value;
    }
549974
@Override
  public String expand(Map<String, ?> variables) {
    String name = this.name.expand(variables);
    return this.queryString(name, super.expand(variables));
  }