Skip to content

Commit

Permalink
Merge pull request #873 from anuchandy/fix867
Browse files Browse the repository at this point in the history
ensure radomStrings are in lowercase
  • Loading branch information
Martin Sawicki authored Jun 21, 2016
2 parents 38f69fe + 8acddae commit 0231c41
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ResourceNamer {
* @param name the randName
*/
public ResourceNamer(String name) {
this.randName = name + UUID.randomUUID().toString().replace("-", "").substring(0, 3);
this.randName = name.toLowerCase() + UUID.randomUUID().toString().replace("-", "").substring(0, 3).toLowerCase();
}

/**
Expand All @@ -25,6 +25,7 @@ public ResourceNamer(String name) {
* @return the random name
*/
public String randomName(String prefix, int maxLen) {
prefix = prefix.toLowerCase();
int minRandomnessLength = 5;
if (maxLen <= minRandomnessLength) {
return randomString(maxLen);
Expand All @@ -50,7 +51,7 @@ private String randomString(int length) {
str += UUID.randomUUID()
.toString()
.replace("-", "")
.substring(0, Math.min(32, length));
.substring(0, Math.min(32, length)).toLowerCase();
}
return str;
}
Expand Down

0 comments on commit 0231c41

Please sign in to comment.