From 3f38321bdf69a58c662cf0c8f5d4456ec23e8a5d Mon Sep 17 00:00:00 2001 From: Chrriis Date: Sun, 4 Mar 2012 22:11:20 +0000 Subject: [PATCH] [#1177] Add SQL Console module to jOOQ - minor formatter improvements (double quotes and multiple spaces aggregation). --- .../java/org/jooq/debug/console/misc/Utils.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/jOOQ-console/src/main/java/org/jooq/debug/console/misc/Utils.java b/jOOQ-console/src/main/java/org/jooq/debug/console/misc/Utils.java index 3ed33c7f69..facd35ab1b 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/console/misc/Utils.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/console/misc/Utils.java @@ -128,31 +128,32 @@ public class Utils { String textIndent = " "; StringBuilder sb = new StringBuilder(); int charCount = text.length(); - boolean isInQuotes = false; + char quoteStart = 0; boolean isLineStart = false; String currentIndent = ""; Stack isParenthesisNewLineStack = new Stack(); for(int i = 0; i i + 1 && isKeywordStart(text.substring(i + 1).trim())) { while(text.length() > i + 1 && text.charAt(i + 1) == ' ') { i++; @@ -200,7 +201,9 @@ public class Utils { sb.append('\n'); isLineStart = true; } else { - sb.append(c); + if(text.length() > i + 1 && text.charAt(i + 1) != ' ') { + sb.append(c); + } } break; }