diff options
author | Shawn Pearce <sop@google.com> | 2013-02-04 10:16:08 -0800 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2013-02-04 10:16:08 -0800 |
commit | 7c98dd477537316e862e23ee6caf909f65cc8aa6 (patch) | |
tree | 8e7b9cf683a105ffcc7dbae1e18d6e4e12ec9735 /gerrit-prettify | |
parent | 59a1dacf93a2fad81e50c9bb91dad35da594ef36 (diff) |
Work around prettify stripping empty lines
Latest prettify build appears to delete empty lines from the end of
the input file. This causes Gerrit to crash with array exceptions
because the formatted HTML is a different length then the diff
hunks indicate.
Work around the broken prettify by inserting a fake HTML tag before
each LF and removing it after formatting is complete.
Change-Id: I6d82ce322d401743a8de5ab8090b2adc43a909f5
Diffstat (limited to 'gerrit-prettify')
-rw-r--r-- | gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java index c533429d52..56bd723d93 100644 --- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java +++ b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java @@ -145,8 +145,9 @@ public abstract class PrettyFormatter implements SparseHtmlFile { // Drop any '\r' to avoid this problem. html = html.replace("\r</span>\n", "</span>\n"); + html = html.replace("\n", "<lf>\n"); html = prettify(html, getFileType()); - + html = html.replace("<lf>\n", "\n"); } else { html = expandTabs(html); } |