forked from pool/netbeans-resolver
OBS-URL: https://build.opensuse.org/package/show/Java:packages/netbeans-resolver?expand=0&rev=7
108 lines
4.0 KiB
Diff
108 lines
4.0 KiB
Diff
diff -Nur xml-commons-resolver-1.2/src/org/apache/xml/resolver/Catalog.java xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/Catalog.java
|
|
--- xml-commons-resolver-1.2/src/org/apache/xml/resolver/Catalog.java 2006-11-20 15:23:08.000000000 +0300
|
|
+++ xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/Catalog.java 2009-08-12 01:44:32.000000000 +0400
|
|
@@ -27,6 +27,7 @@
|
|
import java.io.DataInputStream;
|
|
|
|
import java.util.Enumeration;
|
|
+import java.util.Iterator;
|
|
import java.util.Hashtable;
|
|
import java.util.Vector;
|
|
|
|
@@ -1167,6 +1168,23 @@
|
|
}
|
|
|
|
|
|
+ /**
|
|
+ * Return all registered public IDs.
|
|
+ */
|
|
+ public Iterator getPublicIDs() {
|
|
+ Vector v = new Vector();
|
|
+ Enumeration emun = catalogEntries.elements();
|
|
+
|
|
+ while (emun.hasMoreElements()) {
|
|
+ CatalogEntry e = (CatalogEntry) emun.nextElement();
|
|
+ if (e.getEntryType() == PUBLIC) {
|
|
+ v.add(e.getEntryArg(0));
|
|
+ }
|
|
+ }
|
|
+ return v.iterator();
|
|
+ }
|
|
+
|
|
+
|
|
/**
|
|
* Return the applicable DOCTYPE system identifier.
|
|
*
|
|
diff -Nur xml-commons-resolver-1.2/src/org/apache/xml/resolver/CatalogManager.java xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/CatalogManager.java
|
|
--- xml-commons-resolver-1.2/src/org/apache/xml/resolver/CatalogManager.java 2006-11-20 15:23:08.000000000 +0300
|
|
+++ xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/CatalogManager.java 2009-08-12 01:50:54.000000000 +0400
|
|
@@ -212,7 +212,11 @@
|
|
// to avoid it.
|
|
}
|
|
|
|
- /** Constructor that specifies an explicit property file. */
|
|
+ /**
|
|
+ * Constructor that specifies an explicit property file.
|
|
+ * @param propertyFile path to poperty file (e.g. com/resources/CatalogManager).
|
|
+ * <code>null</code> means that no property file is consulted at all.
|
|
+ */
|
|
public CatalogManager(String propertyFile) {
|
|
this.propertyFile = propertyFile;
|
|
|
|
@@ -239,14 +243,15 @@
|
|
* resources from it.
|
|
*/
|
|
private synchronized void readProperties() {
|
|
- try {
|
|
+ if (propertyFile == null) return;
|
|
+ try {
|
|
propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
|
|
InputStream in =
|
|
CatalogManager.class.getResourceAsStream("/"+propertyFile);
|
|
if (in==null) {
|
|
if (!ignoreMissingProperties) {
|
|
- System.err.println("Cannot find "+propertyFile);
|
|
- // there's no reason to give this warning more than once
|
|
+ debug.message(2, "Cannot find "+propertyFile);
|
|
+ // there's no reason to give this warning more than once
|
|
ignoreMissingProperties = true;
|
|
}
|
|
return;
|
|
diff -Nur xml-commons-resolver-1.2/src/org/apache/xml/resolver/tools/CatalogResolver.java xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/tools/CatalogResolver.java
|
|
--- xml-commons-resolver-1.2/src/org/apache/xml/resolver/tools/CatalogResolver.java 2006-11-20 15:23:08.000000000 +0300
|
|
+++ xml-commons-resolver-1.2.new/src/org/apache/xml/resolver/tools/CatalogResolver.java 2009-08-12 01:53:48.000000000 +0400
|
|
@@ -192,33 +192,9 @@
|
|
String resolved = getResolvedEntity(publicId, systemId);
|
|
|
|
if (resolved != null) {
|
|
- try {
|
|
InputSource iSource = new InputSource(resolved);
|
|
iSource.setPublicId(publicId);
|
|
-
|
|
- // Ideally this method would not attempt to open the
|
|
- // InputStream, but there is a bug (in Xerces, at least)
|
|
- // that causes the parser to mistakenly open the wrong
|
|
- // system identifier if the returned InputSource does
|
|
- // not have a byteStream.
|
|
- //
|
|
- // It could be argued that we still shouldn't do this here,
|
|
- // but since the purpose of calling the entityResolver is
|
|
- // almost certainly to open the input stream, it seems to
|
|
- // do little harm.
|
|
- //
|
|
- URL url = new URL(resolved);
|
|
- InputStream iStream = url.openStream();
|
|
- iSource.setByteStream(iStream);
|
|
-
|
|
return iSource;
|
|
- } catch (Exception e) {
|
|
- catalogManager.debug.message(1,
|
|
- "Failed to create InputSource ("
|
|
- + e.toString()
|
|
- + ")", resolved);
|
|
- return null;
|
|
- }
|
|
}
|
|
|
|
return null;
|