The following comment has been added to this issue:
Author: Joe Parks
Created: Mon, 26 Jul 2004 12:55 PM
Body:
Rather than attempting to create the URI and catch a NullPointerException, you
could extract the parentId to a local variable and check for null:
JettyWebAppType jettyWebApp = (JettyWebAppType) plan;
String parentId = jettyWebApp.getParentId();
if (jettyWebApp == null) {
throw new DeploymentException("parentId not found in war module");
}
try {
return new URI(parentId);
} catch (URISyntaxException e) {
throw new DeploymentException("Invalid parentId " +
jettyWebApp.getParentId(), e);
}
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/GERONIMO-261?page=comments#action_36874
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/GERONIMO-261
Here is an overview of the issue:
---------------------------------------------------------------------
Key: GERONIMO-261
Summary: NullPointerException deploying EAR jetty module
Type: Bug
Status: Unassigned
Priority: Minor
Project: Apache Geronimo
Components:
deployment
Versions:
1.0-M2
Assignee:
Reporter: Eduardo Piva
Created: Sat, 3 Jul 2004 12:11 PM
Updated: Mon, 26 Jul 2004 12:55 PM
Environment: Linux kernel 2.6.7-rc3
JVM 1.4
Description:
If you specify a resource-env-ref or resource-ref in a web.xml file, and do not
specify the respective informations in the geronimo-jetty.xml file, you can get
a NullPointerException.
If you do not specify a configId or parentId in a geronimo-jetty.xml, when
you're creating a URI object, it will cause a NullPointerException, because a
null value is passed to URI constructor
(http://java.sun.com/j2se/1.4.2/docs/api/java/net/URI.html#URI(java.lang.String))
If you create a war file without a WEB-INF/geronimo-jetty.xml file, it will
cause a NullPointerException.
The fix for these three issues are simple, and can be found in the following
files (a diff will show where I touched):
http://www.las.ic.unicamp.br/~eduardo/geronimo/ENCConfigBuilder.java
http://www.las.ic.unicamp.br/~eduardo/geronimo/JettyModuleBuilder.java
All these issues now generates a DeploymentException error, with a message
inside it.
To verify the URI issue, I just added a catch to NullPointerException when I
create a URI object. I think that this is Ok, but it can be changed to
something more "elegant".
This issue can happen in more places. I found that with ejb and connector
modules we have the same problem. If the URI object was created in the method
getConfigId, in Class EARConfigBuilder, it would be much nicer. But, to do
that, we need to change the signature of Interface ModuleBuilder, so that
getConfigId and getParentId returns String, and then we can see if this String
is null inside EARConfigBuilder, and then return a URI object.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira