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 2013/11/14 13:55:18 UTC

svn commit: r1541894 - in /ofbiz/trunk: applications/party/src/org/ofbiz/party/communication/ applications/product/src/org/ofbiz/product/product/ framework/common/src/org/ofbiz/common/login/ framework/webapp/src/org/ofbiz/webapp/control/

Author: jleroux
Date: Thu Nov 14 12:55:18 2013
New Revision: 1541894

URL: http://svn.apache.org/r1541894
Log:
This reverts r1541641 + 1541746
Local variables are always thread safe, no needs to worry about them

Modified:
    ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
    ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1541894&r1=1541893&r2=1541894&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Thu Nov 14 12:55:18 2013
@@ -18,6 +18,8 @@
  *******************************************************************************/
 
 package org.ofbiz.party.communication;
+import org.ofbiz.base.util.GeneralException;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -30,6 +32,7 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.mail.Address;
@@ -44,7 +47,6 @@ import javolution.util.FastMap;
 
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilHttp;
@@ -1185,9 +1187,10 @@ public class CommunicationEventServices 
 
                 // find the "Action" element and obtain its value (looking for "failed")
                 Pattern p2 = Pattern.compile("^Action: (.*)$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
+                Matcher m2 = p2.matcher(part2Text);
                 String action = null;
-                if (p2.matcher(part2Text).find()) {
-                    action = p2.matcher(part2Text).group(1);
+                if (m2.find()) {
+                    action = m2.group(1);
                 }
 
                 if (action != null && "failed".equalsIgnoreCase(action)) {
@@ -1201,10 +1204,11 @@ public class CommunicationEventServices 
 
                     // find the "Message-Id" element and obtain its value (looking for "failed")
                     Pattern p3 = Pattern.compile("^Message-Id: (.*)$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
+                    Matcher m3 = p3.matcher(part3Text);
                     String messageId = null;
-                    if (p3.matcher(part3Text).find()) {
-                        Debug.logInfo("Found message-id : " + p3.matcher(part3Text).group(), module);
-                        messageId = p3.matcher(part3Text).group(1);
+                    if (m3.find()) {
+                        Debug.logInfo("Found message-id : " + m3.group(), module);
+                        messageId = m3.group(1);
                     }
 
                     // find the matching communication event

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1541894&r1=1541893&r2=1541894&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Thu Nov 14 12:55:18 2013
@@ -1188,10 +1188,8 @@ public class ProductEvents {
             List<String> matchList = FastList.newInstance();
             Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
             Matcher regexMatcher = regex.matcher(productTags);
-            synchronized (regexMatcher) {
-                while (regexMatcher.find()) {
-                    matchList.add(regexMatcher.group().replace("'", ""));
-                }                
+            while (regexMatcher.find()) {
+                matchList.add(regexMatcher.group().replace("'", ""));
             }
             
             GenericValue userLogin = null;

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1541894&r1=1541893&r2=1541894&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Thu Nov 14 12:55:18 2013
@@ -23,6 +23,7 @@ import java.sql.Timestamp;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.transaction.Transaction;
@@ -956,7 +957,9 @@ public class LoginServices {
             boolean usePasswordPattern = UtilProperties.getPropertyAsBoolean("security.properties", "security.login.password.pattern.enable", true);
             if (usePasswordPattern) {
                 Pattern pattern = Pattern.compile(passwordPattern);
-                if (!pattern.matcher(newPassword).matches()) {
+                Matcher matcher = pattern.matcher(newPassword);
+                boolean matched = matcher.matches();
+                if (!matched) {
                     // This is a mix to handle the OOTB pattern which is only a fixed length
                     Map<String, String> messageMap = UtilMisc.toMap("minPasswordLength", Integer.toString(minPasswordLength));
                     String passwordPatternMessage = UtilProperties.getPropertyValue("security.properties",

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1541894&r1=1541893&r2=1541894&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Thu Nov 14 12:55:18 2013
@@ -26,6 +26,7 @@ import java.sql.Timestamp;
 import java.util.List;
 import java.util.Map;
 import java.util.ServiceLoader;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.servlet.ServletContext;
@@ -924,8 +925,9 @@ public class LoginWorker {
                         if (i == 0) {
                             String cn = x500Map.get("CN");
                             cn = cn.replaceAll("\\\\", "");
-                            if (pattern.matcher(cn).matches()) {
-                                userLoginId = pattern.matcher(cn).group(1);
+                            Matcher m = pattern.matcher(cn);
+                            if (m.matches()) {
+                                userLoginId = m.group(1);
                             } else {
                                 Debug.logInfo("Client certificate CN does not match pattern: [" + cnPattern + "]", module);
                             }