mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Replaced Tail Recursion while while/true loops. (#1019)
This commit is contained in:
committed by
Rob Bygrave
parent
8cef603d1c
commit
951e517caf
@@ -36,41 +36,43 @@ public final class DeployUpdateParser extends DeployParser {
|
||||
}
|
||||
|
||||
private String convertSubword(int start, String currentWord, StringBuilder localBuffer) {
|
||||
while (true) {
|
||||
|
||||
int dotPos = currentWord.indexOf('.', start);
|
||||
if (start == 0 && dotPos == -1) {
|
||||
return currentWord;
|
||||
}
|
||||
if (start == 0) {
|
||||
localBuffer = new StringBuilder();
|
||||
}
|
||||
if (dotPos == -1) {
|
||||
// no match...
|
||||
localBuffer.append(currentWord.substring(start));
|
||||
return localBuffer.toString();
|
||||
}
|
||||
int dotPos = currentWord.indexOf('.', start);
|
||||
if (start == 0 && dotPos == -1) {
|
||||
return currentWord;
|
||||
}
|
||||
if (start == 0) {
|
||||
localBuffer = new StringBuilder();
|
||||
}
|
||||
if (dotPos == -1) {
|
||||
// no match...
|
||||
localBuffer.append(currentWord.substring(start));
|
||||
return localBuffer.toString();
|
||||
}
|
||||
|
||||
// append up to the dot
|
||||
localBuffer.append(currentWord.substring(start, dotPos + 1));
|
||||
// append up to the dot
|
||||
localBuffer.append(currentWord.substring(start, dotPos + 1));
|
||||
|
||||
if (dotPos == currentWord.length() - 1) {
|
||||
// ends with a "." ???
|
||||
return localBuffer.toString();
|
||||
}
|
||||
if (dotPos == currentWord.length() - 1) {
|
||||
// ends with a "." ???
|
||||
return localBuffer.toString();
|
||||
}
|
||||
|
||||
// get the remainder after the dot
|
||||
start = dotPos + 1;
|
||||
String remainder = currentWord.substring(start, currentWord.length());
|
||||
// get the remainder after the dot
|
||||
start = dotPos + 1;
|
||||
String remainder = currentWord.substring(start, currentWord.length());
|
||||
|
||||
//String dbWord = deployMap.get(remainder.toLowerCase());
|
||||
String dbWord = getDeployWord(remainder);
|
||||
if (dbWord != null) {
|
||||
// we have found a match for the remainder
|
||||
localBuffer.append(dbWord);
|
||||
return localBuffer.toString();
|
||||
} else {
|
||||
//
|
||||
return convertSubword(start, currentWord, localBuffer);
|
||||
//String dbWord = deployMap.get(remainder.toLowerCase());
|
||||
String dbWord = getDeployWord(remainder);
|
||||
if (dbWord != null) {
|
||||
// we have found a match for the remainder
|
||||
localBuffer.append(dbWord);
|
||||
return localBuffer.toString();
|
||||
} else {
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user