Update of /var/cvs/src/org/mmbase/util/xml
In directory james.mmbase.org:/tmp/cvs-serv6172
Modified Files:
URIResolver.java
Log Message:
fixed some Serializable issues
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util/xml
Index: URIResolver.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/xml/URIResolver.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- URIResolver.java 24 Feb 2007 21:57:50 -0000 1.28
+++ URIResolver.java 12 Feb 2008 17:21:22 -0000 1.29
@@ -41,7 +41,7 @@
*
* @author Michiel Meeuwissen.
* @since MMBase-1.6
- * @version $Id: URIResolver.java,v 1.28 2007/02/24 21:57:50 nklasens Exp $
+ * @version $Id: URIResolver.java,v 1.29 2008/02/12 17:21:22 michiel Exp $
*/
public class URIResolver implements javax.xml.transform.URIResolver,
SizeMeasurable, Serializable {
@@ -233,6 +233,7 @@
baseURL = getCwd();
} else {
baseURL = resolveToURL(base, null); // resolve URIResolver's
prefixes like mm:, ew: in base.
+ log.debug("Resolved '" + base + "' to " + baseURL);
}
URL path = null;
@@ -274,6 +275,7 @@
if (href.startsWith("file:")) { // don't know excactly why
this is good.
path = new URL(baseURL, href.substring(5));
} else {
+ log.debug("" + baseURL + " " + href);
path = new URL(baseURL, href);
}
try {
@@ -351,18 +353,12 @@
* This is a list of prefix/directory pairs which is used in the
constructor of URIResolver.
*/
- static public class EntryList extends ArrayList<Entry> {
+ static public class EntryList extends ArrayList<Entry> implements
Serializable {
+ private static final long serialVersionUID = 1L;
public EntryList() {
}
/**
- * @throws IllegalArgumentException If you don't add an Entry.
- */
- public boolean add(Entry o) {
- return super.add(o);
- }
-
- /**
* Adds an prefix/dir entry to the List.
* @return The list again, so you can easily 'chain' a few.
* @throws IllegalArgumentException if d is not a directory.
@@ -395,6 +391,7 @@
return this;
}
}
+
}
/**
@@ -405,7 +402,7 @@
*/
static class Entry implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
private String prefix;
private URL dir;
private ClassLoader classLoader;
@@ -424,22 +421,26 @@
prefixLength = prefix.length(); // avoid calculating it again.
}
- private void writeObject(java.io.ObjectOutputStream out) {
+ private void writeObject(java.io.ObjectOutputStream out) throws
IOException {
try {
out.writeUTF(prefix);
- if (dir == null) {
+ if (dir != null && dir.getProtocol().equals("mm")) {
out.writeObject("mm");
} else {
out.writeObject(dir);
}
} catch (Throwable t) {
- log.warn(t);
+ log.warn(t.getMessage(), t);
}
}
- private void readObject(java.io.ObjectInputStream in) {
+ private void readObject(java.io.ObjectInputStream in) throws
IOException, ClassNotFoundException {
try {
prefix = in.readUTF();
Object o = in.readObject();
+ if ("mm:".equals(prefix)) {
+ classLoader = ResourceLoader.getConfigurationRoot();
+ dir = null;
+ } else {
if ("mm".equals(o)) {
classLoader = ResourceLoader.getConfigurationRoot();
dir = null;
@@ -447,9 +448,9 @@
dir = (URL) o;
classLoader = null;
}
- log.info("dir " + dir + " claddLoader " + classLoader);
+ }
} catch (Throwable t) {
- log.warn(t);
+ log.warn(t.getMessage(), t);
}
prefixLength = prefix.length();
}
@@ -511,13 +512,13 @@
*/
public static void main(String argv[]) throws Exception {
- URIResolver resolver = new URIResolver(new URL("file:///tmp/"));
+ URIResolver resolver = new URIResolver(new
URL("file:///home/mmbase/head/mmbase/edit/wizard/data"));
System.out.println("Resolving with " + resolver);
String href, base;
href = "xsl/list.xsl"; base = null;
System.out.println("href: " + href + " base: " + base + " --> " +
resolver.resolveToURL(href, base));
- href = "xsl/prompts.xsl"; base =
"file:///home/mmbase/mmbase17/mmbase/edit/wizard/data/xsl/base.xsl";
+ href = "prompts.xsl"; base =
"file:///home/mmbase/head/mmbase/edit/wizard/data/xsl/base.xsl";
System.out.println("href: " + href + " base: " + base + " --> " +
resolver.resolveToURL(href, base));
FileOutputStream fos = new FileOutputStream("/tmp/uriresolver.ser");
@@ -534,7 +535,7 @@
href = "xsl/list.xsl"; base = null;
System.out.println("href: " + href + " base: " + base + " --> " +
resolver2.resolveToURL(href, base));
- href = "xsl/prompts.xsl"; base =
"file:///home/mmbase/mmbase17/mmbase/edit/wizard/data/xsl/base.xsl";
+ href = "prompts.xsl"; base =
"file:///home/mmbase/head/mmbase/edit/wizard/data/xsl/base.xsl";
System.out.println("href: " + href + " base: " + base + " --> " +
resolver2.resolveToURL(href, base));
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs