[ 
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.

Reply via email to