@@ -1038,7 +1038,8 @@ public StaxXMLInputSource resolveEntityAsPerStax(XMLResourceIdentifier resourceI
1038
1038
}
1039
1039
1040
1040
// Step 2: custom catalog if specified
1041
- if (staxInputSource == null && (fUseCatalog && fCatalogFile != null )) {
1041
+ if ((publicId != null || literalSystemId != null ) &&
1042
+ staxInputSource == null && (fUseCatalog && fCatalogFile != null )) {
1042
1043
if (fCatalogResolver == null ) {
1043
1044
fCatalogFeatures = JdkXmlUtils .getCatalogFeatures (fDefer , fCatalogFile , fPrefer , fResolve );
1044
1045
fCatalogResolver = CatalogManager .catalogResolver (fCatalogFeatures );
@@ -1048,18 +1049,21 @@ public StaxXMLInputSource resolveEntityAsPerStax(XMLResourceIdentifier resourceI
1048
1049
}
1049
1050
1050
1051
// Step 3: use the default JDK Catalog Resolver if Step 2's resolve is continue
1051
- if (staxInputSource == null && JdkXmlUtils .isResolveContinue (fCatalogFeatures )) {
1052
+ if ((publicId != null || literalSystemId != null ) &&
1053
+ staxInputSource == null && JdkXmlUtils .isResolveContinue (fCatalogFeatures )) {
1052
1054
initJdkCatalogResolver ();
1053
1055
1054
1056
staxInputSource = resolveWithCatalogStAX (fDefCR , JdkCatalog .JDKCATALOG , publicId , literalSystemId );
1055
1057
}
1056
1058
1057
1059
// Step 4: default resolution if not resolved by a resolver and the RESOLVE
1058
1060
// feature is set to 'continue'
1061
+ // Note if both publicId and systemId are null, the resolution process continues as usual
1059
1062
if (staxInputSource != null ) {
1060
1063
fISCreatedByResolver = true ;
1061
- } else if (JdkXmlUtils .isResolveContinue (fCatalogFeatures ) &&
1062
- fSecurityManager .is (Limit .JDKCATALOG_RESOLVE , JdkConstants .CONTINUE )) {
1064
+ } else if ((publicId == null && literalSystemId == null ) ||
1065
+ (JdkXmlUtils .isResolveContinue (fCatalogFeatures ) &&
1066
+ fSecurityManager .is (Limit .JDKCATALOG_RESOLVE , JdkConstants .CONTINUE ))) {
1063
1067
staxInputSource = new StaxXMLInputSource (
1064
1068
new XMLInputSource (publicId , literalSystemId , baseSystemId , true ), false );
1065
1069
}
@@ -1222,8 +1226,10 @@ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) th
1222
1226
1223
1227
// Step 4: default resolution if not resolved by a resolver and the RESOLVE
1224
1228
// feature is set to 'continue'
1225
- if ((xmlInputSource == null ) && JdkXmlUtils .isResolveContinue (fCatalogFeatures ) &&
1226
- fSecurityManager .is (Limit .JDKCATALOG_RESOLVE , JdkConstants .CONTINUE )) {
1229
+ // Note if both publicId and systemId are null, the resolution process continues as usual
1230
+ if ((publicId == null && literalSystemId == null ) ||
1231
+ ((xmlInputSource == null ) && JdkXmlUtils .isResolveContinue (fCatalogFeatures ) &&
1232
+ fSecurityManager .is (Limit .JDKCATALOG_RESOLVE , JdkConstants .CONTINUE ))) {
1227
1233
xmlInputSource = new XMLInputSource (publicId , literalSystemId , baseSystemId , false );
1228
1234
}
1229
1235
0 commit comments