src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java

Print this page

        

*** 130,140 **** } private static final int NO_LIMIT = 0; /** * Values of the properties */ ! private final int[] values; /** * States of the settings for each property */ private State[] states; /** --- 130,140 ---- } private static final int NO_LIMIT = 0; /** * Values of the properties */ ! private int[] values; /** * States of the settings for each property */ private State[] states; /**
*** 167,180 **** * Instantiate Security Manager in accordance with the status of * secure processing * @param secureProcessing */ public XMLSecurityManager(boolean secureProcessing) { ! limitAnalyzer = new XMLLimitAnalyzer(this); ! values = new int[Limit.values().length]; ! states = new State[Limit.values().length]; ! isSet = new boolean[Limit.values().length]; this.secureProcessing = secureProcessing; for (Limit limit : Limit.values()) { if (secureProcessing) { values[limit.ordinal()] = limit.secureValue; states[limit.ordinal()] = State.FSP; --- 167,177 ---- * Instantiate Security Manager in accordance with the status of * secure processing * @param secureProcessing */ public XMLSecurityManager(boolean secureProcessing) { ! init(); this.secureProcessing = secureProcessing; for (Limit limit : Limit.values()) { if (secureProcessing) { values[limit.ordinal()] = limit.secureValue; states[limit.ordinal()] = State.FSP;
*** 185,194 **** --- 182,224 ---- } //read system properties or jaxp.properties readSystemProperties(); } + /** + * Clone a security manager + * @param securityManager a base security manager + */ + public XMLSecurityManager(XMLSecurityManager securityManager) { + init(); + if (securityManager != null) { + this.secureProcessing = securityManager.isSecureProcessing(); + for (Limit limit : Limit.values()) { + values[limit.ordinal()] = securityManager.getLimit(limit); + states[limit.ordinal()] = securityManager.getState(limit); + } + } + } + + /** + * Initialize values + */ + private void init() { + limitAnalyzer = new XMLLimitAnalyzer(this); + int numOfElements = Limit.values().length; + values = new int[numOfElements]; + states = new State[numOfElements]; + isSet = new boolean[numOfElements]; + } + + /** + * Reset all limits to their default status + */ + public void resetLimits() { + limitAnalyzer.reset(); + } + /** * Setting FEATURE_SECURE_PROCESSING explicitly */ public void setSecureProcessing(boolean secure) { secureProcessing = secure;