You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/10/12 18:29:53 UTC

svn commit: r1631204 - in /ofbiz/branches/release13.07: ./ applications/content/src/org/ofbiz/content/content/ applications/product/src/org/ofbiz/product/category/

Author: jleroux
Date: Sun Oct 12 16:29:53 2014
New Revision: 1631204

URL: http://svn.apache.org/r1631204
Log:
"Applied fix from trunk for revision: 1631203  " 
------------------------------------------------------------------------
r1631203 | jleroux | 2014-10-12 18:28:31 +0200 (dim. 12 oct. 2014) | 9 lignes

An enhanced patch from Josip Almasi for "Can't mount root web app" https://issues.apache.org/jira/browse/OFBIZ-5799

After mounting ecommerce as root web app, I got ScreenRenderException, caused by StringIndexOutOfBoundsException: String index out of range: -1 
at  org.ofbiz.product.category.CatalogUrlServlet.makeCatalogUrl(CatalogUrlServlet.java:186)

Categories and products cannot be rendered.

jleroux: I added 2 other cases to Josip's patch.
Note: you could mount the ecommerce as root web app between R9.04 and R11.04 (included)
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
    ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java
    ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1631203

Modified: ofbiz/branches/release13.07/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java?rev=1631204&r1=1631203&r2=1631204&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java (original)
+++ ofbiz/branches/release13.07/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java Sun Oct 12 16:29:53 2014
@@ -152,7 +152,7 @@ public class ContentUrlFilter extends Co
         }
         StringBuilder urlBuilder = new StringBuilder();
         urlBuilder.append(request.getSession().getServletContext().getContextPath());
-        if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
+        if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
             urlBuilder.append("/");
         }
         urlBuilder.append(CONTROL_MOUNT_POINT);

Modified: ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java?rev=1631204&r1=1631203&r2=1631204&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java (original)
+++ ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java Sun Oct 12 16:29:53 2014
@@ -356,7 +356,7 @@ public class CatalogUrlFilter extends Co
         if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
             StringBuilder urlBuilder = new StringBuilder();
             urlBuilder.append(contextPath);
-            if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
+            if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
                 urlBuilder.append("/");
             }
             // append alternative URL
@@ -431,7 +431,7 @@ public class CatalogUrlFilter extends Co
         if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
             StringBuilder urlBuilder = new StringBuilder();
             urlBuilder.append(contextPath);
-            if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
+            if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
                 urlBuilder.append("/");
             }
             // append alternative URL

Modified: ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java?rev=1631204&r1=1631203&r2=1631204&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java (original)
+++ ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java Sun Oct 12 16:29:53 2014
@@ -157,7 +157,7 @@ public class CatalogUrlServlet extends H
     public static String makeCatalogUrl(HttpServletRequest request, String productId, String currentCategoryId, String previousCategoryId) {
         StringBuilder urlBuilder = new StringBuilder();
         urlBuilder.append(request.getSession().getServletContext().getContextPath());
-        if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
+        if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
             urlBuilder.append("/");
         }
         urlBuilder.append(CATALOG_URL_MOUNT_POINT);
@@ -183,7 +183,7 @@ public class CatalogUrlServlet extends H
     public static String makeCatalogUrl(String contextPath, List<String> crumb, String productId, String currentCategoryId, String previousCategoryId) {
         StringBuilder urlBuilder = new StringBuilder();
         urlBuilder.append(contextPath);
-        if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
+        if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
             urlBuilder.append("/");
         }
         urlBuilder.append(CATALOG_URL_MOUNT_POINT);