JDK-4842396 : (reflect) InvocationTargetException thrown when run apps compiled by 1.3
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-04-03
  • Updated: 2012-09-28
  • Resolved: 2005-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.5.1Resolved
Related Reports
Duplicate :  
Description
###@###.### 2003-04-03

J2SE Version (please include all output from java -version flag):
  java version "1.4.2-beta"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
  Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

Operating System Configuration Information (be specific): 
  Windows 2000 Server, works fine with Solaris Sparc

Hardware Configuration Information (be specific): 
  Intel P3 processor.

Bug Description :
The problem occurs only if the classes are compiled using jdk13 or 131 and then 
run using jdk142. We are using reflection to invoke a method having a 
non-latin name. The invocation works fine the first few times, but 
fails the 5-6 time with the following stack trace :

java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
...

Note that we compile the classes using jdk1.3.0
[java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)]


To Reproduce :
1) Set the classpath to include jdk1.3.0 classes.
2) Create a folder "demo" and extract the attached demo.zip file into it. 
3) Compile the classes using cc.bat. 
4) Set the classpath to include jdk142 classes. It should not contain 
   jdk13 classes any more.
5) Run the demo using run.bat. Notice that the InvocationTargetException 
   is thrown during the 5th iteration of the outermost loop.

Note that it works fine if both compiled and run using 1.4.2.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon
14-06-2004

EVALUATION I've added a new attachment ("reduce.tar.Z") which is a reduction of the originally provided problem. The incompatability was introduced in jdk1.4. The InvocationTargetException is caused by a NoSuchMethodError during the fifth iteration of a call to Method.invoke. The bug is observed slightly earlier (thought after previous success) if the test is compiled in jdk1.3.1 and run in jdk1.4. -- iag@sfbay 2003-04-10 This is probably a bug in either reflection's built-in UTF-8 encoder (sun.reflect.UTF8, which is necessary for bootstrapping purposes) or javac's own internal UTF-8 encoder. Given that the problem doesn't appear if the 1.4.x javac is used I suspect that the bug is be in the 1.3.1 javac's UTF-8 encoding scheme. I've tried porting support for surrogate pairs from sun.nio.cs.UTF_8 to sun.reflect.UTF8 and the problem persists. Since this is the first reported instance of this bug against the 1.4.x line I don't think this is a showstopper for 1.4.2. ###@###.### 2003-04-10 Decommitting for 1.5 and committing to 1.5.1. ###@###.### 2004-04-29 This is probably a symptom of bug 4324508 in the 1.3.x compiler and was fixed in 1.4.0. ###@###.### 2004-04-29
29-04-2004

WORK AROUND ###@###.### 2003-04-03 recompiler all their java apps using 1.4.2.
03-04-2003