diff options
Diffstat (limited to 'libjava/classpath/javax/xml')
8 files changed, 48 insertions, 43 deletions
diff --git a/libjava/classpath/javax/xml/namespace/QName.java b/libjava/classpath/javax/xml/namespace/QName.java index 7b8b194c33c..19700b32e41 100644 --- a/libjava/classpath/javax/xml/namespace/QName.java +++ b/libjava/classpath/javax/xml/namespace/QName.java @@ -1,5 +1,5 @@ /* QName.java - An XML qualified name. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +38,8 @@ exception statement from your version. */ package javax.xml.namespace; +import java.io.Serializable; + import javax.xml.XMLConstants; /** @@ -47,14 +49,15 @@ import javax.xml.XMLConstants; * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> * @since 1.3 */ -public class QName +public class QName implements Serializable { + private static final long serialVersionUID = 4418622981026545151L; private final String namespaceURI; private final String localPart; private final String prefix; - private final String qName; - int hashCode = -1; + private transient String qName; + transient int hashCode = -1; public QName(String namespaceURI, String localPart) { @@ -78,21 +81,6 @@ public class QName this.namespaceURI = namespaceURI; this.localPart = localPart; this.prefix = prefix; - - StringBuffer buf = new StringBuffer(); - if (namespaceURI.length() > 0) - { - buf.append('{'); - buf.append(namespaceURI); - buf.append('}'); - } - if (prefix.length() > 0) - { - buf.append(prefix); - buf.append(':'); - } - buf.append(localPart); - qName = buf.toString(); } public QName(String localPart) @@ -115,7 +103,7 @@ public class QName return prefix; } - public boolean equals(Object obj) + public final boolean equals(Object obj) { if (obj instanceof QName) { @@ -129,19 +117,29 @@ public class QName public final int hashCode() { if (hashCode == -1) - { - StringBuffer buf = new StringBuffer(); - buf.append('{'); - buf.append(namespaceURI); - buf.append('}'); - buf.append(localPart); - hashCode = buf.toString().hashCode(); - } + hashCode = localPart.hashCode() ^ namespaceURI.hashCode(); return hashCode; } - public String toString() + public synchronized String toString() { + if (qName == null) + { + StringBuffer buf = new StringBuffer(); + if (namespaceURI.length() > 0) + { + buf.append('{'); + buf.append(namespaceURI); + buf.append('}'); + } + if (prefix.length() > 0) + { + buf.append(prefix); + buf.append(':'); + } + buf.append(localPart); + qName = buf.toString(); + } return qName; } diff --git a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java index b2153c2cbf9..81db3bed913 100644 --- a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java +++ b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java @@ -45,9 +45,8 @@ package javax.xml.transform; public class TransformerConfigurationException extends TransformerException { + private static final long serialVersionUID = 1285547467942875745L; - private SourceLocator locator; - /** * Constructor with no detail message. */ @@ -96,8 +95,7 @@ public class TransformerConfigurationException SourceLocator locator, Throwable e) { - super(message, e); - this.locator = locator; + super(message, locator, e); } } diff --git a/libjava/classpath/javax/xml/transform/TransformerException.java b/libjava/classpath/javax/xml/transform/TransformerException.java index a72ee1c2f56..3d97eda1bbb 100644 --- a/libjava/classpath/javax/xml/transform/TransformerException.java +++ b/libjava/classpath/javax/xml/transform/TransformerException.java @@ -47,9 +47,11 @@ import java.io.PrintWriter; public class TransformerException extends Exception { + private static final long serialVersionUID = 975798773772956428L; + // Field names fixed by serialization spec. private SourceLocator locator; - private Throwable cause; + private Throwable containedException; /** * Constructor with a detail message. @@ -94,7 +96,7 @@ public class TransformerException if (cause != null) { initCause(cause); - this.cause = cause; + this.containedException = cause; } } @@ -119,7 +121,7 @@ public class TransformerException */ public Throwable getException() { - return cause; + return containedException; } /** @@ -127,7 +129,7 @@ public class TransformerException */ public Throwable getCause() { - return cause; + return containedException; } /** @@ -143,7 +145,7 @@ public class TransformerException */ public Throwable initCause(Throwable cause) { - if (this.cause != null) + if (this.containedException != null) { throw new IllegalStateException(); } @@ -151,7 +153,7 @@ public class TransformerException { throw new IllegalArgumentException(); } - this.cause = cause; + this.containedException = cause; return this; } @@ -221,20 +223,20 @@ public class TransformerException public void printStackTrace(PrintStream s) { super.printStackTrace(s); - if (cause != null) + if (containedException != null) { s.print("caused by "); - cause.printStackTrace(s); + containedException.printStackTrace(s); } } public void printStackTrace(PrintWriter s) { super.printStackTrace(s); - if (cause != null) + if (containedException != null) { s.print("caused by "); - cause.printStackTrace(s); + containedException.printStackTrace(s); } } diff --git a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java index 9b16b2b2e4c..82afeeac750 100644 --- a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java +++ b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java @@ -44,7 +44,9 @@ package javax.xml.transform; public class TransformerFactoryConfigurationError extends Error { + private static final long serialVersionUID = -6527718720676281516L; + // Name is fixed by the serialization spec. private final Exception exception; /** diff --git a/libjava/classpath/javax/xml/xpath/XPathException.java b/libjava/classpath/javax/xml/xpath/XPathException.java index 030d0a9c1d7..cf004c1791e 100644 --- a/libjava/classpath/javax/xml/xpath/XPathException.java +++ b/libjava/classpath/javax/xml/xpath/XPathException.java @@ -49,7 +49,9 @@ import java.io.PrintWriter; public class XPathException extends Exception { + private static final long serialVersionUID = -1837080260374986980L; + // Name is fixed by serialization spec. Throwable cause; public XPathException(String message) diff --git a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java index 91716f1502f..6257adb474b 100644 --- a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java +++ b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java @@ -46,6 +46,7 @@ package javax.xml.xpath; public class XPathExpressionException extends XPathException { + private static final long serialVersionUID = -1837080260374986980L; public XPathExpressionException(String message) { diff --git a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java index a89646336d8..0fc68a7634b 100644 --- a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java +++ b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java @@ -46,6 +46,7 @@ package javax.xml.xpath; public class XPathFactoryConfigurationException extends XPathException { + private static final long serialVersionUID = -1837080260374986980L; public XPathFactoryConfigurationException(String message) { diff --git a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java index ebc8ce7d341..db680ae65da 100644 --- a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java +++ b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java @@ -46,6 +46,7 @@ package javax.xml.xpath; public class XPathFunctionException extends XPathExpressionException { + private static final long serialVersionUID = -1837080260374986980L; public XPathFunctionException(String message) { |