[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: Open FTL File from browser (OFBIZ-12018)

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

jamesyong pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d7a5d60  Fixed: Open FTL File from browser (OFBIZ-12018)
d7a5d60 is described below

commit d7a5d601bd9c07fa26f4f0d737841f651d749bff
Author: James Yong <[hidden email]>
AuthorDate: Fri Sep 25 13:00:34 2020 +0800

    Fixed: Open FTL File from browser (OFBIZ-12018)
   
    StringIndexOutOfBoundsException error in Windows
   
    Thanks Jacques for reporting.
---
 .../base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java   | 8 ++++----
 .../org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
index 4ca2e17..44bfe15 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHtml.java
@@ -121,8 +121,8 @@ public final class UtilHtml {
             try {
                 List<File> xmlThemes = ThemeFactory.getThemeXmlFiles();
                 visualThemeBasePathsName = new ArrayList<>();
-                String themePathKey = File.separator + "themes" + File.separator;
-                String pluginPathKey = File.separator + "plugins" + File.separator;
+                String themePathKey = "/themes/";
+                String pluginPathKey = "/plugins/";
                 for (File xmlTheme : xmlThemes) {
                     String path = xmlTheme.toURI().toURL().toString();
                     // get the path after themes or plugins folders
@@ -132,9 +132,9 @@ public final class UtilHtml {
                         path = path.substring(path.indexOf(pluginPathKey) + 9);
                     }
                     // get folder name
-                    path = path.substring(0, path.indexOf(File.separator));
+                    path = path.substring(0, path.indexOf("/"));
                     if (!path.contains("common-theme") && !path.contains("ecommerce")) {
-                        visualThemeBasePathsName.add(File.separator + path + File.separator);
+                        visualThemeBasePathsName.add("/" + path + "/");
                     }
                 }
             } catch (IOException e) {
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java
index e79a718..8b17243 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlWidgetRenderer.java
@@ -81,7 +81,7 @@ public class HtmlWidgetRenderer {
             // add additional visual label for non-theme ftl
             switch (boundaryType) {
             case "End":
-                String fileName = widgetName.substring(widgetName.lastIndexOf(File.separator) + 1);
+                String fileName = widgetName.substring(widgetName.lastIndexOf("/") + 1);
                 switch (namedBorderType) {
                 case SOURCE:
                     return "</div><div class='info-overlay'><span class='info-overlay-item'><a href='#' data-source='"