From b0b928765957af262be16e5a87700426011afa13 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Thu, 11 Sep 2014 10:49:22 +0400 Subject: [PATCH] Fix NPE that is sometimes thrown when generating debug information. Enable debug information for html4j TCK --- teavm-classlib/pom.xml | 1 - .../main/java/org/teavm/model/util/LocationGraphBuilder.java | 4 +++- teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java | 2 -- teavm-html4j/pom.xml | 4 ++++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/teavm-classlib/pom.xml b/teavm-classlib/pom.xml index 1024cc56a..b9fc345ec 100644 --- a/teavm-classlib/pom.xml +++ b/teavm-classlib/pom.xml @@ -72,7 +72,6 @@ process-test-classes false - true 1 en, en_US, en_GB, ru, ru_RU diff --git a/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java b/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java index 1339dd985..aca23e20e 100644 --- a/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java @@ -79,7 +79,9 @@ class LocationGraphBuilder { } } if (graph.outgoingEdgesCount(step.block) == 0) { - addEdge(location, new InstructionLocation(null, -1)); + if (location != null) { + addEdge(location, new InstructionLocation(null, -1)); + } } else { for (int next : graph.outgoingEdges(step.block)) { stack.push(new Step(location, started ? new HashSet() : step.startLocations, diff --git a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java index 57f6fcfe5..3780bb586 100644 --- a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java +++ b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java @@ -368,7 +368,6 @@ public class TeaVMTestTool { try (OutputStream debugInfoOut = new FileOutputStream(new File(outputDir, targetName + ".teavmdbg"))) { debugInfo.write(debugInfoOut); } - log.info("Debug information successfully written"); } if (sourceMapsGenerated) { DebugInformation debugInfo = debugInfoBuilder.getDebugInformation(); @@ -377,7 +376,6 @@ public class TeaVMTestTool { new File(outputDir, sourceMapsFileName)), "UTF-8")) { debugInfo.writeAsSourceMaps(sourceMapsOut, targetName); } - log.info("Source maps successfully written"); } } diff --git a/teavm-html4j/pom.xml b/teavm-html4j/pom.xml index c38f21ed1..b9ad71bd3 100644 --- a/teavm-html4j/pom.xml +++ b/teavm-html4j/pom.xml @@ -81,6 +81,8 @@ false 1 ${project.build.directory}/javascript-test + true + true @@ -98,6 +100,8 @@ org.teavm.javascript.NullPointerExceptionTransformer + true + true