[jira] Created: (NANO-58) NullPointerException on nonexistent classpath scripts

jira-yCVjj/[email protected] Thu, 25 Mar 2004 20:01:35 -0500 (EST)
Newsgroups gmane.comp.java.nanocontainer.devel
Message-ID <[email protected]>
Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=NANO-58

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: NANO-58
    Summary: NullPointerException on nonexistent classpath scripts
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: NanoContainer
 Components: 
             nanoweb

   Assignee: 
   Reporter: Miguel A Paraz

    Created: Thu, 25 Mar 2004 8:00 PM
    Updated: Thu, 25 Mar 2004 8:00 PM

Description:
This trivial patch will check if getResource() fails for a nonexistent  script in the classpath.


--- NanoWebServlet.java	21 Mar 2004 16:11:18 -0000	1.1
+++ NanoWebServlet.java	26 Mar 2004 00:53:37 -0000
@@ -92,10 +92,14 @@
 
     private Object getScriptAction(String key, MutablePicoContainer container) throws SyntaxException, IOException {
         URL scriptURL = getClass().getResource(key);
-        Class scriptClass = cachingScriptClassLoader.getClass(scriptURL);
-        container.registerComponentImplementation(key, scriptClass);
-        Object result = container.getComponentInstance(key);
-        return result;
+        if (scriptURL == null) {
+            return null;
+        } else {
+            Class scriptClass = cachingScriptClassLoader.getClass(scriptURL);
+            container.registerComponentImplementation(key, scriptClass);
+            Object result = container.getComponentInstance(key);
+            return result;
+        }
     }
 
     private void setPropertiesWithOgnl(HttpServletRequest servletRequest, Object action) throws ServletException {



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira