By replacing HashMap with LinkedHashMap, you are hiding the real problem. The algorithm should not depend on insertion order, so there is a bug that needs to be fixed.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 6/8/2015 7:58 AM, Taher Alkhateeb wrote:
Hi Adrian,

In JDK 8 the HashMap does not respect order of insertion. I explained this
bug earlier in detail. Please take a look at what i wrote and you will see
why it is now a linkedhashmap.

Taher Alkhateeb
On Jun 8, 2015 5:52 PM, "Adrian Crum" <adrian.c...@sandglass-software.com>
wrote:

This commit does not make sense and it is unnecessary. Please revert it.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 6/7/2015 9:03 AM, jler...@apache.org wrote:

Author: jleroux
Date: Sun Jun  7 16:03:04 2015
New Revision: 1684042

URL: http://svn.apache.org/r1684042
Log:
A patch from Taher Alkhateeb "Upgrade OFBiz to Java JDK 8"
https://issues.apache.org/jira/browse/OFBIZ-6458
1st step: fixes a test which was not passing

Modified:
      ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java

Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1684042&r1=1684041&r2=1684042&view=diff

==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
Sun Jun  7 16:03:04 2015
@@ -24,6 +24,7 @@ import java.net.URLEncoder;
   import java.util.Collection;
   import java.util.HashMap;
   import java.util.Iterator;
+import java.util.LinkedHashMap;
   import java.util.LinkedHashSet;
   import java.util.LinkedList;
   import java.util.List;
@@ -48,7 +49,7 @@ public class StringUtil {
       protected static final Map<String, Pattern> substitutionPatternMap;

       static {
-        substitutionPatternMap = new HashMap<String, Pattern>();
+        substitutionPatternMap = new LinkedHashMap<String, Pattern>();
           substitutionPatternMap.put("&&", Pattern.compile("@and",
Pattern.LITERAL));
           substitutionPatternMap.put("||", Pattern.compile("@or",
Pattern.LITERAL));
           substitutionPatternMap.put("<=", Pattern.compile("@lteq",
Pattern.LITERAL));




Reply via email to