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.
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)
Created attachment 23394 [details] CCE
Created attachment 23395 [details] IOE
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)
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
Fixed.
verified