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 121984 - Find usages gives warrning that Web Refactoring threw java.lang.NullPointerException
Summary: Find usages gives warrning that Web Refactoring threw java.lang.NullPointerEx...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: Other Linux
: P2 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
: 122897 125749 127326 131044 131556 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-15 12:38 UTC by fatkudu
Modified: 2008-09-18 16:33 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
var/log/messages.log file associated with error. (53.21 KB, text/plain)
2007-11-15 12:41 UTC, fatkudu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fatkudu 2007-11-15 12:38:22 UTC
Select a class name in a Java source file.
Right Click
Find Usages.
Hit "Find"
You get a dialog box with a list of errors/warnings.  One warning :
Module Web Refactoring threw java.lang.NullPointerException.  Please report a bug against Web Refactoring module and
attach your var/log/messages.log.

Note that most other refactorings / finds seem to have to go through this error too.  If the warning is ignored, the
correct things appear to happen.
Comment 1 fatkudu 2007-11-15 12:41:03 UTC
Created attachment 53037 [details]
var/log/messages.log file associated with error.
Comment 2 Erno Mononen 2007-11-15 13:02:04 UTC
Could you please attach your web.xml or an example of a web.xml file where this happens? Judging from the stacktrace it 
looks like the servlets in your web.xml file don't have a servlet class element at all, which is required. In any case, 
the NPE needs to be avoided in web/refactoring.
Comment 3 fatkudu 2007-11-15 14:08:32 UTC
There are indeed some <servlet> entries in web.xml which don't mention <servlet-class>

For instance :
    <servlet>
        <servlet-name>docs</servlet-name>
        <jsp-file>/WEB-INF/index.jsp</jsp-file>
        <load-on-startup>1</load-on-startup>
    </servlet>

A quick look at http://java.sun.com/dtd/web-app_2_3.dtd - snippet :
Used in: web-app
-->
<!ELEMENT servlet (icon?, servlet-name, display-name?, description?,
(servlet-class|jsp-file), init-param*, load-on-startup?, run-as?, security-role-ref*)>

appears to me to imply that <jsp-file> is a valid alternative to <servlet-class> ?
Comment 4 Erno Mononen 2007-11-20 18:17:25 UTC
Fixed in trunk. You're right in that the jsp-file element is a valid alternative, hence I'm upgrading this to P2. 
Thanks for reporting and following up on this.

Checking in WebRefactoringFactory.java;
/cvs/web/refactoring/src/org/netbeans/modules/web/refactoring/WebRefactoringFactory.java,v  <--  
WebRefactoringFactory.java
new revision: 1.21; previous revision: 1.20
done
Checking in WebXmlRefactoring.java;
/cvs/web/refactoring/src/org/netbeans/modules/web/refactoring/WebXmlRefactoring.java,v  <--  WebXmlRefactoring.java
new revision: 1.5; previous revision: 1.4
done
Checking in rename/RenameItem.java;
/cvs/web/refactoring/src/org/netbeans/modules/web/refactoring/rename/RenameItem.java,v  <--  RenameItem.java
new revision: 1.3; previous revision: 1.2
done
Comment 5 Erno Mononen 2007-11-29 19:35:15 UTC
*** Issue 122897 has been marked as a duplicate of this issue. ***
Comment 6 Erno Mononen 2008-02-18 09:27:00 UTC
*** Issue 127326 has been marked as a duplicate of this issue. ***
Comment 7 Erno Mononen 2008-02-20 09:18:43 UTC
*** Issue 125749 has been marked as a duplicate of this issue. ***
Comment 8 Erno Mononen 2008-03-25 16:44:01 UTC
*** Issue 131044 has been marked as a duplicate of this issue. ***
Comment 9 Erno Mononen 2008-04-02 07:57:09 UTC
*** Issue 131556 has been marked as a duplicate of this issue. ***
Comment 10 josin 2008-09-18 16:33:04 UTC
Verified.

Product Version: NetBeans IDE Dev (Build 200809180201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)