cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] git commit: [CXF-5721] Duplicating single quote if possible
Date Thu, 01 May 2014 15:34:33 GMT
Repository: cxf
Updated Branches:
  refs/heads/master a989069e5 -> 44c52c1e5


[CXF-5721] Duplicating single quote if possible


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c081ee4d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c081ee4d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c081ee4d

Branch: refs/heads/master
Commit: c081ee4dd10918d98ee7353bce560aa78f71339d
Parents: 0edab8d
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu May 1 16:32:07 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu May 1 16:32:07 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java     | 7 +++++++
 .../apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java    | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c081ee4d/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
index a91e56e..db9a81e 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
@@ -70,6 +70,13 @@ public final class SearchUtils {
         return value;
     }
     
+    public static String duplicateSingleQuoteIfNeeded(String value) {
+        if (value.indexOf('\'') != -1 && value.indexOf("\'\'") == -1) {
+            value = value.replaceAll("\'", "\'\'");
+        }
+        return value;
+    }
+    
     public static boolean containsEscapedChar(String value) {
         return value.contains("\\%") || value.contains("\\\\") || value.contains("\\_");
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c081ee4d/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
index e9f5342..3f62168 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
@@ -72,7 +72,8 @@ public class SQLPrinterVisitor<T> extends AbstractUntypedSearchConditionVisitor<
                 validatePropertyValue(name, value);
                 
                 value = SearchUtils.toSqlWildcardString(value, isWildcardStringMatch());
-                                
+                value = SearchUtils.duplicateSingleQuoteIfNeeded(value);
+                
                 if (tableAlias != null) {
                     name = tableAlias + "." + name;
                 }


Mime
View raw message