Skip to content

Commit

Permalink
Fix message tail concatenation in full_message
Browse files Browse the repository at this point in the history
* Don't append tail if it's empty, because that gives us a rogue
  newline character.
  • Loading branch information
headius committed May 8, 2024
1 parent eb5db1e commit d1a8740
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ private static void printErrMessageToStream(IRubyObject exception, RubyString er
if (highlight) errorStream.catString(RESET);
}

if (tail != null) {
if (tail != null && tail.length() > 0) {
errorStream.cat('\n');
if (!highlight) {
errorStream.catString(tail);
Expand Down Expand Up @@ -767,11 +767,11 @@ public static void printBacktraceToStream(ThreadContext context, IRubyObject bac
}
if (stackTraceLine instanceof RubyString) {
errorStream.catString("from " + stackTraceLine);
errorStream.cat('\n');
}
else {
errorStream.append(stackTraceLine);
}
errorStream.cat('\n');
}

if ((elements.length > i)) {
Expand Down

0 comments on commit d1a8740

Please sign in to comment.