mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
8147051: StaxEntityResolverWrapper should create StaxXMLInputSource with a resolver indicator
Reviewed-by: lancea
This commit is contained in:
parent
07b44796c2
commit
e07007fd51
4 changed files with 16 additions and 19 deletions
|
@ -1155,7 +1155,7 @@ public class XMLDocumentScannerImpl
|
|||
StaxXMLInputSource staxInputSource = fEntityManager.resolveEntityAsPerStax(resourceIdentifier);
|
||||
|
||||
// Check access permission. If the source is resolved by a resolver, the check is skipped.
|
||||
if (!staxInputSource.hasResolver()) {
|
||||
if (!staxInputSource.isCreatedByResolver()) {
|
||||
String accessError = checkAccess(fDoctypeSystemId, fAccessExternalDTD);
|
||||
if (accessError != null) {
|
||||
reportFatalError("AccessExternalDTD", new Object[]{ SecuritySupport.sanitizePath(fDoctypeSystemId), accessError });
|
||||
|
|
|
@ -1008,12 +1008,14 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
|||
}
|
||||
|
||||
// do default resolution
|
||||
//this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
|
||||
//this works for both stax & Xerces, if staxInputSource is null,
|
||||
//it means parser need to revert to default resolution
|
||||
if (staxInputSource == null) {
|
||||
// REVISIT: when systemId is null, I think we should return null.
|
||||
// is this the right solution? -SG
|
||||
//if (systemId != null)
|
||||
staxInputSource = new StaxXMLInputSource(new XMLInputSource(publicId, literalSystemId, baseSystemId));
|
||||
staxInputSource = new StaxXMLInputSource(
|
||||
new XMLInputSource(publicId, literalSystemId, baseSystemId), false);
|
||||
}else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
|
||||
//Waiting for the clarification from EG. - nb
|
||||
}
|
||||
|
|
|
@ -71,12 +71,12 @@ public class StaxEntityResolverWrapper {
|
|||
if(object == null) return null ;
|
||||
|
||||
if(object instanceof java.io.InputStream){
|
||||
return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null));
|
||||
return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null), true);
|
||||
}
|
||||
else if(object instanceof XMLStreamReader){
|
||||
return new StaxXMLInputSource((XMLStreamReader)object) ;
|
||||
return new StaxXMLInputSource((XMLStreamReader)object, true) ;
|
||||
}else if(object instanceof XMLEventReader){
|
||||
return new StaxXMLInputSource((XMLEventReader)object) ;
|
||||
return new StaxXMLInputSource((XMLEventReader)object, true) ;
|
||||
}
|
||||
|
||||
return null ;
|
||||
|
|
|
@ -43,27 +43,22 @@ public class StaxXMLInputSource {
|
|||
XMLEventReader fEventReader ;
|
||||
XMLInputSource fInputSource ;
|
||||
|
||||
//indicate if the source is resolved by a resolver
|
||||
boolean fHasResolver = false;
|
||||
//indicates if the source is created by a resolver
|
||||
boolean fIsCreatedByResolver = false;
|
||||
|
||||
/** Creates a new instance of StaxXMLInputSource */
|
||||
public StaxXMLInputSource(XMLStreamReader streamReader) {
|
||||
public StaxXMLInputSource(XMLStreamReader streamReader, boolean byResolver) {
|
||||
fStreamReader = streamReader ;
|
||||
}
|
||||
|
||||
/** Creates a new instance of StaxXMLInputSource */
|
||||
public StaxXMLInputSource(XMLEventReader eventReader) {
|
||||
public StaxXMLInputSource(XMLEventReader eventReader, boolean byResolver) {
|
||||
fEventReader = eventReader ;
|
||||
}
|
||||
|
||||
public StaxXMLInputSource(XMLInputSource inputSource){
|
||||
public StaxXMLInputSource(XMLInputSource inputSource, boolean byResolver){
|
||||
fInputSource = inputSource ;
|
||||
|
||||
}
|
||||
|
||||
public StaxXMLInputSource(XMLInputSource inputSource, boolean hasResolver){
|
||||
fInputSource = inputSource ;
|
||||
fHasResolver = hasResolver;
|
||||
fIsCreatedByResolver = byResolver;
|
||||
}
|
||||
|
||||
public XMLStreamReader getXMLStreamReader(){
|
||||
|
@ -82,7 +77,7 @@ public class StaxXMLInputSource {
|
|||
return (fStreamReader == null) && (fEventReader == null) ? false : true ;
|
||||
}
|
||||
|
||||
public boolean hasResolver() {
|
||||
return fHasResolver;
|
||||
public boolean isCreatedByResolver() {
|
||||
return fIsCreatedByResolver;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue