427 * @param value the value of the property 428 * @throws IllegalArgumentException if the value is invalid 429 */ 430 private void setProperty(int index, State state, String value) { 431 if (value != null && value.length() != 0) { 432 if (index == Feature.PREFER.ordinal()) { 433 if (!value.equals(PREFER_SYSTEM) && !value.equals(PREFER_PUBLIC)) { 434 CatalogMessages.reportIAE(new Object[]{value, Feature.PREFER.name()}, null); 435 } 436 } else if (index == Feature.DEFER.ordinal()) { 437 if (!value.equals(DEFER_TRUE) && !value.equals(DEFER_FALSE)) { 438 CatalogMessages.reportIAE(new Object[]{value, Feature.DEFER.name()}, null); 439 } 440 } else if (index == Feature.RESOLVE.ordinal()) { 441 if (!value.equals(RESOLVE_STRICT) && !value.equals(RESOLVE_CONTINUE) 442 && !value.equals(RESOLVE_IGNORE)) { 443 CatalogMessages.reportIAE(new Object[]{value, Feature.RESOLVE.name()}, null); 444 } 445 } else if (index == Feature.FILES.ordinal()) { 446 try { 447 if (Util.verifyAndGetURI(value, null) == null) { 448 CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null); 449 } 450 }catch (MalformedURLException | URISyntaxException | IllegalArgumentException ex) { 451 CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, ex); 452 } 453 454 } 455 if (states[index] == null || state.compareTo(states[index]) >= 0) { 456 values[index] = value; 457 states[index] = state; 458 } 459 } else { 460 if (state == State.SYSTEMPROPERTY || state == State.JAXPDOTPROPERTIES) { 461 CatalogMessages.reportIAE(new Object[]{value, Feature.values()[index].name()}, null); 462 } 463 } 464 } 465 466 /** 467 * Reads from system properties, or those in jaxp.properties 468 */ 469 private void readSystemProperties() { 470 for (Feature cf : Feature.values()) { 471 getSystemProperty(cf, cf.getPropertyName()); 472 } 473 } | 427 * @param value the value of the property 428 * @throws IllegalArgumentException if the value is invalid 429 */ 430 private void setProperty(int index, State state, String value) { 431 if (value != null && value.length() != 0) { 432 if (index == Feature.PREFER.ordinal()) { 433 if (!value.equals(PREFER_SYSTEM) && !value.equals(PREFER_PUBLIC)) { 434 CatalogMessages.reportIAE(new Object[]{value, Feature.PREFER.name()}, null); 435 } 436 } else if (index == Feature.DEFER.ordinal()) { 437 if (!value.equals(DEFER_TRUE) && !value.equals(DEFER_FALSE)) { 438 CatalogMessages.reportIAE(new Object[]{value, Feature.DEFER.name()}, null); 439 } 440 } else if (index == Feature.RESOLVE.ordinal()) { 441 if (!value.equals(RESOLVE_STRICT) && !value.equals(RESOLVE_CONTINUE) 442 && !value.equals(RESOLVE_IGNORE)) { 443 CatalogMessages.reportIAE(new Object[]{value, Feature.RESOLVE.name()}, null); 444 } 445 } else if (index == Feature.FILES.ordinal()) { 446 try { 447 String[] catalogFile = value.split(";[ ]*"); 448 for (String temp : catalogFile) { 449 if (Util.verifyAndGetURI(temp, null) == null) { 450 CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null); 451 } 452 } 453 }catch (MalformedURLException | URISyntaxException | IllegalArgumentException ex) { 454 CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, ex); 455 } 456 } 457 if (states[index] == null || state.compareTo(states[index]) >= 0) { 458 values[index] = value; 459 states[index] = state; 460 } 461 } else { 462 if (state == State.SYSTEMPROPERTY || state == State.JAXPDOTPROPERTIES) { 463 CatalogMessages.reportIAE(new Object[]{value, Feature.values()[index].name()}, null); 464 } 465 } 466 } 467 468 /** 469 * Reads from system properties, or those in jaxp.properties 470 */ 471 private void readSystemProperties() { 472 for (Feature cf : Feature.values()) { 473 getSystemProperty(cf, cf.getPropertyName()); 474 } 475 } |