NanoContainer
  1. NanoContainer
  2. NANO-58

NullPointerException on nonexistent classpath scripts

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-1
    • Component/s: nanowar
    • Labels:
      None
    • Number of attachments :
      0

      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 {

        Activity

        Aslak Hellesøy made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.0-beta-1 [ 10147 ]
        Resolution Fixed [ 1 ]
        Assignee Aslak Hellesoy [ rinkrank ]

          People

          • Assignee:
            Aslak Hellesøy
            Reporter:
            Miguel Paraz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: