Author: jleroux
Date: Wed Apr 14 10:06:00 2010
New Revision: 933902

URL: http://svn.apache.org/viewvc?rev=933902&view=rev
Log:
Fix a bug reported by on user ML.
After some time spent on this I don't clearly see why David's changes are not 
working. I guess only the second would be needed but as they are the same I 
preferred to revert both

Modified:
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=933902&r1=933901&r2=933902&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
 Wed Apr 14 10:06:00 2010
@@ -269,7 +269,12 @@ public class CategoryWorker {
                 // if cur category is in crumb, remove everything after it and 
return
                 int cindex = trail.lastIndexOf(currentCategoryId);
 
-                trail = trail.subList(0, cindex);
+                if (cindex < (trail.size() - 1)) {
+                    for (int i = trail.size() - 1; i > cindex; i--) {
+                        String deadCat = trail.remove(i);
+                        //if (Debug.infoOn()) 
Debug.logInfo("[CategoryWorker.setTrail] Removed after current category index: 
" + i + " catname: " + deadCat, module);
+                    }
+                }
                 return trail;
             } else {
                 // current category is not in the list, and no previous 
category was specified, go back to the beginning
@@ -293,7 +298,12 @@ public class CategoryWorker {
         } else {
             // remove all categories after the previous category, preparing 
for adding the current category
             int index = trail.indexOf(previousCategoryId);
-            trail = trail.subList(0, index);
+            if (index < (trail.size() - 1)) {
+                for (int i = trail.size() - 1; i > index; i--) {
+                    String deadCat = trail.remove(i);
+                    //if (Debug.infoOn()) 
Debug.logInfo("[CategoryWorker.setTrail] Removed after current category index: 
" + i + " catname: " + deadCat, module);
+                }
+            }
         }
 
         // add the current category to the end of the list


Reply via email to