< prev index next >

src/jdk/nashorn/internal/runtime/options/Options.java

Print this page

        

*** 134,156 **** @Override public String toString() { return options.toString(); } /** * Convenience function for getting system properties in a safe way * @param name of boolean property * @param defValue default value of boolean property * @return true if set to true, default value if unset or set to false */ public static boolean getBooleanProperty(final String name, final Boolean defValue) { ! Objects.requireNonNull(name); ! if (!name.startsWith("nashorn.")) { ! throw new IllegalArgumentException(name); ! } ! return AccessController.doPrivileged( new PrivilegedAction<Boolean>() { @Override public Boolean run() { try { --- 134,158 ---- @Override public String toString() { return options.toString(); } + private static void checkPropertyName(final String name) { + if (! Objects.requireNonNull(name).startsWith("nashorn.")) { + throw new IllegalArgumentException(name); + } + } + /** * Convenience function for getting system properties in a safe way * @param name of boolean property * @param defValue default value of boolean property * @return true if set to true, default value if unset or set to false */ public static boolean getBooleanProperty(final String name, final Boolean defValue) { ! checkPropertyName(name); return AccessController.doPrivileged( new PrivilegedAction<Boolean>() { @Override public Boolean run() { try {
*** 183,197 **** * @param name of string property * @param defValue the default value if unset * @return string property if set or default value */ public static String getStringProperty(final String name, final String defValue) { ! Objects.requireNonNull(name); ! if (! name.startsWith("nashorn.")) { ! throw new IllegalArgumentException(name); ! } ! return AccessController.doPrivileged( new PrivilegedAction<String>() { @Override public String run() { try { --- 185,195 ---- * @param name of string property * @param defValue the default value if unset * @return string property if set or default value */ public static String getStringProperty(final String name, final String defValue) { ! checkPropertyName(name); return AccessController.doPrivileged( new PrivilegedAction<String>() { @Override public String run() { try {
*** 210,224 **** * @param name of integer property * @param defValue the default value if unset * @return integer property if set or default value */ public static int getIntProperty(final String name, final int defValue) { ! Objects.requireNonNull(name); ! if (! name.startsWith("nashorn.")) { ! throw new IllegalArgumentException(name); ! } ! return AccessController.doPrivileged( new PrivilegedAction<Integer>() { @Override public Integer run() { try { --- 208,218 ---- * @param name of integer property * @param defValue the default value if unset * @return integer property if set or default value */ public static int getIntProperty(final String name, final int defValue) { ! checkPropertyName(name); return AccessController.doPrivileged( new PrivilegedAction<Integer>() { @Override public Integer run() { try {
< prev index next >