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 168849 - NullPointerException at org.netbeans.modules.javahelp.HyperlinkEventProcessor.addTo
Summary: NullPointerException at org.netbeans.modules.javahelp.HyperlinkEventProcessor...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Help System (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Victor Vasilyev
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-21 07:02 UTC by hedge_hog
Modified: 2009-10-16 17:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 153862


Attachments
stacktrace (2.73 KB, text/plain)
2009-07-21 07:03 UTC, hedge_hog
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hedge_hog 2009-07-21 07:02:56 UTC
Build: NetBeans IDE 6.7 (Build 200906241340)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: Linux, 2.6.27.23-0.1-trace, i386

User Comments:
GUEST: Wollte Hilfe �ffnen

hedge_hog: Select:

Help>Help Contents

GUEST: Clicked on help and got this error.



Stacktrace: 
java.lang.NullPointerException<br/>
        at org.netbeans.modules.javahelp.HyperlinkEventProcessor.addTo(HyperlinkEventProcessor.java:101)<br/>
        at org.netbeans.modules.javahelp.JavaHelp.adjust(JavaHelp.java:941)<br/>
        at org.netbeans.modules.javahelp.JavaHelp.createJHelp(JavaHelp.java:919)<br/>
        at org.netbeans.modules.javahelp.JavaHelp.createAndDisplayJHelp(JavaHelp.java:498)<br/>
        at org.netbeans.modules.javahelp.JavaHelp.showHelp(JavaHelp.java:477)<br/>
        at org.netbeans.modules.javahelp.HelpCtxProcessor$ShortcutAction.actionPerformed(HelpCtxProcessor.java:207)<br/>
Comment 1 hedge_hog 2009-07-21 07:03:03 UTC
Created attachment 84963 [details]
stacktrace
Comment 2 creator79 2009-07-27 12:04:58 UTC
It is even so on all other operations that should trigger the help system. May be a good information to know, that NB
6.5 is installed in parallel. Could this be the problem?
Comment 3 creator79 2009-08-02 21:12:09 UTC
It looks like getContentViewer() returns null (not debugged), since I think that JHelp is not.
Please fix this, since the help system is currently not usable.
Do you need more information?

How can I help?
Comment 4 creator79 2009-08-21 15:03:16 UTC
Hi, this feature is very important.
If anybody could tell me how I can get rid of this or how I could fix it, please advise.

Cheers
Patrick
Comment 5 Victor Vasilyev 2009-08-21 22:52:04 UTC
Hi Patrick,

I am sorry for a delay. I hadn't a chance to look into this issue until now.

Yeah, it is unexpected behavior of my code. The bug means that the top-level GUI component JHelp [1] doesn't contain any
instances of the JEditorPane as a child GUI component. It is strange, because the reference implementation of the
JavaHelp, version 2.0_05 creates such instance unconditionally - javax.help.plaf.basic.BasicContentViewerUI$JHEditorPane
[2].

You are right a cause of the NPE is the null returned by the method getContentViewer(). 
A simplest way to avoid the throwing of the exception is to check the contentViewer value in the method adjust() [3]
and, in case if contentViewer is null, we need to return from that method, i.e. do nothing.
Nevertheless, I guess, we need find a root cause and more correct way to fix the issue, so that the desired behavior of
JavaHelp GUI won't be lost.

[1] https://javahelp.dev.java.net/source/browse/javahelp/trunk/jhMaster/JavaHelp/src/new/javax/help/JHelp.java?view=markup
[2]
https://javahelp.dev.java.net/source/browse/javahelp/trunk/jhMaster/JavaHelp/src/new/javax/help/plaf/basic/BasicContentViewerUI.java?view=markup
[3] http://hg.netbeans.org/main/file/9ca7ab1dd341/javahelp/src/org/netbeans/modules/javahelp/JavaHelp.java#l938

My first assumption that your system has got an unexpected configuration or has been misconfigured,
because the method getContentViewer() has passed tests on WinXP, Vista, Solaris without any problems. 

Could you please, give me exact info about configuration of a system where the issue has been caught?
- used OS distribution?
- used JDK bundle? 
- used NB bundle? i.e *.rpm, *.deb, *-linux*.sh, ...
- Does the JDK installation include jh.jar or jh-all.jar or jhall.jar or jh-*.jar in the any following dirs:
  $JDK_HOME/lib
  $JDK_HOME/jre/lib
  $JDK_HOME/jre/lib/ext
? May be such JAR is accessible in the system via CLASSPATH?
Comment 6 Victor Vasilyev 2009-08-24 02:38:53 UTC
I've tested the issue with the following configuration:

Build: NetBeans IDE 6.7.1 (Build 090813)
Java: 1.6.0_0; OpenJDK Client VM, 14.0-b15
OS: Linux version, 2.6.29.4-167.fc11.i586 running on i386; UTF-8; en_US (nb)
OS distro: Fedora 11
NB Bundle: netbeans-platform-6.7.1-1.fc12.noarch
JDK Bundle: java-1.6.0-openjdk-devel-1.6.0.0-27.b16.fc12.i686.rpm
JavaHelp Bundle: javahelp2-2.0.05-8.fc12.noarch.rpm

It works for me.
Comment 7 Victor Vasilyev 2009-08-24 18:05:38 UTC
A quick fix is provided in the trunk
http://hg.netbeans.org/main/rev/544b84e1d087
Comment 8 Victor Vasilyev 2009-08-25 15:40:02 UTC
Second edition of the quick fix is provided
http://hg.netbeans.org/main/rev/048744607755

It will also show additional info in the log that might help to find a cause of the issue. 
Comment 9 creator79 2009-10-14 19:51:55 UTC
Hi Victor,

I'm sorry, I did not notice your replies on this issue.

  Product Version         = NetBeans IDE 6.7 (Build 200906261335)
  Operating System        = Windows XP version 5.1 running on x86
  Java; VM; Vendor        = 1.6.0_15; Java HotSpot(TM) Client VM 14.1-b02; Sun Microsystems Inc.
  Runtime                 = Java(TM) SE Runtime Environment 1.6.0_15-b03

NB was updated to 6.7.1 in between via update manager, but it still shows the values as above.

Do you know when this fix will be available?
I'm not building NB myself.


Cheers
Patrick
Comment 10 creator79 2009-10-16 17:09:59 UTC
UPDATE:
After deactivating the Visual Paradigm SDE for Netbeans, the help worked again.
@hedge_hog: I saw in your Messages Log that this is exactly the same issue on your machine under Linux - there I found
the same strange error messages like on my machine. vpsdenb bla bla.

Victor, based on your your hint to look for jh*.jar or *javahelp* files I got the idea to look for such files also in
the different modules of Netbeans. 
Since I wasn't able to reactivate the module, I cannot reproduce the error any longer. Now it is uninstalled. Maybe
hedge_hog can send the jh.jar for further analysis.

Now I'm not sure if this an issue of Visual Paradigm or if is it something like a jar hell in netbeans modules.
Do you think it is possible to avoid something similar like this in future?
I saw that vpsdenb loads its own jh.jar through a classpath manifest entry. It seems like this happens at NB boot.


BTW isn't there something like a "Loaded Modules and JARs overview" or something similar in Netbeans? For issues like
these this would be very helpfull. 


Cheers
Patrick