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 61754 - [cc] NPE thrown when any link in javadoc window is clicked
Summary: [cc] NPE thrown when any link in javadoc window is clicked
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: PC All
: P3 blocker (vote)
Assignee: Martin Roskanin
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2005-08-03 13:43 UTC by Jiri Kovalsky
Modified: 2007-11-05 13:44 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE thrown when link in javadoc help window is clicked (1.97 KB, text/plain)
2005-08-03 13:45 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2005-08-03 13:43:56 UTC
Development build #200508021800 of NetBeans 4.2
Red Hat Linux 9, JDK 1.5.0_05

Description:
============
Whenever user tries to use links in code completion help window the IDE throws
below attached exception and code completion is closed.

Steps to reproduce:
===================
1. Create new sample web application project.
2. Set cursor at position 15:4 i.e. <ht|ml> and press CTRL+Space.
3. Use your mouse to click at underlined HTML link in the code completion help
window but nothing happens. Only NPE is thrown.
Comment 1 Jiri Kovalsky 2005-08-03 13:45:26 UTC
Created attachment 23458 [details]
NPE thrown when link in javadoc help window is clicked
Comment 2 Jiri Kovalsky 2005-08-08 10:35:11 UTC
Raising priority after some discussion in our QE department. Please note that
links in Java completion window work fine.
Comment 3 Marek Fukala 2005-09-16 19:45:17 UTC
Resolved - please read comments below.

However the fix is not an ideal fix due to following reasons. In the nb5.0 the
Editor Code Completion API has been introduced along with changes in the way how
the javadoc window behaves. AFAIK in the nb4.1 the javadoc links navigation was
handled by the component itself since the browser knew what is the URL from
which the provided text has been displayed and so was able to resolve these
links a properly navigate among more files/anchors. Now, in the 5.0, the module
code is required to handle the hyperlinks itself. 

CompletionDocumentation.resolveLink(...) is called whenever the user clicks to a
link in the javadoc window. This method is required to return a new instance of
 the CompletionDocumentation object for the selected hyperlink target. This is
the problematic part at least from the HTML javadoc point of view. 

I cannot simply resolve from the link which part of the document to show. I can
determine appropriate file, but I cannot determine exact part of the documennt
text based on the anchor. I can find the anchor itself, but I cannot determine
where is an end of the section referenced by the anchor.

The fix of this issue works as when I find the anchor in the document I cut the
text before the anchor and pass the rest into the javadoc window. So it behaves
"similar" to the 4.1. However this hack has at least following problem. When I
cut the text on the anchor line some significant open tags in the cut text can
be removed and so the html code is not rendered well.

So the solution would be to allow the javadoc component to handle the links
itself (for example when I return null from the resolveLink) or at least to
provide a way to return an offset or something similar to say the javadoc
component to scroll to it in the returned text.

Editor guys, I would like to resolve this problem somehow into 5.0. Meanwhile I
am at least downgrading this issue to P3 (the NPE is fixed and the linking works
for most cases).

Checking in src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java,v
 <--  HTMLCompletionQuery.java
new revision: 1.12; previous revision: 1.11
done
Checking in src/org/netbeans/editor/ext/html/javadoc/HelpManager.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/javadoc/HelpManager.java,v
 <--  HelpManager.java
new revision: 1.3; previous revision: 1.2
done
Comment 4 Marek Fukala 2005-10-10 15:39:04 UTC
Based on our offline agreement I am reassigning this issue to editor team. We
agreed to use default navigation mechanism when 

CompletionDocumentation.resolveLink(...) returns null.

See my previous comments to the problem.

This is an editor regression in comparison with previous release.
Comment 5 Martin Roskanin 2005-11-01 09:55:38 UTC
fixed in [maintrunk]

Checking in src/org/netbeans/modules/editor/completion/DocumentationScrollPane.java;
/cvs/editor/completion/src/org/netbeans/modules/editor/completion/DocumentationScrollPane.java,v
 <--  DocumentationScrollPane.java
new revision: 1.6; previous revision: 1.5

Checking in editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java,v
 <--  HTMLCompletionQuery.java
new revision: 1.23; previous revision: 1.22
done
Comment 6 Jiri Kovalsky 2006-03-24 09:44:47 UTC
Verified in FCS build #200601251500 of NetBeans 5.0.