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 153664

Summary: NullPointerException at com.sun.tools.javac.comp.Attr.visitTry
Product: java Reporter: thiagofcf <thiagofcf>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED    
Severity: blocker CC: alexlamsl, davidvc, jasnapaka, mpetras, oj-nb, sandun1234u, sreimers, tveimo
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=132001
Issue Type: DEFECT Exception Reporter: 132001
Attachments: stacktrace
stacktrace
stacktrace

Description thiagofcf 2008-11-21 19:28:34 UTC
Build: NetBeans IDE Dev (Build 200810181401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows XP, 5.1, x86

Stacktrace: 
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Attr.visitTry(Attr.java:974)
        at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1027)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:428)
        at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:444)
        at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:798)
Comment 1 thiagofcf 2008-11-21 19:28:40 UTC
Created attachment 74025 [details]
stacktrace
Comment 2 Peter Pis 2008-11-22 07:00:50 UTC
Reassigning to java.
Comment 3 Dusan Balek 2008-11-28 15:23:48 UTC
As can be seen form the attach stack trace - exception was thrown while expanding some code template. Do you remember
which one it was? Is the issue reproducible? Thanks.
Comment 4 Exceptions Reporter 2009-01-09 12:13:56 UTC
Build: NetBeans IDE Dev (Build 200901080201)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Linux, 2.6.27.9-159.fc10.x86_64, amd64

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Attr.visitTry(Attr.java:974)
        at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1027)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:428)
        at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:444)
        at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:798)
Comment 5 Exceptions Reporter 2009-01-09 12:14:07 UTC
Created attachment 75634 [details]
stacktrace
Comment 6 _ alexlamsl 2009-02-09 22:50:51 UTC
Build: NetBeans IDE Dev (Build 200902090201)
VM: Java HotSpot(TM) Server VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Windows Vista, 6.0, x86

User Comments: 
Editing code - removal of if-statement condition line, which causes a (temporary) inbalance in braces

Stacktrace: 
java.lang.NullPointerException
        at com.sun.tools.javac.comp.Attr.visitTry(Attr.java:975)
        at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1027)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:391)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:428)
        at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:444)
        at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:798)
Comment 7 _ alexlamsl 2009-02-09 22:50:55 UTC
Created attachment 76761 [details]
stacktrace
Comment 8 _ alexlamsl 2009-02-09 23:11:23 UTC
I wasn't expanding any code templates, I was removing the first 4 lines of the following code:

    // Use getPackage() instead of property because property can fail on security check
    Package sysPackage = Runtime.getRuntime().getClass().getPackage();
    String sysVer = sysPackage.getSpecificationVersion();
    if (sysVer.startsWith("1.5")) {
        new JLabel();
    }

Before I can get to then remove the bottom line as well, I got stopped by this NPE.
Comment 9 Dusan Balek 2009-05-05 08:18:50 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/da9eb37ee0df

changeset f794f979a382 in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=f794f979a382
Comment 10 Quality Engineering 2009-05-07 07:48:57 UTC
Integrated into 'main-golden', will be available in build *200905070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/da9eb37ee0df
User: Dusan Balek <dbalek@netbeans.org>
Log: Issues #146205, #153664, #161870, #161915, #162097, #162302, #162451, #163931, and #163989 fixed.