< prev index next >
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
Print this page
*** 18,29 ****
* limitations under the License.
*/
package com.sun.org.apache.xerces.internal.impl ;
- import com.sun.org.apache.xerces.internal.impl.Constants;
- import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
--- 18,27 ----
*** 40,50 ****
import com.sun.xml.internal.stream.Entity;
import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
import com.sun.xml.internal.stream.StaxXMLInputSource;
import com.sun.xml.internal.stream.XMLEntityStorage;
import java.io.*;
- import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
--- 38,47 ----
*** 57,67 ****
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
- import javax.xml.catalog.CatalogUriResolver;
import javax.xml.stream.XMLInputFactory;
import javax.xml.transform.Source;
import jdk.xml.internal.JdkXmlUtils;
import org.xml.sax.InputSource;
--- 54,63 ----
*** 418,428 ****
/** indicate whether Catalog should be used for resolving external resources */
private boolean fUseCatalog = true;
CatalogFeatures fCatalogFeatures;
CatalogResolver fCatalogResolver;
- CatalogUriResolver fCatalogUriResolver;
private String fCatalogFile;
private String fDefer;
private String fPrefer;
private String fResolve;
--- 414,423 ----
*** 1042,1058 ****
--- 1037,1059 ----
if (fCatalogFeatures == null) {
fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
}
fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
+ try {
if (fCatalogResolver == null) {
fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
}
InputSource is = fCatalogResolver.resolveEntity(publicId, literalSystemId);
if (is != null && !is.isEmpty()) {
staxInputSource = new StaxXMLInputSource(new XMLInputSource(is, true), true);
}
+ } catch (CatalogException e) {
+ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"CatalogException",
+ new Object[]{SecuritySupport.sanitizePath(fCatalogFile)},
+ XMLErrorReporter.SEVERITY_FATAL_ERROR, e );
+ }
}
}
// do default resolution
//this works for both stax & Xerces, if staxInputSource is null,
*** 1138,1148 ****
}
fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
/*
since the method can be called from various processors, both
! CatalogResolver and CatalogUriResolver are used to attempt to find
a match
*/
InputSource is = null;
try {
if (fCatalogResolver == null) {
--- 1139,1149 ----
}
fCatalogFile = fCatalogFeatures.get(Feature.FILES);
if (fUseCatalog && fCatalogFile != null) {
/*
since the method can be called from various processors, both
! EntityResolver and URIResolver are used to attempt to find
a match
*/
InputSource is = null;
try {
if (fCatalogResolver == null) {
*** 1151,1167 ****
String pid = (publicId != null? publicId : resourceIdentifier.getNamespace());
if (pid != null || literalSystemId != null) {
is = fCatalogResolver.resolveEntity(pid, literalSystemId);
}
} catch (CatalogException e) {}
if (is != null && !is.isEmpty()) {
xmlInputSource = new XMLInputSource(is, true);
} else if (literalSystemId != null) {
! if (fCatalogUriResolver == null) {
! fCatalogUriResolver = CatalogManager.catalogUriResolver(fCatalogFeatures);
}
- Source source = fCatalogUriResolver.resolve(literalSystemId, baseSystemId);
if (source != null && !source.isEmpty()) {
xmlInputSource = new XMLInputSource(publicId, source.getSystemId(), baseSystemId, true);
}
}
}
--- 1152,1175 ----
String pid = (publicId != null? publicId : resourceIdentifier.getNamespace());
if (pid != null || literalSystemId != null) {
is = fCatalogResolver.resolveEntity(pid, literalSystemId);
}
} catch (CatalogException e) {}
+
if (is != null && !is.isEmpty()) {
xmlInputSource = new XMLInputSource(is, true);
} else if (literalSystemId != null) {
! if (fCatalogResolver == null) {
! fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
! }
!
! Source source = null;
! try {
! source = fCatalogResolver.resolve(literalSystemId, baseSystemId);
! } catch (CatalogException e) {
! throw new XNIException(e);
}
if (source != null && !source.isEmpty()) {
xmlInputSource = new XMLInputSource(publicId, source.getSystemId(), baseSystemId, true);
}
}
}
< prev index next >