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 199296

Summary: NullPointerException at com.sun.tools.javac.comp.Flow.visitTry
Product: platform Reporter: dbcurtis <dbcurtis>
Component: FilesystemsAssignee: Jaroslav Tulach <jtulach>
Status: VERIFIED FIXED    
Severity: normal CC: jkovalsky, MackSix, mmirilovic, tzezula
Priority: P1    
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 179257
Attachments: stacktrace
stacktrace
Here is the dump file that was in .netbeans/dev/var/log/
This is the log file from the first occurance.
This is the dump file from the first occurance.
This is the log file before these exceptions occured.
Project that exhibits the error.
Unit test showing the problem
Possible fix

Description dbcurtis 2011-06-09 04:27:10 UTC
This bug was originally marked as duplicate of bug 162245, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.0 (Build 201104080000)
VM: Java HotSpot(TM) Client VM, 19.1-b02, Java(TM) SE Runtime Environment, 1.6.0_24-b07
OS: Windows 7

User Comments:
dbcurtis: debugging, stepping through code




Stacktrace: 
java.lang.NullPointerException
   at com.sun.tools.javac.comp.Flow.visitTry(Flow.java:1130)
   at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1049)
   at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
   at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:528)
   at com.sun.tools.javac.comp.Flow.scanStats(Flow.java:536)
   at com.sun.tools.javac.comp.Flow.visitBlock(Flow.java:829)
Comment 1 dbcurtis 2011-06-09 04:27:16 UTC
Created attachment 108816 [details]
stacktrace
Comment 2 Dusan Balek 2011-10-21 16:11:20 UTC
Hard to fix without a reproducible test case. Are you able to reproduce the
issue? If so, could you please create a simple test case and attach it to the
issue? Thanks.
Comment 3 dbcurtis 2011-10-21 17:43:36 UTC
I am not at a computer where I try to reproduce it.
I believe that it is sorta random and not predictably reproducible.

Sorry
Dan
Comment 4 MackSix 2011-11-07 22:39:44 UTC
Created attachment 112961 [details]
stacktrace

It did it again doing the same edit. It is reproducable, but I don't know if I can reproduce once I restart NetBeans. :)
Comment 5 MackSix 2011-11-07 22:42:14 UTC
Created attachment 112962 [details]
Here is the dump file that was in .netbeans/dev/var/log/
Comment 6 MackSix 2011-11-07 22:44:59 UTC
Created attachment 112963 [details]
This is the log file from the first occurance.
Comment 7 MackSix 2011-11-07 22:45:35 UTC
Created attachment 112964 [details]
This is the dump file from the first occurance.
Comment 8 MackSix 2011-11-07 22:48:22 UTC
Created attachment 112965 [details]
This is the log file before these exceptions occured.

Before these exceptions occurred, I renamed the project with renaming of folder and it made and exception. Then I renamed the package. Then I tried to edit javaapplication7.java file that was in the project.
Comment 9 MackSix 2011-11-07 23:13:41 UTC
Created attachment 112966 [details]
Project that exhibits the error.

1) Open this project in NetBeans.
2) Rename project from JavaApplication72 to JavaApplication73 and choose to rename the folder while doing it.
3) Rename the package javaapplication72 to javaapplication72 with refactoring.
4) Open JavaApplication7.java and add type in the following code in main, but when "setVisible(boolean b) void" is visible in the auto complete window, press enter to complete the second line.

NewJFrame frame = new NewJFrame();
frame.setVisible(true);

After a second or two, this exception is thrown.
Comment 10 MackSix 2011-11-07 23:14:24 UTC
Product Version: NetBeans IDE Dev (Build 201111070600)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Comment 11 MackSix 2011-11-08 16:34:48 UTC
Here is a video of it happening:

http://youtu.be/FVvPHnxlT2E
Comment 12 MackSix 2011-11-18 13:03:49 UTC
Regression P1, ought to be fixed in 7.1.
Comment 13 Marian Mirilovic 2011-11-21 10:02:30 UTC
100% reproducible
Comment 14 Dusan Balek 2011-11-22 07:52:31 UTC
NPE fixed.

http://hg.netbeans.org/main-silver/rev/abe9a7d106d3
http://hg.netbeans.org/main/nb-javac/rev/7ad3298c5fd2

However the main problem here is that the renamed project is no more scanned (no changes in project sources are reflected in NB caches after the project rename).
Comment 15 Tomas Zezula 2011-11-22 10:46:44 UTC
The reason is that the recursive file listeners does not work after folder rename.
After the project rename no file change event are delivered, the problem is that in design of Holder + DeepListener.

The listener is added, and removed but when it's removed the folder was already renamed,
so the DeepListener does not remove the listener but marks itself as removed. When the recursive listener
is reattached to the renamed folder, it's not added into MasterFS listener list (because DeepListener which wraps the listener overrides equals, hashCode) and is equals to the old DeepListener which was not removed in the previous step (works fine on LocalFS! as it does not use Set<FCL> for listeners).
There are several ways how to fix it, the simplest fix is attached.
Comment 16 Tomas Zezula 2011-11-22 10:47:30 UTC
Created attachment 113404 [details]
Unit test showing the problem
Comment 17 Tomas Zezula 2011-11-22 10:47:56 UTC
Created attachment 113405 [details]
Possible fix
Comment 18 Jaroslav Tulach 2011-11-22 12:17:57 UTC
ergonomics#c34734397083
Comment 19 Quality Engineering 2011-11-22 15:51:06 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/abe9a7d106d3
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #199296: NullPointerException at com.sun.tools.javac.comp.Flow.visitTry - fixed.
Comment 20 Jiri Prox 2011-11-23 12:19:17 UTC
I'm sorry I have to reopen this bug, it is still reproducible


Product Version: NetBeans IDE Dev (Build 20111123-9a0b900a980d)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)
User directory: C:\Users\jprox\.netbeans\dev
Cache directory: C:\Users\jprox\.netbeans\dev\var\cache
Comment 21 Tomas Zezula 2011-11-23 16:50:06 UTC
I will test the Jarda part of the fix.
Comment 22 Jiri Prox 2011-11-24 14:58:23 UTC
I cannot reproduce it now in 


Product Version: NetBeans IDE Dev (Build 20111123-4be9bb06ff91)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)
User directory: D:\udir5
Cache directory: D:\udir5\var\cache
Comment 23 Dusan Balek 2011-11-24 15:36:09 UTC
With Jarda's fix it seems to work fine.
Comment 24 Jiri Prox 2011-11-24 15:47:57 UTC
the fixes can be ported to 7.1 branch
Comment 25 Quality Engineering 2011-11-24 16:01:16 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/c34734397083
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #199296: Use path in the DeepListener's equals method
Comment 26 Marian Mirilovic 2011-11-24 17:56:24 UTC
http://hg.netbeans.org/releases/rev/fd4d0e009d92
Comment 27 Quality Engineering 2011-11-25 06:17:51 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/c34734397083
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #199296: Use path in the DeepListener's equals method
Comment 28 Tomas Danek 2011-11-25 11:29:29 UTC
i was not able to reproduce in 


Product Version: NetBeans IDE 7.1 RC1 (Build 201111242103)
Java: 1.6.0_29; Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402
System: Mac OS X version 10.7.2 running on x86_64; MacRoman; en_US (nb)
User directory: /Users/tomas/.netbeans/7.1rc1
Cache directory: /Users/tomas/.netbeans/7.1rc1/var/cache