[Bug java/12058] New: java.lang.Array.set(Object, int, Object) throws java.lang.IllegalArgumentException

wcrisman at softwarezealot dot com gcc-bugzilla@gcc.gnu.org
Mon Aug 25 20:22:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12058

           Summary: java.lang.Array.set(Object, int, Object) throws
                    java.lang.IllegalArgumentException
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wcrisman at softwarezealot dot com
                CC: gcc-bugs at gcc dot gnu dot org

Calling Array.set(array, 0, null); causes an java.lang.IllegalArgumentException.

This was tested on win2k using GCC 3.4-20030802 found at
http://www.thisiscool.com/gcc_mingw.htm.

Below is the test class.  Build scripts available if necessary.  This bug is
likely a problem with the java library and most likely exists on all platforms.
 Passing anything but null appears to work fine.  This is likely an easy thing
to fix.  I would like to try fixing it myself, but have not yet figured out how
to build GCC/GCJ for windows (tried on Mandrake, Cygwin, and Mingw).

import java.lang.reflect.*;

public class StackTrace {
public StackTrace() {
}
public void throwException() {
	throw new RuntimeException("choke me");
}

public static void main(String[] args) {
	try {
		java.io.File file = new java.io.File(".\\output.txt");
		java.io.StringWriter sw = new java.io.StringWriter();
		java.io.PrintWriter pw = new java.io.PrintWriter(sw);
		java.io.FileOutputStream fout = new java.io.FileOutputStream(file);
		java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(fout);

		try {
			//new StackTrace().throwException();
			Object[] array = new Object[2];
			
			out.writeObject("setting null\r\n");
			array[0] = null;
			out.writeObject("calling Array.set() w/obj\r\n");
			Array.set(array, 0, null);
			out.writeObject("success\r\n");
		} catch(Throwable ex) {
			ex.printStackTrace(pw);
			out.writeObject(sw.toString());
		}//catch//
	
		out.close();
		pw.close();
	}//try//
	catch(Throwable e) {
	}//catch//
}//main()//
}



More information about the Gcc-bugs mailing list