normalize stacktraces without "at" (IDEA-135914)
authorpeter <peter@jetbrains.com>
Tue, 3 Feb 2015 12:30:35 +0000 (13:30 +0100)
committerpeter <peter@jetbrains.com>
Tue, 3 Feb 2015 12:39:28 +0000 (13:39 +0100)
java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java
java/java-tests/testSrc/com/intellij/unscramble/NormalizeTextTest.java

index 1245f04103cd65dc2599ba21a572dfc116aa77fc..682d5824e008dcad1bfdfa5950afa8033bc18a86 100644 (file)
@@ -318,8 +318,8 @@ public class UnscrambleDialog extends DialogWrapper {
         builder.append(" ").append(trimSuffix(line));
         continue;
       }
-      if (!first && mustHaveNewLineBefore(line)) {
-        builder.append("\n");
+      if (!first && (mustHaveNewLineBefore(line) || StringUtil.endsWith(builder, ")"))) {
+        if (!StringUtil.endsWith(builder, "\n")) builder.append("\n");
         if (line.startsWith("\"")) builder.append("\n"); // Additional line break for thread names
       }
       first = false;
index e00b46d40241193a2644fae2165f813e26795576..a65e823fdd7c4792eb3e4a991ebc8b5c8cc69ff8 100644 (file)
@@ -109,6 +109,18 @@ public class NormalizeTextTest extends TestCase {
            "at org.apache.velocity.Template.merge(Template.java:256)");
   }
 
+  public void testWithoutAt() {
+    doTest(" java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)\n" +
+           " java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)\n" +
+           " java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:400)\n" +
+           " java.util.concurrent.ForkJoinTask.invokeAll(ForkJoinTask.java:837)\n",
+
+           " java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)\n" +
+           " java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)\n" +
+           " java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:400)\n" +
+           " java.util.concurrent.ForkJoinTask.invokeAll(ForkJoinTask.java:837)");
+  }
+
   private static void doTest(@NonNls String stackTrace, @NonNls String expected) {
     String normalized = UnscrambleDialog.normalizeText(stackTrace);
     assertEquals(expected, normalized);