From: Bryce McKinlay Date: Wed, 18 Aug 2004 18:05:39 +0000 (+0000) Subject: re PR libgcj/17081 (Deserializing java.net.URI fails) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bb0452b18763a8aa8e082a289ae5848a1753ba3e;p=gcc.git re PR libgcj/17081 (Deserializing java.net.URI fails) 2004-08-18 Bryce McKinlay 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 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4a91794ee3e..ec269b0b495 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,12 @@ +2004-08-18 Bryce McKinlay + + PR libgcj/17081 + * java/net/URI.java (string): New field. Make all other fields + transient. + (readObject): Implemented. + (writeObject): Implemented. + (URI): Set 'string'. + 2004-08-18 Bryce McKinlay PR libgcj/17079 diff --git a/libjava/java/net/URI.java b/libjava/java/net/URI.java index b456f71d2dd..dc95e6ecbaa 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); }