You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Tobias Bocanegra (JIRA)" <ji...@apache.org> on 2008/01/15 22:17:34 UTC

[jira] Created: (SLING-158) NPE in SlingIOProvider if resource does not exist

NPE in SlingIOProvider if resource does not exist
-------------------------------------------------

                 Key: SLING-158
                 URL: https://issues.apache.org/jira/browse/SLING-158
             Project: Sling
          Issue Type: Bug
          Components: JSP
            Reporter: Tobias Bocanegra


for example when resolving a tag library:

Caused by: java.lang.NullPointerException
	at org.apache.sling.scripting.jsp.SlingIOProvider.getInputStream(SlingIOProvider.java:96)
	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.getResourceAsStream(TagLibraryInfoImpl.java:120)
	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:155)
	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseDirective(Parser.java:476)
	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseElements(Parser.java:1426)
	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parse(Parser.java:133)

Suggested patch:

Index: src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java
===================================================================
--- src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (revision 612138)
+++ src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (working copy)
@@ -93,6 +93,9 @@
             throws FileNotFoundException, IOException {
         try {
             Resource resource = getResourceInternal(fileName);
+            if (resource == null) {
+                throw new FileNotFoundException("Cannot find " + fileName);
+            }
             InputStream stream = resource.adaptTo(InputStream.class);
             if (stream == null) {
                 throw new FileNotFoundException("Cannot find " + fileName);


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-158) NPE in SlingIOProvider if resource does not exist

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra closed SLING-158.
----------------------------------


> NPE in SlingIOProvider if resource does not exist
> -------------------------------------------------
>
>                 Key: SLING-158
>                 URL: https://issues.apache.org/jira/browse/SLING-158
>             Project: Sling
>          Issue Type: Bug
>          Components: JSP
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> for example when resolving a tag library:
> Caused by: java.lang.NullPointerException
> 	at org.apache.sling.scripting.jsp.SlingIOProvider.getInputStream(SlingIOProvider.java:96)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.getResourceAsStream(TagLibraryInfoImpl.java:120)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:155)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseDirective(Parser.java:476)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseElements(Parser.java:1426)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parse(Parser.java:133)
> Suggested patch:
> Index: src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java
> ===================================================================
> --- src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (revision 612138)
> +++ src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (working copy)
> @@ -93,6 +93,9 @@
>              throws FileNotFoundException, IOException {
>          try {
>              Resource resource = getResourceInternal(fileName);
> +            if (resource == null) {
> +                throw new FileNotFoundException("Cannot find " + fileName);
> +            }
>              InputStream stream = resource.adaptTo(InputStream.class);
>              if (stream == null) {
>                  throw new FileNotFoundException("Cannot find " + fileName);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-158) NPE in SlingIOProvider if resource does not exist

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-158.
-------------------------------------

    Resolution: Fixed

Fixed as proposed in Rev. 613150.

In addition I also fixed a potential NPE in the internal getURL method, which did not check the result of getResourceInternal either.

Please close this bug, if fixes your issue. Thanks.

> NPE in SlingIOProvider if resource does not exist
> -------------------------------------------------
>
>                 Key: SLING-158
>                 URL: https://issues.apache.org/jira/browse/SLING-158
>             Project: Sling
>          Issue Type: Bug
>          Components: JSP
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> for example when resolving a tag library:
> Caused by: java.lang.NullPointerException
> 	at org.apache.sling.scripting.jsp.SlingIOProvider.getInputStream(SlingIOProvider.java:96)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.getResourceAsStream(TagLibraryInfoImpl.java:120)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:155)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseDirective(Parser.java:476)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseElements(Parser.java:1426)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parse(Parser.java:133)
> Suggested patch:
> Index: src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java
> ===================================================================
> --- src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (revision 612138)
> +++ src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (working copy)
> @@ -93,6 +93,9 @@
>              throws FileNotFoundException, IOException {
>          try {
>              Resource resource = getResourceInternal(fileName);
> +            if (resource == null) {
> +                throw new FileNotFoundException("Cannot find " + fileName);
> +            }
>              InputStream stream = resource.adaptTo(InputStream.class);
>              if (stream == null) {
>                  throw new FileNotFoundException("Cannot find " + fileName);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-158) NPE in SlingIOProvider if resource does not exist

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-158:
---------------------------------------

    Assignee: Felix Meschberger

> NPE in SlingIOProvider if resource does not exist
> -------------------------------------------------
>
>                 Key: SLING-158
>                 URL: https://issues.apache.org/jira/browse/SLING-158
>             Project: Sling
>          Issue Type: Bug
>          Components: JSP
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> for example when resolving a tag library:
> Caused by: java.lang.NullPointerException
> 	at org.apache.sling.scripting.jsp.SlingIOProvider.getInputStream(SlingIOProvider.java:96)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.getResourceAsStream(TagLibraryInfoImpl.java:120)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:155)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseDirective(Parser.java:476)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parseElements(Parser.java:1426)
> 	at org.apache.sling.scripting.jsp.jasper.compiler.Parser.parse(Parser.java:133)
> Suggested patch:
> Index: src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java
> ===================================================================
> --- src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (revision 612138)
> +++ src/main/java/org/apache/sling/scripting/jsp/SlingIOProvider.java   (working copy)
> @@ -93,6 +93,9 @@
>              throws FileNotFoundException, IOException {
>          try {
>              Resource resource = getResourceInternal(fileName);
> +            if (resource == null) {
> +                throw new FileNotFoundException("Cannot find " + fileName);
> +            }
>              InputStream stream = resource.adaptTo(InputStream.class);
>              if (stream == null) {
>                  throw new FileNotFoundException("Cannot find " + fileName);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.