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 115293 - NPE in SwingBrowser
Summary: NPE in SwingBrowser
Status: RESOLVED DUPLICATE of bug 71450
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: mslama
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on: 71450
Blocks:
  Show dependency tree
 
Reported: 2007-09-11 23:14 UTC by jschek
Modified: 2008-12-22 10:47 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 1348


Attachments
stacktrace (760 bytes, text/plain)
2007-09-11 23:14 UTC, jschek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jschek 2007-09-11 23:14:31 UTC
Build: NetBeans IDE Dev (Build 200709101200)
VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06
OS: Windows 2003, 5.2, x86

User Comments: 
Opened the Javadoc Index Search via the Help menu.
Typed in the search term "Server". The JavaDocs include the standard JDK JavaDocs, anything included automatically with a webapp, and JavaDocs for ESRI ArcObjects.

I clicked on the first entry in the list of matches and got the null pointer exception.

Everything appears to be working--the JavaDoc content panel shows the correct JavaDoc contents.
Comment 1 jschek 2007-09-11 23:14:50 UTC
Created attachment 48610 [details]
stacktrace
Comment 2 Jan Pokorsky 2007-09-19 19:28:48 UTC
I optimized the search tool to invoke the html browser only once. It does not fixed the issue but minimize the
probability it occurs again.

/cvs/javadoc/src/org/netbeans/modules/javadoc/search/DocIndexItem.java,v  <--  DocIndexItem.java
new revision: 1.17; previous revision: 1.16
done
Checking in IndexSearch.java;
/cvs/javadoc/src/org/netbeans/modules/javadoc/search/IndexSearch.java,v  <--  IndexSearch.java
new revision: 1.69; previous revision: 1.68

Reassigning to openide/awt in order to evaluate the swing browser threading. The potential NPE reason could be at
org.openide.awt.SwingBrowserImpl.run where I found doc.putProperty(Document.StreamDescriptionProperty, null).

Try also to debug HtmlBrowser.setURL invocation. I was surprised how often it was rescheduled to other threads before it
comes to SwingBrowserImpl.run. Even more surprising is the count of passes through the SwingBrowserImpl.run.
Comment 3 mslama 2007-10-02 16:52:10 UTC
Yes threading is problem. Setting doc.putProperty(Document.StreamDescriptionProperty, null). is correct way
http://java.sun.com/javase/6/docs/api/javax/swing/JEditorPane.html#setPage(java.net.URL) how to force reload ie. skip
caching when the same URL is set to JEditorPane. Problem is that SwingBrowserImpl.run does it out of AWT thread but
JEditoPane accessesthis property in AWT thread without checking it is null or not. If this happens between
SwingBrowserImpl.run set property to null and call of JEditorPane.setPage(URL) NPE arises. => fix is to do this in AWT
thread. (We cannot synchronize access with AWT thread in JEditorPane or any other place in Swing. Another example Swing
is NOT thread safe.
Comment 4 mslama 2007-10-02 17:06:59 UTC
This is caused by fix of issue #71450.
Comment 5 mslama 2007-10-02 17:09:20 UTC
Quite easy to reproduce: Just press Reload button repeatedly on the same URL. It happens quite often though not always.
Comment 6 mslama 2007-10-02 17:53:20 UTC
It happens when URL has reference part ie it ends with #<something> which is usual when you select some method in Java
class eg: jar:file:/home/mslama/jdk-6-doc.zip!/docs/api/javax/swing/JEditorPane.html#JEditorPane()
Comment 7 mslama 2007-10-31 11:56:21 UTC

*** This issue has been marked as a duplicate of 71450 ***