66 String msg = rb.getString(key); 67 if (arguments != null) { 68 msg = MessageFormat.format(msg, arguments); 69 } 70 return msg; 71 } 72 73 /** 74 * Reads JAXP system property with privilege 75 * 76 * @param propName the name of the property 77 * @return the value of the property 78 */ 79 public static String getSystemProperty(final String propName) { 80 return 81 AccessController.doPrivileged( 82 (PrivilegedAction<String>) () -> (String)System.getProperty(propName)); 83 } 84 85 /** 86 * Reads JAXP system property in this order: system property, 87 * $java.home/conf/jaxp.properties if the system property is not specified 88 * 89 * @param propName the name of the property 90 * @return the value of the property 91 */ 92 public static String getJAXPSystemProperty(String propName) { 93 String value = getSystemProperty(propName); 94 if (value == null) { 95 value = readJAXPProperty(propName); 96 } 97 return value; 98 } 99 100 /** 101 * Reads the specified property from $java.home/conf/jaxp.properties 102 * 103 * @param propName the name of the property 104 * @return the value of the property 105 */ | 66 String msg = rb.getString(key); 67 if (arguments != null) { 68 msg = MessageFormat.format(msg, arguments); 69 } 70 return msg; 71 } 72 73 /** 74 * Reads JAXP system property with privilege 75 * 76 * @param propName the name of the property 77 * @return the value of the property 78 */ 79 public static String getSystemProperty(final String propName) { 80 return 81 AccessController.doPrivileged( 82 (PrivilegedAction<String>) () -> (String)System.getProperty(propName)); 83 } 84 85 /** 86 * Reads boolean type system property. 87 * 88 * @param propName the name of the property 89 * @param defValue the default value 90 * @return the value of the property, or the default value of no system 91 * property is found 92 */ 93 public static boolean getJAXPSystemProperty(String propName, boolean defValue) { 94 String value = getJAXPSystemProperty(propName); 95 if (value == null) { 96 return defValue; 97 } 98 return Boolean.parseBoolean(value); 99 } 100 101 /** 102 * Reads JAXP system property in this order: system property, 103 * $java.home/conf/jaxp.properties if the system property is not specified 104 * 105 * @param propName the name of the property 106 * @return the value of the property 107 */ 108 public static String getJAXPSystemProperty(String propName) { 109 String value = getSystemProperty(propName); 110 if (value == null) { 111 value = readJAXPProperty(propName); 112 } 113 return value; 114 } 115 116 /** 117 * Reads the specified property from $java.home/conf/jaxp.properties 118 * 119 * @param propName the name of the property 120 * @return the value of the property 121 */ |