struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale Newfield (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-2670) ClassLoaderUtil bug ?
Date Sat, 07 Jun 2008 15:51:05 GMT

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


Mime
View raw message