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] Created: (WW-2670) ClassLoaderUtil bug ?
Date Fri, 06 Jun 2008 22:40:05 GMT
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.


Mime
View raw message