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 228271 - Fix Imports/auto import crashes IDE when extra semicolon in import block
Summary: Fix Imports/auto import crashes IDE when extra semicolon in import block
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-05 04:57 UTC by theshadow27
Modified: 2013-04-09 07:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test case for replicating the issue (4.92 KB, application/octet-stream)
2013-04-05 04:57 UTC, theshadow27
Details
.npss file attached from NetBeans (543.98 KB, application/x-npss)
2013-04-05 05:01 UTC, theshadow27
Details

Note You need to log in before you can comment on or make changes to this bug.
Description theshadow27 2013-04-05 04:57:05 UTC
Created attachment 133322 [details]
Test case for replicating the issue

In the attached testcase, you can see there are a large number of imports. On line 20, there is an extra semicolon. When you run the shortcut for fix imports (eg cmd+shift+i on OS X), a "long operation in progress" window shows up and the process adds thousands of lines of the same imports over and over to the file. CPU usage goes to 200%+, even if after pressing "cancel" in this dialog. 

Setting this to P2 because it is very easy to duplicate and is likely to occur in the wild. 

Product Version: NetBeans IDE Dev (Build 201304032301)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Mac OS X version 10.8.2 running on x86_64; US-ASCII; en_US (nb)
User directory: /Users/theshadow/Library/Application Support/NetBeans/dev
Cache directory: /Users/theshadow/Library/Caches/NetBeans/dev

Testcase and profile will follow.
Comment 1 theshadow27 2013-04-05 05:01:23 UTC
Created attachment 133323 [details]
.npss file attached from NetBeans

.npss file
Comment 2 theshadow27 2013-04-05 05:03:44 UTC
This snapshot illustrates the entire problem. The procedure was:
1) open test file
2) keyboard shortcut for fix imports. This adds a large number of imports, but does complete
3) keyboard shortcut for fix imports again. This adds many imports (thousands) but I click cancel before it can complete
4) wait a short time. When "checking for external changes" occurs, the CPU usage spikes to 200-300%
Comment 3 theshadow27 2013-04-05 05:05:08 UTC
Note also that force-quitting the IDE is the only way to stop the high CPU utilization.
Comment 4 theshadow27 2013-04-05 05:11:19 UTC
Maybe this should be java.editor? From the log:

INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: class org.netbeans.modules.java.navigation.BreadCrumbsScanningTask ignored cancel for 62 ms.
WARNING [org.netbeans.core.TimableEventQueue]: Still previous controller org.netbeans.modules.sampler.InternalSampler@13bf1d6d
WARNING [org.netbeans.modules.progress.ui.RunOffEDTImpl]: Lengthy operation: org.netbeans.modules.java.editor.imports.JavaFixAllImports$2:21,184:2:19,874:10592.00
Comment 5 theshadow27 2013-04-05 05:19:27 UTC
Duplicated on 7.3+win7