This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61601 - CCE exception when surrounding with try - catch
Summary: CCE exception when surrounding with try - catch
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-01 14:57 UTC by Jiri Prox
Modified: 2005-09-05 10:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
CCE (1.65 KB, text/plain)
2005-08-01 14:57 UTC, Jiri Prox
Details
IOE (1.43 KB, text/plain)
2005-08-01 14:59 UTC, Jiri Prox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2005-08-01 14:57:28 UTC
NB 4.2 (dev build 20050801)
JDK 1.5.0_04

Two exceptions are thrown when applying hint "surround with try - catch".

steps to reproduce:
1) create new class:
public class ClassA {
    public ClassA(int x,int y) {                       
    }
    public int method()  {
        int x=2;
        if(x==1) throw new java.io.IOException();
        return x;        
    }
}

2) on the line begining  with 'if ...'  there is unreported exception, put
cursor on it
-> the lightbulb will appear
3) click on the bulb and select 'surround with try and catch'
-> CCE is thrown and after short time one or more IOE are added.
java.lang.ClassCastException: org.netbeans.jmi.javamodel.IfStatement$Impl
	at org.netbeans.modules.javacore.TryWrapper.wrap(TryWrapper.java:175)
	at
org.netbeans.modules.java.hints.TryWrapperJavaHint.implement(TryWrapperJavaHint.java:60)

java.lang.ClassCastException: org.netbeans.jmi.javamodel.IfStatement$Impl
	at org.netbeans.modules.javacore.TryWrapper.wrap(TryWrapper.java:175)
	at
org.netbeans.modules.java.hints.TryWrapperJavaHint.implement(TryWrapperJavaHint.java:60)
Comment 1 Jiri Prox 2005-08-01 14:57:46 UTC
Created attachment 23394 [details]
CCE
Comment 2 Jiri Prox 2005-08-01 14:59:42 UTC
Created attachment 23395 [details]
IOE
Comment 3 Jiri Prox 2005-08-01 15:00:20 UTC
Sorry, the second exception begins with:
javax.jmi.reflect.InvalidObjectException: Object was deleted.
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.throwInvalidObject(MetadataElement.java:145)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.initCheck(MetadataElement.java:129)
Comment 4 Pavel Flaska 2005-08-15 08:35:13 UTC
Fixed. There can be problems with indentation, but it is another issue. ;-)

Checking in src/org/netbeans/modules/javacore/TryWrapper.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/TryWrapper.java,v  <-- 
TryWrapper.java
new revision: 1.14; previous revision: 1.13
done
Comment 5 Pavel Flaska 2005-08-15 08:44:58 UTC
Fixed. There can be problems with indentation, but it is another issue. ;-)

Checking in src/org/netbeans/modules/javacore/TryWrapper.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/TryWrapper.java,v  <-- 
TryWrapper.java
new revision: 1.14; previous revision: 1.13
done
Comment 6 Pavel Flaska 2005-08-15 09:22:45 UTC
Fixed.
Comment 7 Jiri Prox 2005-08-30 10:32:22 UTC
verified