You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/04/07 20:10:25 UTC

[myfaces-tobago] branch tobago-4.x updated: fix: StringIndexOutOfBoundsException issue: TOBAGO-2050

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-4.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-4.x by this push:
     new d8012b1  fix: StringIndexOutOfBoundsException issue: TOBAGO-2050
d8012b1 is described below

commit d8012b199251c2dd9008a75eea16a4a8f3499543
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Apr 7 22:09:21 2021 +0200

    fix: StringIndexOutOfBoundsException
    issue: TOBAGO-2050
---
 .../src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
index 22ccbce..11afbfe 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
@@ -185,7 +185,12 @@ public class WebXmlUtils {
       if (path.endsWith(suffix)) {
         return path;
       } else {
-        return path.substring(0, path.lastIndexOf('.')) + suffix;
+        final int lastIndex = path.lastIndexOf('.');
+        if (lastIndex >= 0) {
+          return path.substring(0, lastIndex) + suffix;
+        } else {
+          return path;
+        }
       }
     }
   }