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 170675 - NPE in new Java Card servlet template
Summary: NPE in new Java Card servlet template
Status: RESOLVED FIXED
Alias: None
Product: javacard
Classification: Unclassified
Component: Java Card (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ tboudreau
URL:
Keywords:
Depends on:
Blocks: 170636
  Show dependency tree
 
Reported: 2009-08-19 18:44 UTC by _ tboudreau
Modified: 2009-09-01 06:03 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2009-08-19 18:44:07 UTC
Need stack trace from current build from Anki to reproduce.  See http://wiki.netbeans.org/JavaCardTODOs
Comment 1 ankinelaturu 2009-08-25 00:04:22 UTC
Here is the NPE stacktrace.

java.lang.NullPointerException
	at 
org.netbeans.modules.javacard.templates.ServletDeploymentWizardPanel$1.run(ServletDeploymentWizardPanel.java:78)
	at org.openide.util.Mutex.readAccess(Mutex.java:362)
	at 
org.netbeans.modules.javacard.templates.ServletDeploymentWizardPanel.<init>(ServletDeploymentWizardPanel.java:72)
	at org.netbeans.modules.javacard.templates.ServletWizardIterator.getPanels(ServletWizardIterator.java:109)
	at org.netbeans.modules.javacard.templates.ServletWizardIterator.current(ServletWizardIterator.java:212)
	at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.current(TemplateWizard.java:980)
	at org.openide.loaders.TemplateWizardIterImpl.current(TemplateWizardIterImpl.java:140)
	at org.openide.loaders.TemplateWizardIteratorWrapper.current(TemplateWizardIteratorWrapper.java:89)
	at org.openide.WizardDescriptor.updateStateOpen(WizardDescriptor.java:863)
	at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:837)
	at org.openide.loaders.TemplateWizard.updateState(TemplateWizard.java:731)
	at org.netbeans.modules.project.ui.NewFileWizard.updateState(NewFileWizard.java:118)
Comment 2 _ tboudreau 2009-08-25 05:08:27 UTC
Okay, this is interesting.  The thing that is null is the file WEB-INF/web.xml - it doesn't exist in the project.

A few ways we can solve this:
1.  Don't try to update the web.xml if it doesn't exist (in the code should not assume any file's guaranteed existence)
2.  Don't allow this template to be used at all in a non-javacard-web project (but still do the null check, possibly
warn the user - they can always configure it later using the Web page of the project properties dialog to update the
web.xml)
3.  Create and update the web.xml if it doesn't exist

Any particular preference?
Comment 3 _ tboudreau 2009-08-27 17:29:36 UTC
Anki, any particular preference on how I solve this?
Comment 4 ankinelaturu 2009-08-28 18:08:35 UTC
The file WEB-INF/web.xml exists. And the file gets created when creating web project.
I guess you tried to create Applet project.
Comment 5 _ tboudreau 2009-08-31 17:01:40 UTC
> The file WEB-INF/web.xml exists.

So, you are saying, you can reproduce this exception creating a servlet in a project where WEB-INF/web.xml exists?

Either way, should fix it so it won't be broken on Applet projects;  but if it fails on a web project, then something
else is wrong.  Let me know steps to reproduce in a web project, if any.
Comment 6 ankinelaturu 2009-08-31 17:24:33 UTC
yes we need to fix for Applet projects also.

For web projects - to -reproduce
1. Create a new web project.
2. Try adding new Servlet class using the popup menu 
      As you know the menu may be there already in the popup or 
      you have to select other .... and then chose Java Card category(New | Other | Java Card servlet)

This will throw NPE.

Looks like it is the same reason the NPE is, not able to find web.xml file even for web projects.
Comment 7 _ tboudreau 2009-08-31 21:00:31 UTC
Fixed in changeset 45c7eee6a62c
Comment 8 Quality Engineering 2009-09-01 06:03:22 UTC
Integrated into 'main-golden', will be available in build *200909010201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/45c7eee6a62c
User: Tim Boudreau <tboudreau@netbeans.org>
Log: #170675 - NPE due to forward reference in servlet template.  Also removed one parameterization warning, wildcard imports, and properly log exceptions in WebXMLRefactoring.