Bug 45472 - Different behavior handling Exception in Eclipse and outside
Summary: Different behavior handling Exception in Eclipse and outside
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-23 16:47 EDT by Christophe Elek CLA
Modified: 2003-10-23 22:59 EDT (History)
0 users

See Also:


Attachments
testcase (26.50 KB, application/zip)
2003-10-23 16:48 EDT, Christophe Elek CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Elek CLA 2003-10-23 16:47:10 EDT
Hi , I have an application that is behaving differently in Eclipse and outside
of Eclipse usign the same JDK.

I attached the JAR file with the source code.

When I run outside i get:

C:\temp>java -fullversion
java full version "J2RE 1.3.1 IBM Windows 32 build cn131-20030711a"

C:\temp>java -cp testFail.jar Main
DATA EXCEPTION
Exc->com.mbh.test.exceptions.DataException:[SEARCH_TIMEOUT] a search timeout
occurred in ProviderData.doZipSearchOnly


When I import the JAR in Eclipse 3.0 (M3 I think) and I run it I get:

DATA EXCEPTION
Exc->com.mbh.test.exceptions.DataException:[SEARCH_TIMEOUT] a search timeout
occurred in ProviderData.doZipSearchOnly


if I change the JDK of the application to use the first one:
java full version "J2RE 1.3.1 IBM Windows 32 build cn131-20030711a"

I get:
UNEXPECTED
Exc->com.mbh.test.exceptions.DataException:[UNEXPECTED_EXCEPTION] an unexpected
exception occurred in method ProviderData.doZipSearchOnly.  Error reported
[ZIP_SEARCH_TIMEOUT] A search timeout in throwDatabaseException occurred with a
zipcode of 10017 and a radius of 25


If I remove

static {
  addExceptionResource (DatabaseException.class, "databaseException");
}

from DatabaseException I then get

DATA EXCEPTION
Exc->com.mbh.test.exceptions.DataException:SEARCH_TIMEOUT

-----------------

I am puzzled :( because I thought it would be a bytecode issue in Eclipse, but
then it works fine when I use JDK 1.4.1 inside Eclipse ?

Who can shed some light on what is happening ?
Comment 1 Christophe Elek CLA 2003-10-23 16:48:58 EDT
Created attachment 6537 [details]
testcase
Comment 2 Olivier Thomann CLA 2003-10-23 17:10:35 EDT
How did you compile your code?
I guess it is related to the fact that .class no longer initialize the class.
Before it did. Did you compile your code with two different versions of Eclipse
or with javac?
Comment 3 Christophe Elek CLA 2003-10-23 17:26:29 EDT
Hello Olivier

Hum, good question
Obviously I believe Eclipse 3.0 recompiled no ?
I compiled with Eclipse 2.1 and exported
Are you suggesting I compile and export with Eclipse 3.0 and an external JDK ?
Comment 4 Olivier Thomann CLA 2003-10-23 17:35:25 EDT
This has been changed between Eclipse 2.1 and Eclipse 3.0. It has nothing to do
with the JDK that you are using.
The problem is that you assumed that the class literal (DatabaseException.class)
will initialize your class. This is not done anymore.
See bug 37565.
Comment 5 Christophe Elek CLA 2003-10-23 17:41:59 EDT
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHh ! :)
Comment 6 Olivier Thomann CLA 2003-10-23 18:22:42 EDT
Ok to close?
Comment 7 Christophe Elek CLA 2003-10-23 18:29:32 EDT
fine for me
Comment 8 Olivier Thomann CLA 2003-10-23 22:59:32 EDT
Close as INVALID.