Mercurial > hg > openjdk > bsd-port > jaxp
changeset 868:359b79d99538 jdk7u60-b03
Merge
author | asaha |
---|---|
date | Thu, 02 Jan 2014 09:44:24 -0800 |
parents | 9a25d3fb6e09 (current diff) 5d1c151c6931 (diff) |
children | 7215972c2c30 |
files | .hgtags |
diffstat | 15 files changed, 164 insertions(+), 200 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed Dec 18 15:56:45 2013 -0800 +++ b/.hgtags Thu Jan 02 09:44:24 2014 -0800 @@ -382,6 +382,24 @@ 4beb90ab48f7fd46c7a9afbe66f8cccb230699ba jdk7u45-b18 a456c78a50e201a65c9f63565c8291b84a4fbd32 jdk7u45-b30 3c34f244296e98d8ebb94973c752f3395612391a jdk7u45-b31 +056494e83d15cd1c546d32a3b35bdb6f670b3876 jdk7u45-b33 +b5a83862ed2ab9cc2de3719e38c72519481a4bbb jdk7u45-b34 +0a8b95184728548be4b20876e05f76e0262e4195 jdk7u51-b00 +2450ace952f45202e5a3fd4f6a8356a196fe029e jdk7u51-b01 +68def851cc6b17944756f1986734b323d8569571 jdk7u51-b02 +0df316a3b3111427500a86f3282293dd566ae936 jdk7u51-b03 +42be8e6266ab1733a890b21cf6cd6c2e1a48972d jdk7u51-b04 +0655a95d16094971df14171e1c5f841c3a6bd081 jdk7u51-b05 +13a15fc9b6bf7ac065958e038648fbe9952fd9fa jdk7u51-b06 +8e4523e579bf86e514b9c82843b440cb79606b41 jdk7u51-b07 +783ceae9b7369168216d5344475d92de910351e8 jdk7u51-b08 +7875c882a7516366147bffcaaea550c4089f2fc7 jdk7u51-b09 +65798d05674dc9453c5935c018d012b11c8697f8 jdk7u51-b10 +70b5691c44d2830efd4301856e6223fa43894462 jdk7u51-b11 +807946db29f42477e8d8390be01c7e27280bc85c jdk7u51-b12 +114654a331e2f97a048d7ed43d06d7512e20e2c1 jdk7u51-b13 +3161567adae93d12c64b79592bda3046f0c0a22d jdk7u51-b30 +e85ee81daec2ea2fa21bf804d03431b0664c6dff jdk7u51-b31 d9b92749a0f4c8e6c6f4fe11210c2a02d70bae74 jdk7u60-b00 ad39e88c503948fc4fc01e97c75b6e3c24599d23 jdk7u60-b01 050986fd54e3ec4515032ee938bc59e86772b6c0 jdk7u60-b02
--- a/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java Thu Jan 02 09:44:24 2014 -0800 @@ -52,6 +52,8 @@ */ public class ExsltStrings extends ExsltBase { + static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"; + /** * The str:align function aligns a string within another string. * <p> @@ -225,7 +227,7 @@ token = str.substring(fromIndex); } - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { Element element = doc.createElement("token"); @@ -289,7 +291,7 @@ { StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { while (lTokenizer.hasMoreTokens()) @@ -305,7 +307,7 @@ else { - Document doc = DocumentHolder.m_doc; + Document doc = getDocument(); synchronized (doc) { for (int i = 0; i < toTokenize.length(); i++) @@ -327,31 +329,23 @@ { return tokenize(toTokenize, " \t\n\r"); } + /** - * This class is not loaded until first referenced (see Java Language - * Specification by Gosling/Joy/Steele, section 12.4.1) - * - * The static members are created when this class is first referenced, as a - * lazy initialization not needing checking against null or any - * synchronization. - * + * @return an instance of DOM Document */ - private static class DocumentHolder - { - // Reuse the Document object to reduce memory usage. - private static final Document m_doc; - static { - try - { - m_doc =DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + private static Document getDocument() + { + try + { + if (System.getSecurityManager() == null) { + return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + } else { + return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); } - - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } - + } + catch(ParserConfigurationException pce) + { + throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); } } - }
--- a/src/com/sun/org/apache/xalan/internal/lib/Extensions.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xalan/internal/lib/Extensions.java Thu Jan 02 09:44:24 2014 -0800 @@ -56,6 +56,7 @@ */ public class Extensions { + static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"; /** * Constructor Extensions * @@ -114,23 +115,14 @@ // This no longer will work right since the DTM. // Document myDoc = myProcessor.getContextNode().getOwnerDocument(); - try - { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document myDoc = db.newDocument(); - - Text textNode = myDoc.createTextNode(textNodeValue); - DocumentFragment docFrag = myDoc.createDocumentFragment(); + Document myDoc = getDocument(); - docFrag.appendChild(textNode); + Text textNode = myDoc.createTextNode(textNodeValue); + DocumentFragment docFrag = myDoc.createDocumentFragment(); - return new NodeSet(docFrag); - } - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } + docFrag.appendChild(textNode); + + return new NodeSet(docFrag); } } @@ -249,8 +241,7 @@ public static NodeList tokenize(String toTokenize, String delims) { - Document doc = DocumentHolder.m_doc; - + Document doc = getDocument(); StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); NodeSet resultSet = new NodeSet(); @@ -308,17 +299,7 @@ public static Node checkEnvironment(ExpressionContext myContext) { - Document factoryDocument; - try - { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - factoryDocument = db.newDocument(); - } - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } + Document factoryDocument = getDocument(); Node resultNode = null; try @@ -391,30 +372,21 @@ } /** - * This class is not loaded until first referenced (see Java Language - * Specification by Gosling/Joy/Steele, section 12.4.1) - * - * The static members are created when this class is first referenced, as a - * lazy initialization not needing checking against null or any - * synchronization. - * + * @return an instance of DOM Document */ - private static class DocumentHolder - { - // Reuse the Document object to reduce memory usage. - private static final Document m_doc; - static + private static Document getDocument() + { + try { - try - { - m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + if (System.getSecurityManager() == null) { + return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + } else { + return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument(); } - - catch(ParserConfigurationException pce) - { - throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); - } - + } + catch(ParserConfigurationException pce) + { + throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce); } } }
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Thu Jan 02 09:44:24 2014 -0800 @@ -44,6 +44,7 @@ import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler; import com.sun.org.apache.xerces.internal.impl.Constants; +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager; import com.sun.xml.internal.stream.Entity; @@ -262,6 +263,11 @@ fEntityManager.startDTDEntity(inputSource); } // setInputSource(XMLInputSource) + + public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer) { + fLimitAnalyzer = limitAnalyzer; + } + /** * Scans the external subset of the document. * @@ -1625,10 +1631,10 @@ XMLString literal = fString; XMLString literal2 = fString; int countChar = 0; - if (fLimitAnalyzer == null && fSecurityManager != null) { - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + if (fLimitAnalyzer == null ) { + fLimitAnalyzer = new XMLLimitAnalyzer(); + } fLimitAnalyzer.startEntity(entityName); - } if (fEntityScanner.scanLiteral(quote, fString) != quote) { fStringBuffer.clear(); @@ -2145,6 +2151,8 @@ // set starting state setScannerState(SCANNER_STATE_TEXT_DECL); //new SymbolTable()); + + fLimitAnalyzer = new XMLLimitAnalyzer(); } /** @@ -2164,18 +2172,18 @@ */ private void checkLimit(String entityName, int len) { if (fLimitAnalyzer == null) { - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + fLimitAnalyzer = new XMLLimitAnalyzer(); } fLimitAnalyzer.addValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName, len); - if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)) { - fSecurityManager.debugPrint(); + if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) { + fSecurityManager.debugPrint(fLimitAnalyzer); reportFatalError("MaxEntitySizeLimit", new Object[]{entityName, fLimitAnalyzer.getValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT), fSecurityManager.getLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT), fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)}); } - if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)) { - fSecurityManager.debugPrint(); + if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) { + fSecurityManager.debugPrint(fLimitAnalyzer); reportFatalError("TotalEntitySizeLimit", new Object[]{fLimitAnalyzer.getTotalValue(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT), fSecurityManager.getLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT),
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Thu Jan 02 09:44:24 2014 -0800 @@ -569,32 +569,13 @@ // xerces features fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true); - fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); - - fElementAttributeLimit = (fSecurityManager != null)? - fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0; - fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false); Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null); fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ? (ExternalSubsetResolver) resolver : null; - // initialize vars - fMarkupDepth = 0; - fCurrentElement = null; - fElementStack.clear(); - fHasExternalDTD = false; - fStandaloneSet = false; - fStandalone = false; - fInScanContent = false; - //skipping algorithm - fShouldSkip = false; - fAdd = false; - fSkip = false; - //attribute fReadingAttributes = false; //xxx: external entities are supported in Xerces @@ -606,9 +587,6 @@ // setup Driver setScannerState(SCANNER_STATE_CONTENT); setDriver(fContentDriver); - fEntityStore = fEntityManager.getEntityStore(); - - dtdGrammarUtil = null; // JAXP 1.5 features and properties XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) @@ -617,6 +595,7 @@ fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false); + resetCommon(); //fEntityManager.test(); } // reset(XMLComponentManager) @@ -630,17 +609,7 @@ fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue(); fNotifyBuiltInRefs = false ; - // initialize vars - fMarkupDepth = 0; - fCurrentElement = null; - fShouldSkip = false; - fAdd = false; - fSkip = false; - fElementStack.clear(); //fElementStack2.clear(); - fHasExternalDTD = false; - fStandaloneSet = false; - fStandalone = false; //fReplaceEntityReferences = true; //fSupportExternalEntities = true; Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES); @@ -661,20 +630,43 @@ //we dont need to do this -- nb. //setScannerState(SCANNER_STATE_CONTENT); //setDriver(fContentDriver); - fEntityStore = fEntityManager.getEntityStore(); //fEntityManager.test(); - dtdGrammarUtil = null; - // JAXP 1.5 features and properties XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + resetCommon(); } // reset(XMLComponentManager) + void resetCommon() { + // initialize vars + fMarkupDepth = 0; + fCurrentElement = null; + fElementStack.clear(); + fHasExternalDTD = false; + fStandaloneSet = false; + fStandalone = false; + fInScanContent = false; + //skipping algorithm + fShouldSkip = false; + fAdd = false; + fSkip = false; + + fEntityStore = fEntityManager.getEntityStore(); + dtdGrammarUtil = null; + + if (fSecurityManager != null) { + fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT); + } else { + fElementAttributeLimit = 0; + } + fLimitAnalyzer = new XMLLimitAnalyzer(); + fEntityManager.setLimitAnalyzer(fLimitAnalyzer); + } + /** * Returns a list of feature identifiers that are recognized by * this component. This method may return null if no features @@ -1328,7 +1320,7 @@ fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", - new Object[]{rawname, new Integer(fAttributes.getLength()) }, + new Object[]{rawname, fElementAttributeLimit }, XMLErrorReporter.SEVERITY_FATAL_ERROR ); } @@ -3163,15 +3155,15 @@ protected void checkLimit(XMLStringBuffer buffer) { if (fLimitAnalyzer.isTracking(fCurrentEntityName)) { fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length); - if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) { - fSecurityManager.debugPrint(); + if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) { + fSecurityManager.debugPrint(fLimitAnalyzer); reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName, fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT), fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT), fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)}); } - if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) { - fSecurityManager.debugPrint(); + if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) { + fSecurityManager.debugPrint(fLimitAnalyzer); reportFatalError("TotalEntitySizeLimit", new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT), fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Thu Jan 02 09:44:24 2014 -0800 @@ -1090,6 +1090,8 @@ ((XMLDTDScannerImpl)fDTDScanner).reset(fPropertyManager); } + + fDTDScanner.setLimitAnalyzer(fLimitAnalyzer); do { again = false; switch (fScannerState) {
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Thu Jan 02 09:44:24 2014 -0800 @@ -1297,8 +1297,8 @@ if(fLimitAnalyzer != null) { fLimitAnalyzer.addValue(entityExpansionIndex, name, 1); } - if( fSecurityManager != null && fSecurityManager.isOverLimit(entityExpansionIndex)){ - fSecurityManager.debugPrint(); + if( fSecurityManager != null && fSecurityManager.isOverLimit(entityExpansionIndex, fLimitAnalyzer)){ + fSecurityManager.debugPrint(fLimitAnalyzer); fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"EntityExpansionLimitExceeded", new Object[]{fSecurityManager.getLimitValueByIndex(entityExpansionIndex)}, XMLErrorReporter.SEVERITY_FATAL_ERROR ); @@ -1367,7 +1367,7 @@ if (fLimitAnalyzer != null) { fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntity.name); if (fCurrentEntity.name.equals("[xml]")) { - fSecurityManager.debugPrint(); + fSecurityManager.debugPrint(fLimitAnalyzer); } } fCurrentEntity.close(); @@ -1436,7 +1436,6 @@ fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); // initialize state //fStandalone = false; @@ -1498,7 +1497,6 @@ fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null); fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null); fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT); // JAXP 1.5 feature @@ -1656,7 +1654,6 @@ if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() && propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) { fSecurityManager = (XMLSecurityManager)value; - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); } } @@ -1667,6 +1664,11 @@ fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); } } + + public void setLimitAnalyzer(XMLLimitAnalyzer fLimitAnalyzer) { + this.fLimitAnalyzer = fLimitAnalyzer; + } + /** * Returns a list of property identifiers that are recognized by * this component. This method may return null if no properties
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Thu Jan 02 09:44:24 2014 -0800 @@ -256,7 +256,7 @@ fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", - new Object[]{rawname, new Integer(fAttributes.getLength()) }, + new Object[]{rawname, fElementAttributeLimit }, XMLErrorReporter.SEVERITY_FATAL_ERROR ); }
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties Thu Jan 02 09:44:24 2014 -0800 @@ -261,7 +261,7 @@ MSG_DUPLICATE_ATTDEF = \u5C5E\u6027"{1}"\u306F\u8981\u7D20\u30BF\u30A4\u30D7"{0}"\u306B\u5BFE\u3057\u3066\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002 MSG_ELEMENT_ALREADY_DECLARED = \u8981\u7D20\u30BF\u30A4\u30D7"{0}"\u306F\u8907\u6570\u56DE\u5BA3\u8A00\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002 MSG_ELEMENT_NOT_DECLARED = \u8981\u7D20\u30BF\u30A4\u30D7"{0}"\u3092\u5BA3\u8A00\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 - MSG_GRAMMAR_NOT_FOUND = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u7121\u52B9\u3067\u3059\u3002\u69CB\u6587\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 + MSG_GRAMMAR_NOT_FOUND = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u7121\u52B9\u3067\u3059: \u69CB\u6587\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 MSG_ELEMENT_WITH_ID_REQUIRED = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u306F\u8B58\u5225\u5B50"{0}"\u3092\u6301\u3064\u8981\u7D20\u304C\u5FC5\u8981\u3067\u3059\u3002 MSG_EXTERNAL_ENTITY_NOT_PERMITTED = \u5916\u90E8\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3"{0}"\u3078\u306E\u53C2\u7167\u306F\u3001\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3067\u306F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 MSG_FIXED_ATTVALUE_INVALID = \u5024"{2}"\u3092\u6301\u3064\u5C5E\u6027"{1}"\u306B\u306F\u3001"{3}"\u306E\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002
--- a/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java Thu Jan 02 09:44:24 2014 -0800 @@ -77,7 +77,6 @@ } } - private XMLSecurityManager securityManager; /** * Max value accumulated for each property */ @@ -101,8 +100,7 @@ * Default constructor. Establishes default values for known security * vulnerabilities. */ - public XMLLimitAnalyzer(XMLSecurityManager securityManager) { - this.securityManager = securityManager; + public XMLLimitAnalyzer() { values = new int[Limit.values().length]; totalValue = new int[Limit.values().length]; names = new String[Limit.values().length]; @@ -221,7 +219,7 @@ } } - public void debugPrint() { + public void debugPrint(XMLSecurityManager securityManager) { Formatter formatter = new Formatter(); System.out.println(formatter.format("%30s %15s %15s %15s %30s", "Property","Limit","Total size","Size","Entity Name"));
--- a/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Thu Jan 02 09:44:24 2014 -0800 @@ -148,7 +148,6 @@ private boolean[] isSet; - private XMLLimitAnalyzer limitAnalyzer; /** * Index of the special entityCountInfo property */ @@ -169,7 +168,6 @@ * @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]; @@ -249,13 +247,15 @@ if (index == indexEntityCountInfo) { printEntityCountInfo = (String)value; } else { - int temp = 0; - try { + int temp; + if (Integer.class.isAssignableFrom(value.getClass())) { + temp = ((Integer)value).intValue(); + } else { temp = Integer.parseInt((String) value); if (temp < 0) { temp = 0; } - } catch (NumberFormatException e) {} + } setLimit(index, state, temp); } } @@ -387,8 +387,9 @@ * @param size the size (count or length) of the entity * @return true if the size is over the limit, false otherwise */ - public boolean isOverLimit(Limit limit, String entityName, int size) { - return isOverLimit(limit.ordinal(), entityName, size); + public boolean isOverLimit(Limit limit, String entityName, int size, + XMLLimitAnalyzer limitAnalyzer) { + return isOverLimit(limit.ordinal(), entityName, size, limitAnalyzer); } /** @@ -400,7 +401,8 @@ * @param size the size (count or length) of the entity * @return true if the size is over the limit, false otherwise */ - public boolean isOverLimit(int index, String entityName, int size) { + public boolean isOverLimit(int index, String entityName, int size, + XMLLimitAnalyzer limitAnalyzer) { if (values[index] == NO_LIMIT) { return false; } @@ -418,11 +420,11 @@ * @param size the size (count or length) of the entity * @return true if the size is over the limit, false otherwise */ - public boolean isOverLimit(Limit limit) { - return isOverLimit(limit.ordinal()); + public boolean isOverLimit(Limit limit, XMLLimitAnalyzer limitAnalyzer) { + return isOverLimit(limit.ordinal(), limitAnalyzer); } - public boolean isOverLimit(int index) { + public boolean isOverLimit(int index, XMLLimitAnalyzer limitAnalyzer) { if (values[index] == NO_LIMIT) { return false; } @@ -436,29 +438,12 @@ } } - public void debugPrint() { + public void debugPrint(XMLLimitAnalyzer limitAnalyzer) { if (printEntityCountInfo.equals(Constants.JDK_YES)) { - limitAnalyzer.debugPrint(); + limitAnalyzer.debugPrint(this); } } - /** - * Return the limit analyzer - * - * @return the limit analyzer - */ - public XMLLimitAnalyzer getLimitAnalyzer() { - return limitAnalyzer; - } - - /** - * Set limit analyzer - * - * @param analyzer a limit analyzer - */ - public void setLimitAnalyzer(XMLLimitAnalyzer analyzer) { - limitAnalyzer = analyzer; - } /** * Indicate if a property is set explicitly
--- a/src/com/sun/org/apache/xerces/internal/xni/parser/XMLDTDScanner.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xerces/internal/xni/parser/XMLDTDScanner.java Thu Jan 02 09:44:24 2014 -0800 @@ -20,6 +20,7 @@ package com.sun.org.apache.xerces.internal.xni.parser; +import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer; import java.io.IOException; import com.sun.org.apache.xerces.internal.xni.XNIException; @@ -95,4 +96,5 @@ public boolean scanDTDExternalSubset(boolean complete) throws IOException, XNIException; + public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer); } // interface XMLDTDScanner
--- a/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Thu Jan 02 09:44:24 2014 -0800 @@ -24,20 +24,17 @@ package com.sun.org.apache.xml.internal.resolver; import com.sun.org.apache.xerces.internal.utils.SecuritySupport; +import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver; +import com.sun.org.apache.xml.internal.resolver.helpers.Debug; import java.io.InputStream; - +import java.net.MalformedURLException; import java.net.URL; -import java.net.MalformedURLException; - import java.util.MissingResourceException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import java.util.StringTokenizer; import java.util.Vector; - -import com.sun.org.apache.xml.internal.resolver.helpers.Debug; -import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver; -import com.sun.org.apache.xml.internal.resolver.Catalog; +import sun.reflect.misc.ReflectUtil; /** * CatalogManager provides an interface to the catalog properties. @@ -687,7 +684,7 @@ catalog = new Catalog(); } else { try { - catalog = (Catalog) Class.forName(catalogClassName).newInstance(); + catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance(); } catch (ClassNotFoundException cnfe) { debug.message(1,"Catalog class named '" + catalogClassName
--- a/src/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Thu Jan 02 09:44:24 2014 -0800 @@ -23,24 +23,21 @@ package com.sun.org.apache.xml.internal.resolver.readers; -import java.util.Hashtable; +import com.sun.org.apache.xml.internal.resolver.Catalog; +import com.sun.org.apache.xml.internal.resolver.CatalogException; +import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces; import java.io.IOException; import java.io.InputStream; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import java.net.MalformedURLException; - +import java.util.Hashtable; +import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader; -import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces; - +import org.w3c.dom.*; import org.xml.sax.SAXException; -import org.w3c.dom.*; +import sun.reflect.misc.ReflectUtil; /** * A DOM-based CatalogReader. @@ -199,7 +196,7 @@ DOMCatalogParser domParser = null; try { - domParser = (DOMCatalogParser) Class.forName(domParserClass).newInstance(); + domParser = (DOMCatalogParser) ReflectUtil.forName(domParserClass).newInstance(); } catch (ClassNotFoundException cnfe) { catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass); throw new CatalogException(CatalogException.UNPARSEABLE);
--- a/src/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Wed Dec 18 15:56:45 2013 -0800 +++ b/src/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Thu Jan 02 09:44:24 2014 -0800 @@ -23,19 +23,21 @@ package com.sun.org.apache.xml.internal.resolver.readers; -import java.util.Hashtable; +import com.sun.org.apache.xml.internal.resolver.Catalog; +import com.sun.org.apache.xml.internal.resolver.CatalogException; +import com.sun.org.apache.xml.internal.resolver.CatalogManager; +import com.sun.org.apache.xml.internal.resolver.helpers.Debug; +import java.io.FileNotFoundException; import java.io.IOException; -import java.io.FileNotFoundException; import java.io.InputStream; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import java.net.MalformedURLException; import java.net.UnknownHostException; - +import java.util.Hashtable; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.SAXParser; - import org.xml.sax.AttributeList; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -45,12 +47,7 @@ import org.xml.sax.Locator; import org.xml.sax.Parser; import org.xml.sax.SAXException; - -import com.sun.org.apache.xml.internal.resolver.Catalog; -import com.sun.org.apache.xml.internal.resolver.CatalogManager; -import com.sun.org.apache.xml.internal.resolver.CatalogException; -import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader; -import com.sun.org.apache.xml.internal.resolver.helpers.Debug; +import sun.reflect.misc.ReflectUtil; /** * A SAX-based CatalogReader. @@ -246,7 +243,7 @@ } parser.parse(new InputSource(is), spHandler); } else { - Parser parser = (Parser) Class.forName(parserClass).newInstance(); + Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance(); parser.setDocumentHandler(this); if (bResolver != null) { parser.setEntityResolver(bResolver); @@ -352,7 +349,7 @@ try { saxParser = (SAXCatalogParser) - Class.forName(saxParserClass).newInstance(); + ReflectUtil.forName(saxParserClass).newInstance(); saxParser.setCatalog(catalog); saxParser.startDocument(); @@ -413,7 +410,7 @@ try { saxParser = (SAXCatalogParser) - Class.forName(saxParserClass).newInstance(); + ReflectUtil.forName(saxParserClass).newInstance(); saxParser.setCatalog(catalog); saxParser.startDocument();