diff options
author | Bryce McKinlay <mckinlay@redhat.com> | 2004-08-18 18:05:39 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2004-08-18 19:05:39 +0100 |
commit | bb0452b18763a8aa8e082a289ae5848a1753ba3e (patch) | |
tree | e0f84f3a381ccdf3acb8d44b301aac427037d9b6 /libjava/java/net/URI.java | |
parent | 260ba9ce680ed9ee88d427523e403f4667e6023e (diff) | |
download | gcc-bb0452b18763a8aa8e082a289ae5848a1753ba3e.zip gcc-bb0452b18763a8aa8e082a289ae5848a1753ba3e.tar.gz gcc-bb0452b18763a8aa8e082a289ae5848a1753ba3e.tar.bz2 |
re PR libgcj/17081 (Deserializing java.net.URI fails)
2004-08-18 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/17081
* java/net/URI.java (string): New field. Make all other fields
transient.
(readObject): Implemented.
(writeObject): Implemented.
(URI): Set 'string'.
From-SVN: r86197
Diffstat (limited to 'libjava/java/net/URI.java')
-rw-r--r-- | libjava/java/net/URI.java | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/libjava/java/net/URI.java b/libjava/java/net/URI.java index b456f71..dc95e6e 100644 --- a/libjava/java/net/URI.java +++ b/libjava/java/net/URI.java @@ -111,30 +111,44 @@ public final class URI implements Comparable, Serializable * Index of fragment component in parsed URI. */ private static final int FRAGMENT_GROUP = 10; - private String scheme; - private String rawSchemeSpecificPart; - private String schemeSpecificPart; - private String rawAuthority; - private String authority; - private String rawUserInfo; - private String userInfo; - private String rawHost; - private String host; - private int port; - private String rawPath; - private String path; - private String rawQuery; - private String query; - private String rawFragment; - private String fragment; + private transient String scheme; + private transient String rawSchemeSpecificPart; + private transient String schemeSpecificPart; + private transient String rawAuthority; + private transient String authority; + private transient String rawUserInfo; + private transient String userInfo; + private transient String rawHost; + private transient String host; + private transient int port; + private transient String rawPath; + private transient String path; + private transient String rawQuery; + private transient String query; + private transient String rawFragment; + private transient String fragment; + private String string; private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { + this.string = (String) is.readObject(); + try + { + parseURI(this.string); + } + catch (URISyntaxException x) + { + // Should not happen. + throw new RuntimeException(x); + } } - private void writeObject(ObjectOutputStream is) throws IOException + private void writeObject(ObjectOutputStream os) throws IOException { + if (string == null) + string = toString(); + os.writeObject(string); } private static String getURIGroup(Matcher match, int group) @@ -362,6 +376,7 @@ public final class URI implements Comparable, Serializable */ public URI(String str) throws URISyntaxException { + this.string = str; parseURI(str); } |