[jOOQ/jOOQ#8986] Fix DDLDatabaseInitializer for RenderNameCase.UPPER

DDLDatabaseInitializer could previously cause a StackOverflowError when
using RenderNameCase.UPPER or RenderNameCase.LOWER. This is now fixed.
This commit is contained in:
Knut Wannheden 2019-08-06 13:43:29 +02:00
parent a4a7f0bfeb
commit 116cd25994

View File

@ -115,24 +115,27 @@ public final class DDLDatabaseInitializer {
boolean changed = false;
for (int i = 0; i < parts.length; i++) {
Name replacement = parts[i];
switch (nameCase) {
case LOWER_IF_UNQUOTED:
if (parts[i].quoted() == Quoted.QUOTED) break;
case LOWER:
parts[i] = DSL.quotedName(parts[i].first().toLowerCase(locale));
changed = true;
replacement = DSL.quotedName(parts[i].first().toLowerCase(locale));
break;
case UPPER_IF_UNQUOTED:
if (parts[i].quoted() == Quoted.QUOTED) break;
case UPPER:
parts[i] = DSL.quotedName(parts[i].first().toUpperCase(locale));
changed = true;
replacement = DSL.quotedName(parts[i].first().toUpperCase(locale));
break;
default:
break;
}
if (!replacement.equals(parts[i])) {
parts[i] = replacement;
changed = true;
}
}
if (changed)