366 if (!getSystemProperty(feature, feature.systemProperty())) {
367 //if system property is not found, try the older form if any
368 String oldName = feature.systemPropertyOld();
369 if (oldName != null) {
370 getSystemProperty(feature, oldName);
371 }
372 }
373 }
374 }
375
376 /**
377 * Read from system properties, or those in jaxp.properties
378 *
379 * @param property the type of the property
380 * @param sysPropertyName the name of system property
381 * @return true if the system property is found, false otherwise
382 */
383 private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
384 try {
385 String value = SecuritySupport.getSystemProperty(sysPropertyName);
386 if (value != null && !value.equals("")) {
387 setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
388 return true;
389 }
390
391 value = SecuritySupport.readJAXPProperty(sysPropertyName);
392 if (value != null && !value.equals("")) {
393 setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
394 return true;
395 }
396 } catch (NumberFormatException e) {
397 //invalid setting
398 throw new NumberFormatException("Invalid setting for system property: " + feature.systemProperty());
399 }
400 return false;
401 }
402
403 }
|
366 if (!getSystemProperty(feature, feature.systemProperty())) {
367 //if system property is not found, try the older form if any
368 String oldName = feature.systemPropertyOld();
369 if (oldName != null) {
370 getSystemProperty(feature, oldName);
371 }
372 }
373 }
374 }
375
376 /**
377 * Read from system properties, or those in jaxp.properties
378 *
379 * @param property the type of the property
380 * @param sysPropertyName the name of system property
381 * @return true if the system property is found, false otherwise
382 */
383 private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
384 try {
385 String value = SecuritySupport.getSystemProperty(sysPropertyName);
386 if (value != null && !value.isEmpty()) {
387 setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
388 return true;
389 }
390
391 value = SecuritySupport.readJAXPProperty(sysPropertyName);
392 if (value != null && !value.isEmpty()) {
393 setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
394 return true;
395 }
396 } catch (NumberFormatException e) {
397 //invalid setting
398 throw new NumberFormatException("Invalid setting for system property: " + feature.systemProperty());
399 }
400 return false;
401 }
402
403 }
|