# HG changeset patch # User andrew # Date 1595593014 -3600 # Node ID bf1b7696bc62a118775262759c8b0a7979e613f9 # Parent 80af267d6aa96ff09da90a48bec8cd64114e12b8# Parent 1c5cf5eea642334bf7fd80340a152942689e2899 Merge diff -r 80af267d6aa9 -r bf1b7696bc62 .hgtags --- a/.hgtags Mon Jun 29 21:30:16 2020 +0100 +++ b/.hgtags Fri Jul 24 13:16:54 2020 +0100 @@ -1047,3 +1047,5 @@ ebb0a284b7e75dfb741af3332eb87b37aca66875 jdk8u262-b07 0cccb32a50471fd52ecf2f697d95e7254798ab26 jdk8u262-b08 779db06fb02444e294b7c93fe3902afee615df2a jdk8u262-b09 +63884b34cac1b652cf49289199a00cb363cb93dd jdk8u262-b10 +63884b34cac1b652cf49289199a00cb363cb93dd jdk8u262-ga diff -r 80af267d6aa9 -r bf1b7696bc62 src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Mon Jun 29 21:30:16 2020 +0100 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Fri Jul 24 13:16:54 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. */ /* @@ -71,6 +71,7 @@ * @author Eric Ye, IBM * * @version $Id: XMLDTDScannerImpl.java,v 1.8 2010-11-01 04:39:41 joehw Exp $ + * @LastModified: Feb 2020 */ public class XMLDTDScannerImpl extends XMLScanner @@ -615,6 +616,7 @@ if (fScannerState == SCANNER_STATE_END_OF_INPUT) return; + boolean dtdEntity = name.equals("[dtd]"); // Handle end of PE boolean reportEntity = fReportEntity; if (name.startsWith("%")) { @@ -623,8 +625,7 @@ int startMarkUpDepth = popPEStack(); // throw fatalError if this entity was incomplete and // was a freestanding decl - if(startMarkUpDepth == 0 && - startMarkUpDepth < fMarkUpDepth) { + if (startMarkUpDepth == 0 && startMarkUpDepth < fMarkUpDepth) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ILL_FORMED_PARAMETER_ENTITY_WHEN_USED_IN_DECL", new Object[]{ fEntityManager.fCurrentEntity.name}, @@ -644,12 +645,10 @@ if (fEntityScanner.isExternal()) { fExtEntityDepth--; } - } - - // call handler - boolean dtdEntity = name.equals("[dtd]"); - if (fDTDHandler != null && !dtdEntity && reportEntity) { - fDTDHandler.endParameterEntity(name, null); + // call handler + if (fDTDHandler != null && reportEntity) { + fDTDHandler.endParameterEntity(name, null); + } } // end DTD diff -r 80af267d6aa9 -r bf1b7696bc62 src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java Mon Jun 29 21:30:16 2020 +0100 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java Fri Jul 24 13:16:54 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. */ /* @@ -69,6 +69,7 @@ * @author K.Venugopal SUN Microsystems * @author Sunitha Reddy, SUN Microsystems * @version $Id: XMLScanner.java,v 1.12 2010-11-01 04:39:41 joehw Exp $ + * @LastModified: Feb 2020 */ public abstract class XMLScanner implements XMLComponent { @@ -1240,10 +1241,10 @@ * @throws XNIException Thrown by handler to signal an error. */ public void endEntity(String name, Augmentations augs) throws IOException, XNIException { - // keep track of the entity depth - fEntityDepth--; - + if (fEntityDepth > 0) { + fEntityDepth--; + } } // endEntity(String) /** diff -r 80af267d6aa9 -r bf1b7696bc62 src/com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java --- a/src/com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java Mon Jun 29 21:30:16 2020 +0100 +++ b/src/com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java Fri Jul 24 13:16:54 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -61,6 +61,7 @@ * @author Neil Graham, IBM * * @version $Id: DTDGrammar.java,v 1.4 2010/08/11 07:18:37 joehw Exp $ + * @LastModified: Feb 2020 */ public class DTDGrammar implements XMLDTDHandler, XMLDTDContentModelHandler, EntityState, Grammar { @@ -445,9 +446,12 @@ * @throws XNIException Thrown by handler to signal an error. */ public void endParameterEntity(String name, Augmentations augs) throws XNIException { - - fPEDepth--; - fReadingExternalDTD = fPEntityStack[fPEDepth]; + // redundant check as this method can only be called after parsing a PE + // incomplete or truncated DTD get caught before reaching this method + if (fPEDepth > 0) { + fPEDepth--; + fReadingExternalDTD = fPEntityStack[fPEDepth]; + } } // endParameterEntity(String,Augmentations) diff -r 80af267d6aa9 -r bf1b7696bc62 src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java --- a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Mon Jun 29 21:30:16 2020 +0100 +++ b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Fri Jul 24 13:16:54 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -106,6 +106,7 @@ * @author Andy Clark IBM * @author Neeraj Bajaj, Sun Microsystems, inc. * @version $Id: XMLSchemaValidator.java,v 1.16 2010-11-01 04:39:55 joehw Exp $ + * @LastModified: Apr 2020 */ public class XMLSchemaValidator implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler { @@ -1727,7 +1728,7 @@ // root element if (fElementDepth == -1 && fValidationManager.isGrammarFound()) { - if (fSchemaType == null) { + if (fSchemaType == null && !fUseGrammarPoolOnly) { // schemaType is not specified // if a DTD grammar is found, we do the same thing as Dynamic: // if a schema grammar is found, validation is performed;