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 61710 - NPE when refactoring form
Summary: NPE when refactoring form
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks: 61142
  Show dependency tree
 
Reported: 2005-08-03 09:12 UTC by Jaromir Uhrik
Modified: 2005-09-05 09:58 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Ide.log attached (27.49 KB, text/plain)
2005-08-03 09:14 UTC, Jaromir Uhrik
Details
Stack trace (12.61 KB, text/plain)
2005-08-03 15:26 UTC, Jan Becicka
Details
Messages.log attached (45.31 KB, text/plain)
2005-08-04 08:35 UTC, Jaromir Uhrik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaromir Uhrik 2005-08-03 09:12:44 UTC
[dev build #200508021800]
Steps to reproduce:
1.Create new JFrame form "f1"
2.Rename it to "f2" (some informational exceptions appear in the console)
3.Rename it to "f3"
4.The following exception appears in the dialog:

java.lang.NullPointerException
	at
org.netbeans.modules.javacore.internalapi.GuardedQuery.isSectionGuarded(GuardedQuery.java:41)
	at
org.netbeans.modules.refactoring.CheckUtils.isRefactoringElementGuarded(CheckUtils.java:260)
	at
org.netbeans.modules.refactoring.spi.RefactoringElementsBag.add(RefactoringElementsBag.java:73)
	at
org.netbeans.modules.refactoring.plugins.RenameRefactoringPlugin.addElementsForJmiObject(RenameRefactoringPlugin.java:444)
	at
org.netbeans.modules.refactoring.plugins.RenameRefactoringPlugin.prepare(RenameRefactoringPlugin.java:384)
	at
org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:274)
	at
org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:140)
	at
org.netbeans.modules.refactoring.spi.ui.ParametersPanel$Prepare.run(ParametersPanel.java:675)
	at org.openide.util.Task.run(Task.java:207)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:469)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:870)
Comment 1 Jaromir Uhrik 2005-08-03 09:14:24 UTC
Created attachment 23437 [details]
Ide.log attached
Comment 2 Jaromir Uhrik 2005-08-03 09:58:10 UTC
When I click to the editor then the exception as following  appears:
Annotation: member: class y.f3
Annotation: name: y.f3
Annotation: class org.netbeans.jmi.javamodel.JavaClass$Impl
java.lang.IllegalStateException: cannot map class member to source hierarchy element
	at
org.netbeans.modules.java.ui.nodes.BridgeUtils.throwIllegalState(BridgeUtils.java:195)
	at
org.netbeans.modules.java.ui.nodes.BridgeUtils.chooseElement(BridgeUtils.java:184)
	at org.netbeans.modules.java.ui.nodes.BridgeUtils.getElement(BridgeUtils.java:121)
	at
org.netbeans.modules.java.ui.nodes.BridgeElement2Source.createClassNode(BridgeElement2Source.java:54)
	at
org.netbeans.modules.java.JavaEditor$JavaEditorComponent.createNode(JavaEditor.java:1293)
	at
org.netbeans.modules.java.JavaEditor$JavaEditorComponent.access$800(JavaEditor.java:1189)
	at org.netbeans.modules.java.JavaEditor$12.run(JavaEditor.java:1241)
	at org.openide.util.Mutex.readAccess(Mutex.java:195)
	at org.netbeans.modules.java.JavaEditor$11.run(JavaEditor.java:1239)
	at org.openide.util.Task.run(Task.java:207)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:469)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:870)
Comment 3 Jaromir Uhrik 2005-08-03 14:07:47 UTC
The issue appear just in case when calling Refactor->Rename while form Design
mode is on. 
Making the stopper of Q-build 200508021800 from this issue.
Comment 4 Jaromir Uhrik 2005-08-03 14:11:01 UTC
Adding Honza Stola to cc, because form module is one of potential cause.
Comment 5 Jan Becicka 2005-08-03 15:05:06 UTC
I don't see anything related to javacore module - why it is filed against java?.
Reassigning to form. Nothing was changed in refactoring module in this part of
code. Probably some new assertions was into form module...?
Comment 6 Jan Becicka 2005-08-03 15:07:45 UTC
> Probably some new assertions was into form module...?
well, some word is missing in this sentence, isn't it? :) I wanted to write:
Probably some new assertions was added into form module...?
Comment 7 Jan Becicka 2005-08-03 15:24:45 UTC
Sorry, I don't have good day today. I understand, why it was reproted in
javacore module. Because of NPE.

Anyway, I tried to reproduce this bug, and this assertions were printed to console:
java.lang.AssertionError
        at
org.netbeans.modules.form.FormDesigner$FormListener.formChanged(FormDesigner.java:1428)
Comment 8 Jan Becicka 2005-08-03 15:26:22 UTC
Created attachment 23478 [details]
Stack trace
Comment 9 Jaromir Uhrik 2005-08-04 08:33:23 UTC
Here is the better description of reproducible testcase:
1.Create j2se project "xyz"
2.In Projects view click on "xyz" package and invoke popup menu
3.Select New->JFrame Form...
4.Type the Class Name "f1" and push Finish button (don't switch Design mode to
Source!)
5.In Projects view click on "f1.java" and invoke popup menu
6.Select Refactor->Rename...
7.Type "f2" to New Name field and push Next> button
8.Push "Do Refactoring" button (some informational exceptions appear in the console)
9.In Projects view click on "f2.java" and invoke popup menu
10.Select Refactor->Rename...
11.Type "f3" to New Name field and push Next> button
12.java.lang.NullPointerException from
javacore.internalapi.GuardedQuery.isSectionGuarded(GuardedQuery.java:41)
appears in exception dialog
13.Close Exception dialog and push "Do Refactoring" button
14.Switch Design mode to Source
15.Click to editor
16.java.lang.IllegalStateException appears and appears periodicly when working
with source editor (I am attaching the message.log again for sure) 
Comment 10 Jaromir Uhrik 2005-08-04 08:35:09 UTC
Created attachment 23485 [details]
Messages.log attached
Comment 11 Jan Stola 2005-08-04 10:18:32 UTC
AssertionError was thrown by form module because we expected some method
to be called from event-dispatch thread only which was violated in this case.
I have fixed the AssertionError from the form module and the NPE
is no longer reproducible.

/cvs/form/src/org/netbeans/modules/form/FormEditor.java,v  <--  FormEditor.java
new revision: 1.74; previous revision: 1.73
Comment 12 Jaromir Uhrik 2005-08-05 09:12:24 UTC
Verified in dailz build #200508041800.