cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r413926 - /incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java
Date Tue, 13 Jun 2006 16:01:38 GMT
Author: aadamchik
Date: Tue Jun 13 09:01:37 2006
New Revision: 413926

URL: http://svn.apache.org/viewvc?rev=413926&view=rev
Log:
CAY-567

Modified:
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java?rev=413926&r1=413925&r2=413926&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/exp/parser/PatternMatchNode.java
Tue Jun 13 09:01:37 2006
@@ -84,25 +84,31 @@
     protected Pattern getPattern() {
         // compile pattern on demand
         if (!patternCompiled) {
-            pattern = null;
-            patternCompiled = true;
 
-            if (jjtGetNumChildren() < 2) {
-                return null;
-            }
+            synchronized (this) {
 
-            // precompile pattern
-            ASTScalar patternNode = (ASTScalar) jjtGetChild(1);
-            if (patternNode == null) {
-                return null;
-            }
+                if (!patternCompiled) {
+                    pattern = null;
+                    patternCompiled = true;
 
-            String srcPattern = (String) patternNode.getValue();
-            if (srcPattern == null) {
-                return null;
-            }
+                    if (jjtGetNumChildren() < 2) {
+                        return null;
+                    }
 
-            pattern = Util.sqlPatternToPattern(srcPattern, ignoringCase);
+                    // precompile pattern
+                    ASTScalar patternNode = (ASTScalar) jjtGetChild(1);
+                    if (patternNode == null) {
+                        return null;
+                    }
+
+                    String srcPattern = (String) patternNode.getValue();
+                    if (srcPattern == null) {
+                        return null;
+                    }
+
+                    pattern = Util.sqlPatternToPattern(srcPattern, ignoringCase);
+                }
+            }
         }
 
         return pattern;



Mime
View raw message