PropertyChangeEvent.java (serialVersionUID): Added.
* java/beans/PropertyChangeEvent.java (serialVersionUID): Added. * java/beans/PropertyVetoException.java (serialVersionUID): Added. * java/io/File.java (writeObject): Added. (readObject): Added. (serialVersionUID): Added. * java/io/ObjectOutputStream.java (writeObject): Initialized fieldsAlreadyWritten before recursion rather than after. * java/io/ObjectStreamClass.java (serialVersionUID): Added. * java/io/OptionalDataException.java (serialVersionUID): Added. (OptionalDataException): Made package private. * java/io/SyncFailedException.java (SyncFailedException): Removed default constructor to match spec. * java/lang/Boolean.java (serialVersionUID): Added. * java/lang/Byte.java (serialVersionUID): Added. * java/lang/Character.java (serialVersionUID): Added. * java/lang/Double.java (serialVersionUID): Added. * java/lang/Float.java (serialVersionUID): Added. * java/lang/Integer.java (serialVersionUID): Added. * java/lang/Long.java (serialVersionUID): Added. * java/lang/Number.java (serialVersionUID): Added. * java/lang/Short.java (serialVersionUID): Added. * java/lang/String.java (serialVersionUID): Added. * java/lang/ThreadDeath.java (ThreadDeath): Removed constructor to match spec. * java/lang/reflect/InvocationTargetException.java (serialVersionUID): Added. * java/net/URL.java (handler): Made transient. (hashCode): Added field for serialization, per spec. and use cached value if available. (serialVersionUID): Added. (URL): Initialize hashCode. (set): Adjust hashCode. (readObject): New Method to initialize the protocol handler when deserializing. (writeObject): New method. * java/text/BreakIterator.java: Removed 'implements Serializable'. * java/text/Collator.java: Removed 'implements Serializable'. * java/util/GregorianCalendar.java (serialVersionUID): Added. * java/util/Properties.java (serialVersionUID): Added. * java/util/Random.java (serialVersionUID): Added. (seed): Made private. (nextNextGaussian): Made private. (haveNextNextGaussian): Made private. * java/util/Stack.java (serialVersionUID): Added. * java/util/TimeZone.java (serialVersionUID): Added. * java/util/Vector.java (serialVersionUID): Added. Serialization mods. From-SVN: r36272
This commit is contained in:
parent
759e81878c
commit
bc6ccd3316
29 changed files with 162 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
|||
// URL.java - A Uniform Resource Locator.
|
||||
|
||||
/* Copyright (C) 1999 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
|
@ -32,10 +32,13 @@ public final class URL implements Serializable
|
|||
private int port = -1; // Initialize for constructor using context.
|
||||
private String file;
|
||||
private String ref;
|
||||
private URLStreamHandler handler;
|
||||
private int hashCode = 0;
|
||||
transient private URLStreamHandler handler;
|
||||
private static Hashtable handlers = new Hashtable();
|
||||
private static URLStreamHandlerFactory factory;
|
||||
|
||||
private static final long serialVersionUID = -7627629688361524110L;
|
||||
|
||||
public URL(String protocol, String host, int port, String file)
|
||||
throws MalformedURLException
|
||||
{
|
||||
|
@ -90,6 +93,7 @@ public final class URL implements Serializable
|
|||
this.file = file.substring(0, hashAt);
|
||||
this.ref = file.substring(hashAt + 1);
|
||||
}
|
||||
hashCode = hashCode(); // Used for serialization.
|
||||
}
|
||||
|
||||
public URL(String spec) throws MalformedURLException
|
||||
|
@ -181,6 +185,8 @@ public final class URL implements Serializable
|
|||
hashAt < 0 ? spec.length() : hashAt);
|
||||
if (hashAt >= 0)
|
||||
ref = spec.substring(hashAt + 1);
|
||||
|
||||
hashCode = hashCode(); // Used for serialization.
|
||||
}
|
||||
|
||||
public boolean equals(Object obj)
|
||||
|
@ -249,7 +255,10 @@ public final class URL implements Serializable
|
|||
// (which was reduced to "" with a hashcode of zero). A "" host also
|
||||
// causes the port number and the two hashcodes to be summed.
|
||||
|
||||
return (protocol.hashCode() + ((host == null) ? 0 : host.hashCode()) +
|
||||
if (hashCode != 0)
|
||||
return hashCode; // Use cached value if available.
|
||||
else
|
||||
return (protocol.hashCode() + ((host == null) ? 0 : host.hashCode()) +
|
||||
port + file.hashCode());
|
||||
}
|
||||
|
||||
|
@ -290,6 +299,7 @@ public final class URL implements Serializable
|
|||
this.host = host;
|
||||
this.file = file;
|
||||
this.ref = ref;
|
||||
hashCode = hashCode(); // Used for serialization.
|
||||
}
|
||||
|
||||
public static synchronized void
|
||||
|
@ -384,4 +394,18 @@ public final class URL implements Serializable
|
|||
|
||||
return handler;
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream ois)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
ois.defaultReadObject();
|
||||
this.handler = setURLStreamHandler(protocol);
|
||||
if (this.handler == null)
|
||||
throw new IOException("Handler for protocol " + protocol + " not found");
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException
|
||||
{
|
||||
oos.defaultWriteObject();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue