Issue #1146: trim string before escaping

This removes leading and trailing whitespace before escaping strings. This gets rid of annoying `\n` in some string literals (e.g. in annotations).
This commit is contained in:
Paul Ebermann
2015-08-28 19:56:37 +02:00
parent 28579cee03
commit 930c5191e0

View File

@@ -126,6 +126,7 @@ public class DefaultCodegen {
// override with any special text escaping logic
public String escapeText(String input) {
if (input != null) {
input = input.trim();
String output = input.replaceAll("\n", "\\\\n");
output = output.replace("\"", "\\\"");
return output;