Hi,
I have merged all the Error and Exception classes with libgcj.
(Except for the java.awt exceptions since they don't have the same license.)
The diff is very large (83K) but contains almost only copyright and javadoc
changes. Attached is the diff of the few files that also has some minor code
changes. And only two (ExceptionInInitializerError, InvocationTargetException)
have a significant change. (They now use the correct serialised field names
and don't need private read/writeObject methods anymore.)
All the exceptions still have explicit serialVersionUIDs set if they contained
these fields in the Classpath version. Before checking the merged classes
into libgcj I want to test which classes actually need this field. Maybe mauve
has these tests, or maybe I have to write these tests for mauve.
Here is the complete list of changed classes:
2001-03-11 Mark Wielaard <[EMAIL PROTECTED]>
* java/io/CharConversionException.java: merged with libgcj
* java/io/EOFException.java: idem
* java/io/FileNotFoundException.java: idem
* java/io/IOException.java: idem
* java/io/InterruptedIOException.java: idem
* java/io/ObjectStreamException.java: idem
* java/io/OptionalDataException.java: idem
* java/io/StreamCorruptedException.java: idem
* java/io/SyncFailedException.java: idem
* java/io/UTFDataFormatException.java: idem
* java/io/UnsupportedEncodingException.java: idem
* java/lang/AbstractMethodError.java: idem
* java/lang/ArithmeticException.java: idem
* java/lang/ArrayIndexOutOfBoundsException.java: idem
* java/lang/ArrayStoreException.java: idem
* java/lang/ClassCastException.java: idem
* java/lang/ClassCircularityError.java: idem
* java/lang/ClassFormatError.java: idem
* java/lang/CloneNotSupportedException.java: idem
* java/lang/Error.java: idem
* java/lang/Exception.java: idem
* java/lang/ExceptionInInitializerError.java: idem
* java/lang/IllegalAccessError.java: idem
* java/lang/IllegalAccessException.java: idem
* java/lang/IllegalArgumentException.java: idem
* java/lang/IllegalMonitorStateException.java: idem
* java/lang/IllegalStateException.java: idem
* java/lang/IllegalThreadStateException.java: idem
* java/lang/IncompatibleClassChangeError.java: idem
* java/lang/IndexOutOfBoundsException.java: idem
* java/lang/InstantiationError.java: idem
* java/lang/InstantiationException.java: idem
* java/lang/InternalError.java: idem
* java/lang/InterruptedException.java: idem
* java/lang/LinkageError.java: idem
* java/lang/NegativeArraySizeException.java: idem
* java/lang/NoClassDefFoundError.java: idem
* java/lang/NoSuchFieldError.java: idem
* java/lang/NoSuchFieldException.java: idem
* java/lang/NoSuchMethodError.java: idem
* java/lang/NoSuchMethodException.java: idem
* java/lang/NullPointerException.java: idem
* java/lang/NumberFormatException.java: idem
* java/lang/OutOfMemoryError.java: idem
* java/lang/RuntimeException.java: idem
* java/lang/SecurityException.java: idem
* java/lang/StackOverflowError.java: idem
* java/lang/StringIndexOutOfBoundsException.java: idem
* java/lang/ThreadDeath.java: idem
* java/lang/UnknownError.java: idem
* java/lang/UnsatisfiedLinkError.java: idem
* java/lang/UnsupportedOperationException.java: idem
* java/lang/VerifyError.java: idem
* java/lang/VirtualMachineError.java: idem
* java/lang/reflect/InvocationTargetException.java: idem
* java/net/BindException.java: idem
* java/net/ConnectException.java: idem
* java/net/MalformedURLException.java: idem
* java/net/NoRouteToHostException.java: idem
* java/net/ProtocolException.java: idem
* java/net/SocketException.java: idem
* java/net/UnknownHostException.java: idem
* java/net/UnknownServiceException.java: idem
* java/text/ParseException.java: idem
Cheers,
Mark
--
Stuff to read:
<http://www.toad.com/gnu/whatswrong.html>
What's Wrong with Copy Protection, by John Gilmore
Index: java/io/OptionalDataException.java
===================================================================
RCS file: /cvs/classpath/java/io/OptionalDataException.java,v
retrieving revision 1.3
diff -u -r1.3 OptionalDataException.java
--- java/io/OptionalDataException.java 2000/03/16 19:21:19 1.3
+++ java/io/OptionalDataException.java 2001/03/11 15:41:19
@@ -1,5 +1,5 @@
-/* OptionalDataException.java -- Unexpected end of file exception
- Copyright (C) 1998 Free Software Foundation, Inc.
+/* OptionalDataException.java -- indicates unexpected data in serialised stream
+ Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -27,6 +27,10 @@
package java.io;
+/* Written using on-line Java Platform 1.2 API Specification.
+ * Status: Believed complete and correct.
+ */
+
/**
* This exception is thrown when unexpected data appears in the input
* stream from which a serialized object is being read. The field
@@ -37,10 +41,14 @@
* @version 0.0
*
* @author Aaron M. Renn ([EMAIL PROTECTED])
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date February 7, 2000.
*/
public class OptionalDataException extends ObjectStreamException
{
+private static final long serialVersionUID = -8011121865681257820L;
+
/*
* Instance Variables
*/
@@ -69,10 +77,10 @@
* @param eof 'true' if end of stream reached, 'false' otherwise
* @param count The number of valid bytes to be read.
*/
-OptionalDataException()
+OptionalDataException(boolean eof, int count)
{
this.eof = eof;
- this.length = length;
+ this.length = count;
}
} // class OptionalDataException
Index: java/lang/ArrayIndexOutOfBoundsException.java
===================================================================
RCS file: /cvs/classpath/java/lang/ArrayIndexOutOfBoundsException.java,v
retrieving revision 1.7
diff -u -r1.7 ArrayIndexOutOfBoundsException.java
--- java/lang/ArrayIndexOutOfBoundsException.java 2000/03/16 23:31:18 1.7
+++ java/lang/ArrayIndexOutOfBoundsException.java 2001/03/11 15:41:19
@@ -1,6 +1,6 @@
/* ArrayIndexOutOfBoundsException.java -- exception thrown when accessing
an illegal index.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -28,6 +28,13 @@
package java.lang;
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
+
/**
* Exceptions may be thrown by one part of a Java program and caught
* by another in order to deal with exceptional conditions, in this case
@@ -38,6 +45,8 @@
* @since JDK 1.0
*
* @author Brian Jones
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 18, 1998.
*/
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException
{
@@ -61,8 +70,7 @@
* Create an exception indicating the illegal index.
*/
public ArrayIndexOutOfBoundsException(int index) {
- super(String.valueOf(index));
+ super("Array index out of range: " + index);
}
-
}
Index: java/lang/ExceptionInInitializerError.java
===================================================================
RCS file: /cvs/classpath/java/lang/ExceptionInInitializerError.java,v
retrieving revision 1.4
diff -u -r1.4 ExceptionInInitializerError.java
--- java/lang/ExceptionInInitializerError.java 2000/03/16 23:31:24 1.4
+++ java/lang/ExceptionInInitializerError.java 2001/03/11 15:41:19
@@ -1,5 +1,5 @@
/* ExceptionInInitializerError.java
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -27,12 +27,15 @@
package java.lang;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
/**
* An <code>ExceptionInInitializerError</code> is thrown when an
* unexpected exception has occurred in a static initializer or the
@@ -41,12 +44,14 @@
* @since JDK 1.1
*
* @author Brian Jones
+ * @author Tom Tromey <[EMAIL PROTECTED]>
+ * @date October 1, 1998
*/
public class ExceptionInInitializerError extends LinkageError
{
static final long serialVersionUID = 1521711792217232256L;
- private Throwable t = null;
+ private Throwable exception = null;
/**
* Create an error without a message.
@@ -73,7 +78,7 @@
public ExceptionInInitializerError(Throwable t)
{
super();
- this.t = t;
+ exception = t;
}
/**
@@ -84,7 +89,7 @@
*/
public Throwable getException()
{
- return t;
+ return exception;
}
/**
@@ -92,13 +97,13 @@
*/
public void printStackTrace()
{
- if (t == null)
+ if (exception == null)
{
super.printStackTrace();
}
else
{
- t.printStackTrace();
+ exception.printStackTrace();
}
}
@@ -108,13 +113,13 @@
*/
public void printStackTrace(PrintStream ps)
{
- if (t == null)
+ if (exception == null)
{
super.printStackTrace(ps);
}
else
{
- t.printStackTrace(ps);
+ exception.printStackTrace(ps);
}
}
@@ -124,36 +129,13 @@
*/
public void printStackTrace(PrintWriter pw)
{
- if (t == null)
+ if (exception == null)
{
super.printStackTrace(pw);
}
else
{
- t.printStackTrace(pw);
+ exception.printStackTrace(pw);
}
- }
-
- /**
- * Serialize the object in a manner binary compatible with the JDK 1.2
- */
- private void writeObject(java.io.ObjectOutputStream s)
- throws IOException
- {
- ObjectOutputStream.PutField oFields;
- oFields = s.putFields();
- oFields.put("exception", this.t);
- s.writeFields();
- }
-
- /**
- * Deserialize the object in a manner binary compatible with the JDK 1.2
- */
- private void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- ObjectInputStream.GetField oFields;
- oFields = s.readFields();
- this.t = (Throwable)oFields.get("exception", (Throwable)null);
}
}
Index: java/lang/StringIndexOutOfBoundsException.java
===================================================================
RCS file: /cvs/classpath/java/lang/StringIndexOutOfBoundsException.java,v
retrieving revision 1.6
diff -u -r1.6 StringIndexOutOfBoundsException.java
--- java/lang/StringIndexOutOfBoundsException.java 2000/03/16 23:31:40 1.6
+++ java/lang/StringIndexOutOfBoundsException.java 2001/03/11 15:41:19
@@ -1,6 +1,6 @@
/* StringIndexOutOfBoundsException.java -- exception thrown to indicate
an attempt to access an index which is out of bounds.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -28,6 +28,12 @@
package java.lang;
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
/**
* Exceptions may be thrown by one part of a Java program and caught
* by another in order to deal with exceptional conditions.
@@ -40,6 +46,8 @@
* @since JDK 1.0
*
* @author Brian Jones
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 18, 1998.
*/
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException
{
@@ -66,6 +74,6 @@
*/
public StringIndexOutOfBoundsException(int index)
{
- super(String.valueOf(index));
+ super("String index out of range: " + index);
}
}
Index: java/lang/reflect/InvocationTargetException.java
===================================================================
RCS file: /cvs/classpath/java/lang/reflect/InvocationTargetException.java,v
retrieving revision 1.4
diff -u -r1.4 InvocationTargetException.java
--- java/lang/reflect/InvocationTargetException.java 2000/03/16 22:24:47 1.4
+++ java/lang/reflect/InvocationTargetException.java 2001/03/11 15:41:19
@@ -1,5 +1,5 @@
-/* java.lang.reflect.InvocationTargetException
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* InvocationTargetException.java - Wrapper exception for reflection
+ Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -27,14 +27,23 @@
package java.lang.reflect;
-import java.io.*;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * Status: Believed complete and correct.
+ */
+
/**
* InvocationTargetException is sort of a way to "wrap" whatever exception
* comes up when a method or constructor is called via Reflection.
*
* @author John Keiser
* @version 1.1.0, 31 May 1998
+ * @author Tom Tromey <[EMAIL PROTECTED]>
+ * @date December 12, 1998
+ *
* @see Method#invoke(Object,Object[])
* @see Constructor#newInstance(Object[])
*/
@@ -42,7 +51,8 @@
public class InvocationTargetException extends Exception
{
static final long serialVersionUID = 4085088731926701167L;
- private Throwable targetException = null;
+
+ private Throwable target = null;
protected InvocationTargetException()
{
@@ -57,7 +67,7 @@
public InvocationTargetException(Throwable targetException)
{
super();
- this.targetException = targetException;
+ target = targetException;
}
/**
@@ -70,7 +80,7 @@
public InvocationTargetException(Throwable targetException, String err)
{
super(err);
- this.targetException = targetException;
+ target = targetException;
}
/**
@@ -80,53 +90,30 @@
*/
public Throwable getTargetException()
{
- return targetException;
+ return target;
}
public void printStackTrace()
{
- if (targetException == null)
+ if (target == null)
super.printStackTrace();
else
- targetException.printStackTrace();
+ target.printStackTrace();
}
public void printStackTrace(PrintStream ps)
{
- if (targetException == null)
+ if (target == null)
super.printStackTrace(ps);
else
- targetException.printStackTrace(ps);
+ target.printStackTrace(ps);
}
public void printStackTrace(PrintWriter pw)
{
- if (targetException == null)
+ if (target == null)
super.printStackTrace(pw);
else
- targetException.printStackTrace(pw);
- }
-
- /**
- * Serialize the object in a manner binary compatible with the JDK 1.2
- */
- private void writeObject(java.io.ObjectOutputStream s)
- throws IOException
- {
- ObjectOutputStream.PutField oFields;
- oFields = s.putFields();
- oFields.put("target", targetException);
- s.writeFields();
- }
-
- /**
- * Deserialize the object in a manner binary compatible with the JDK 1.2
- */
- private void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- ObjectInputStream.GetField oFields;
- oFields = s.readFields();
- targetException = (Throwable)oFields.get("target", (Throwable)null);
+ target.printStackTrace(pw);
}
}
Index: java/text/ParseException.java
===================================================================
RCS file: /cvs/classpath/java/text/ParseException.java,v
retrieving revision 1.2
diff -u -r1.2 ParseException.java
--- java/text/ParseException.java 2000/03/15 22:42:44 1.2
+++ java/text/ParseException.java 2001/03/11 15:41:19
@@ -1,5 +1,5 @@
/* ParseException.java -- An error occurred while parsing.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -27,12 +27,19 @@
package java.text;
+/* Written using "Java Class Libraries", 2nd edition, plus online
+ * API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
/**
* This exception is thrown when an unexpected error occurs during parsing.
*
* @version 0.0
*
* @author Aaron M. Renn ([EMAIL PROTECTED])
+ * @author Per Bothner <[EMAIL PROTECTED]>
+ * @date October 25, 1998.
*/
public class ParseException extends Exception
{
@@ -44,7 +51,7 @@
/**
* This is the position where the error was encountered.
*/
-private int offset;
+private int errorOffset;
/*************************************************************************/
@@ -64,7 +71,7 @@
{
super(s);
- this.offset = offset;
+ errorOffset = offset;
}
/*************************************************************************/
@@ -77,7 +84,7 @@
public int
getErrorOffset()
{
- return(offset);
+ return(errorOffset);
}
} // class ParseException