8270498: Improve SAX Parser configuration management

Reviewed-by: ahgross, lancea, rhalade, naoto
This commit is contained in:
Joe Wang 2021-08-05 19:05:09 +00:00 committed by Henry Jen
parent e069a3b8bf
commit 7ee905a8a0

View File

@ -91,7 +91,7 @@ import org.xml.sax.InputSource;
* @author K.Venugopal SUN Microsystems
* @author Neeraj Bajaj SUN Microsystems
* @author Sunitha Reddy SUN Microsystems
* @LastModified: May 2021
* @LastModified: Aug 2021
*/
public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
@ -1235,7 +1235,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
externalEntity = (Entity.ExternalEntity)entity;
extLitSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getLiteralSystemId() : null);
extBaseSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getBaseSystemId() : null);
expandedSystemId = expandSystemId(extLitSysId, extBaseSysId);
expandedSystemId = expandSystemId(extLitSysId, extBaseSysId, fStrictURI);
boolean unparsed = entity.isUnparsed();
boolean parameter = entityName.startsWith("%");
boolean general = !parameter;
@ -1312,9 +1312,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
*/
xmlInputSource = staxInputSource.getXMLInputSource() ;
if (!fISCreatedByResolver) {
//let the not-LoadExternalDTD or not-SupportDTD process to handle the situation
if (fLoadExternalDTD) {
String accessError = SecuritySupport.checkAccess(expandedSystemId, fAccessExternalDTD, JdkConstants.ACCESS_EXTERNAL_ALL);
String accessError = SecuritySupport.checkAccess(expandedSystemId,
fAccessExternalDTD, JdkConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
fErrorReporter.reportError(this.getEntityScanner(),XMLMessageFormatter.XML_DOMAIN,
"AccessExternalEntity",
@ -1323,7 +1322,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
}
}
}
}
// wrap internal entity
else {
Entity.InternalEntity internalEntity = (Entity.InternalEntity)entity;