--- old/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java 2016-07-24 18:45:27.928171151 -0700 +++ new/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java 2016-07-24 18:45:27.852167374 -0700 @@ -1,13 +1,13 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -22,17 +22,19 @@ import java.io.IOException; -import javax.xml.XMLConstants; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXResult; import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Validator; import com.sun.org.apache.xerces.internal.impl.Constants; +import static com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.ENTITY_RESOLVER; +import static com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.ERROR_HANDLER; +import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper; +import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper; import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter; import com.sun.org.apache.xerces.internal.util.Status; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; @@ -83,12 +85,20 @@ private boolean fResourceResolverChanged = false; /** Support current-element-node property */ - private static final String CURRENT_ELEMENT_NODE = Constants.XERCES_PROPERTY_PREFIX + Constants.CURRENT_ELEMENT_NODE_PROPERTY; + private static final String CURRENT_ELEMENT_NODE = + Constants.XERCES_PROPERTY_PREFIX + Constants.CURRENT_ELEMENT_NODE_PROPERTY; public ValidatorImpl(XSGrammarPoolContainer grammarContainer) { fComponentManager = new XMLSchemaValidatorComponentManager(grammarContainer); - setErrorHandler(null); - setResourceResolver(null); + ErrorHandlerWrapper ehWrapper = + (ErrorHandlerWrapper)grammarContainer.getProperty(ERROR_HANDLER); + ErrorHandler eh = (ehWrapper == null) ? null : ehWrapper.getErrorHandler(); + setErrorHandler(eh); + + DOMEntityResolverWrapper erWrapper = + (DOMEntityResolverWrapper)grammarContainer.getProperty(ENTITY_RESOLVER); + LSResourceResolver er = (erWrapper == null) ? null : erWrapper.getEntityResolver(); + setResourceResolver(er); } public void validate(Source source, Result result)