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 70257 - Code completion crashes in some cases
Summary: Code completion crashes in some cases
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 70308 70348 70432 70474 (view as bug list)
Depends on:
Blocks: 70376
  Show dependency tree
 
Reported: 2005-12-12 11:37 UTC by Geertjan Wielenga
Modified: 2007-11-05 13:38 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NullPointerException (1.42 KB, text/plain)
2005-12-12 13:02 UTC, Martin Schovanek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2005-12-12 11:37:42 UTC
I'm using daily build from the 11th of December (downloaded from netbeans.org)
on Windows XP.

In some cases, code completion throws an error. I don't understand which cases
those are, but here's the code that I had where the error happens CONSISTENTLY
for me:

PaletteController controler = jbossddPaletteFactory.getPalette();
Lookup selection = controler.getSelectedItem();

And then I tried code completion on the controler method (i.e., I put the cursor
 in the second statement above, after the PERIOD). Then the code completion
flashes on the screen very quickly, then crashes, and then I see these errors:

java.lang.NullPointerException
	at
org.netbeans.modules.editor.java.NbJMICompletionJavaDoc$JMIParsingThread.getTypeName(NbJMICompletionJavaDoc.java:596)
	at
org.netbeans.modules.editor.java.NbJMICompletionJavaDoc$JMIParsingThread.getFieldHeader(NbJMICompletionJavaDoc.java:720)
	at
org.netbeans.modules.editor.java.NbJMICompletionJavaDoc$JMIParsingThread.run(NbJMICompletionJavaDoc.java:820)
	at
org.netbeans.modules.editor.java.JavaCompletionProvider$DocQuery$DocItem$MyJavaDoc.setItem(JavaCompletionProvider.java:274)
	at
org.netbeans.modules.editor.java.JavaCompletionProvider$DocQuery$DocItem$MyJavaDoc.access$100(JavaCompletionProvider.java:267)
	at
org.netbeans.modules.editor.java.JavaCompletionProvider$DocQuery$DocItem.<init>(JavaCompletionProvider.java:232)
	at
org.netbeans.modules.editor.java.JavaCompletionProvider$DocQuery.query(JavaCompletionProvider.java:199)
	at
org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:189)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926)
Comment 1 Dusan Balek 2005-12-12 12:24:36 UTC
Fixed in [maintrunk].

Checking in src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java,v
 <--  NbJMICompletionJavaDoc.java
new revision: 1.30; previous revision: 1.29
done
Comment 2 Dusan Balek 2005-12-12 12:35:28 UTC
diff:
http://java.netbeans.org/source/browse/java/editor/src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java?r1=1.29&r2=1.30

Mila, could you please review the fix for 5.0?
Roman, could you please test it?
Comment 3 Miloslav Metelka 2005-12-12 12:48:04 UTC
I approve the fix.
Comment 4 Roman Strobl 2005-12-12 12:56:30 UTC
Yes, I will test it in next daily build.
Comment 5 Martin Schovanek 2005-12-12 13:01:08 UTC
Got a similar exception.

to reproduce:
-------------
1) create new J2SE project
2) in Main.java:main() method type:
   Main.class.|
3) invoke CC

IDE throws:


Comment 6 Martin Schovanek 2005-12-12 13:02:47 UTC
Created attachment 27738 [details]
NullPointerException
Comment 7 Tomas Hurka 2005-12-13 09:36:26 UTC
Second NPE from TypeParameterImpl.initChildren fixed in trunk.
Checking in TypeParameterImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/TypeParameterImpl.java,v  
<--  TypeParameterImpl.java
new revision: 1.29; previous revision: 1.28
done
Comment 8 Tomas Hurka 2005-12-13 14:49:58 UTC
Helper method JavaModelUtil.createTypeReferenceFromType() added to allow code-completion to 
display information from Java classes which have netiher JavaDoc nor source files.

Checking in src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java,v  <--  
JavaModelUtil.java
new revision: 1.17; previous revision: 1.16
done
Checking in src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/
SemiPersistentElement.java,v  <--  SemiPersistentElement.java
new revision: 1.77; previous revision: 1.76
done


Comment 9 Dusan Balek 2005-12-13 15:01:24 UTC
Helper method JavaModelUtil.createTypeReferenceFromType() is called to display
information from Java classes which have netiher JavaDoc nor source files.

Checking in src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java,v
 <--  NbJMICompletionJavaDoc.java
new revision: 1.31; previous revision: 1.30
done
Comment 11 Jiri Prox 2005-12-13 15:31:56 UTC
*** Issue 70308 has been marked as a duplicate of this issue. ***
Comment 12 Miloslav Metelka 2005-12-13 16:32:33 UTC
I approve the editor's part of fix.
Comment 13 Tomas Hurka 2005-12-13 16:44:32 UTC
Diff for NbJMICompletionJavaDoc.java looks good.
Comment 14 Dusan Balek 2005-12-14 08:00:43 UTC
*** Issue 70348 has been marked as a duplicate of this issue. ***
Comment 15 Jan Becicka 2005-12-14 14:39:28 UTC
Diffs looks fine.
Comment 16 Roman Strobl 2005-12-14 15:33:25 UTC
I tested it on trunk build 200512131900 and didn't get the exception. I agree
with fixing in the release50 branch.
Comment 17 Roman Strobl 2005-12-14 15:49:42 UTC
This issue was also marked as a Q-build stopper due to many reports.
Comment 18 Jaromir Uhrik 2005-12-14 20:46:13 UTC
Although this issue is Q-build stopper we have no special Q-build branch. The
fix must go just to trunk and release50 branch.
Comment 19 Dusan Balek 2005-12-15 12:41:04 UTC
Integrated into [release50].

Checking in src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJMICompletionJavaDoc.java,v
 <--  NbJMICompletionJavaDoc.java
new revision: 1.29.2.1; previous revision: 1.29
done
Checking in src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/JavaModelUtil.java,v
 <--  JavaModelUtil.java
new revision: 1.16.4.1; previous revision: 1.16
done
Checking in
src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java,v
 <--  SemiPersistentElement.java
new revision: 1.76.2.1; previous revision: 1.76
done
Checking in
src/org/netbeans/modules/javacore/jmiimpl/javamodel/TypeParameterImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/TypeParameterImpl.java,v
 <--  TypeParameterImpl.java
new revision: 1.28.4.1; previous revision: 1.28
done
Comment 20 Dusan Balek 2005-12-16 16:30:37 UTC
*** Issue 70432 has been marked as a duplicate of this issue. ***
Comment 21 Jiri Prox 2005-12-19 07:51:27 UTC
*** Issue 70474 has been marked as a duplicate of this issue. ***
Comment 22 Max Sauer 2005-12-23 11:40:47 UTC
I'm not able to reproduce the NPE's anymore, marking as verified.

[5.0 200512222030 && dev 200512221900]