← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21831: Fix AbstractStatementBuilder.getUid()

 

------------------------------------------------------------
revno: 21831
committer: jimgrace@xxxxxxxxx
branch nick: dhis2
timestamp: Thu 2016-01-28 15:10:43 -0500
message:
  Fix AbstractStatementBuilder.getUid()
modified:
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2016-01-15 20:47:27 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2016-01-28 20:10:43 +0000
@@ -40,8 +40,11 @@
 public abstract class AbstractStatementBuilder
     implements StatementBuilder
 {
-    static final String AZaz = "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'";
-    static final String AZaz09 = "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'";
+    static final String AZaz = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+    static final String AZaz09 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+    static final String AZaz_QUOTED = QUOTE + AZaz + QUOTE;
+    static final String AZaz09_QUOTED = QUOTE + AZaz09 + QUOTE;
 
     @Override
     public String encode( String value )
@@ -95,17 +98,17 @@
     public String getUid()
     {
         return concatenate(
-            getCharAt( AZaz, "1 + " + getRandom( AZaz.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
-            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ) );
+            getCharAt( AZaz_QUOTED , "1 + " + getRandom( AZaz.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09_QUOTED, "1 + " + getRandom( AZaz09.length() ) ) );
     }
 
     @Override