You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dale Newfield (JIRA)" <ji...@apache.org> on 2008/06/07 00:40:05 UTC

[jira] Created: (WW-2670) ClassLoaderUtil bug ?

ClassLoaderUtil bug ?
---------------------

                 Key: WW-2670
                 URL: https://issues.apache.org/struts/browse/WW-2670
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.2, 2.0.11.1
            Reporter: Dale Newfield


I've never seen this throw an exception, but if either of these code paths ever got executed, and the resourceName was passed as "", it should:

if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {

"".charAt(0) should throw an IndexOutOfBoundsException

Index: src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java
===================================================================
--- src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (revision 1782)
+++ src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (working copy)
@@ -59,7 +59,7 @@
              }
          }
 
-         if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
+         if (!iterator.hasNext() && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
              return getResources('/' + resourceName, callingClass, aggregate);
          }
 
@@ -94,7 +94,7 @@
             }
         }
 
-        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
+        if ((url == null) && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
             return getResource('/' + resourceName, callingClass);
         }



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


[jira] Commented: (WW-2670) ClassLoaderUtil bug ?

Posted by "Dale Newfield (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44073#action_44073 ] 

Dale Newfield commented on WW-2670:
-----------------------------------

Since this is really an xwork issue, I filed XW-638.  This can probably be closed.

> ClassLoaderUtil bug ?
> ---------------------
>
>                 Key: WW-2670
>                 URL: https://issues.apache.org/struts/browse/WW-2670
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11.1, 2.1.2
>            Reporter: Dale Newfield
>
> I've never seen this throw an exception, but if either of these code paths ever got executed, and the resourceName was passed as "", it should:
> if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> "".charAt(0) should throw an IndexOutOfBoundsException
> Index: src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java
> ===================================================================
> --- src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (revision 1782)
> +++ src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (working copy)
> @@ -59,7 +59,7 @@
>               }
>           }
>  
> -         if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +         if (!iterator.hasNext() && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>               return getResources('/' + resourceName, callingClass, aggregate);
>           }
>  
> @@ -94,7 +94,7 @@
>              }
>          }
>  
> -        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +        if ((url == null) && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>              return getResource('/' + resourceName, callingClass);
>          }

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


[jira] Resolved: (WW-2670) ClassLoaderUtil bug ?

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2670.
---------------------------

    Resolution: Incomplete

> ClassLoaderUtil bug ?
> ---------------------
>
>                 Key: WW-2670
>                 URL: https://issues.apache.org/struts/browse/WW-2670
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11.1, 2.1.2
>            Reporter: Dale Newfield
>
> I've never seen this throw an exception, but if either of these code paths ever got executed, and the resourceName was passed as "", it should:
> if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> "".charAt(0) should throw an IndexOutOfBoundsException
> Index: src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java
> ===================================================================
> --- src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (revision 1782)
> +++ src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (working copy)
> @@ -59,7 +59,7 @@
>               }
>           }
>  
> -         if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +         if (!iterator.hasNext() && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>               return getResources('/' + resourceName, callingClass, aggregate);
>           }
>  
> @@ -94,7 +94,7 @@
>              }
>          }
>  
> -        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +        if ((url == null) && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>              return getResource('/' + resourceName, callingClass);
>          }

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


[jira] Commented: (WW-2670) ClassLoaderUtil bug ?

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44131#action_44131 ] 

James Holmes commented on WW-2670:
----------------------------------

Why is this marked incomplete? Not sure what that status means. I noticed Ranier committed this fix in XWork this week. Should the status of this be fixed instead of incomplete?

> ClassLoaderUtil bug ?
> ---------------------
>
>                 Key: WW-2670
>                 URL: https://issues.apache.org/struts/browse/WW-2670
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11.1, 2.1.2
>            Reporter: Dale Newfield
>
> I've never seen this throw an exception, but if either of these code paths ever got executed, and the resourceName was passed as "", it should:
> if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> "".charAt(0) should throw an IndexOutOfBoundsException
> Index: src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java
> ===================================================================
> --- src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (revision 1782)
> +++ src/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java  (working copy)
> @@ -59,7 +59,7 @@
>               }
>           }
>  
> -         if (!iterator.hasNext() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +         if (!iterator.hasNext() && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>               return getResources('/' + resourceName, callingClass, aggregate);
>           }
>  
> @@ -94,7 +94,7 @@
>              }
>          }
>  
> -        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
> +        if ((url == null) && (resourceName != null) && ((resourceName.length() == 0) || (resourceName.charAt(0) != '/'))) {
>              return getResource('/' + resourceName, callingClass);
>          }

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