← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5004: Minor fix to code generator

 

------------------------------------------------------------
revno: 5004
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: dhis2
timestamp: Sat 2011-10-22 21:51:02 +0100
message:
  Minor fix to code generator
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/CodeGenerator.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-api/src/main/java/org/hisp/dhis/common/CodeGenerator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/CodeGenerator.java	2011-10-22 20:37:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/CodeGenerator.java	2011-10-22 20:51:02 +0000
@@ -40,7 +40,7 @@
     public static final String allowedChars = "0123456789" +
           "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
-    public static final int codeSize = 10;
+    public static final int codeSize = 11;
 
     /**
      * Generates a pseudo random string using the allowed characters
@@ -53,7 +53,7 @@
         SecureRandom sr = new SecureRandom();
 
         char[] randomChars = new char[11];
-        for (int i = 0; i< 11; ++i) {
+        for (int i = 0; i< codeSize; ++i) {
             randomChars[i] = allowedChars.charAt( sr.nextInt( 61) );
         }
         return new String(randomChars);