diff --git a/src/main/java/dev/lukebemish/immaculate/steps/WrapperFormattingStep.java b/src/main/java/dev/lukebemish/immaculate/steps/WrapperFormattingStep.java index d8402f2..8998069 100644 --- a/src/main/java/dev/lukebemish/immaculate/steps/WrapperFormattingStep.java +++ b/src/main/java/dev/lukebemish/immaculate/steps/WrapperFormattingStep.java @@ -29,7 +29,6 @@ public WrapperFormattingStep(String name, String workflowName, Project project, } return null; }).flatMap(javaToolchainService::launcherFor).orElse(javaToolchainService.launcherFor(spec -> {}))); - getJavaLauncher().convention(javaToolchainService.launcherFor(spec -> {})); this.objectFactory = objectFactory; getHideStacktrace().convention(project.getGradle().getStartParameter().getShowStacktrace() == ShowStacktrace.INTERNAL_EXCEPTIONS); this.getDependencies().getRuntime().add("dev.lukebemish.immaculate:wrapper", dep -> { diff --git a/wrapper/google-java-format/src/main/java/dev/lukebemish/immaculate/wrapper/googlejavaformat/GoogleJavaFormatWrapper.java b/wrapper/google-java-format/src/main/java/dev/lukebemish/immaculate/wrapper/googlejavaformat/GoogleJavaFormatWrapper.java index fd0c3a5..0c01287 100644 --- a/wrapper/google-java-format/src/main/java/dev/lukebemish/immaculate/wrapper/googlejavaformat/GoogleJavaFormatWrapper.java +++ b/wrapper/google-java-format/src/main/java/dev/lukebemish/immaculate/wrapper/googlejavaformat/GoogleJavaFormatWrapper.java @@ -29,7 +29,7 @@ public String format(String fileName, String text) { try { int ok = formatter.format(fullArgs); if (ok != 0) { - throw new RuntimeException("Failed to format " + fileName); + throw new RuntimeException("Failed to format " + fileName + ", exit code: " + ok); } } catch (Exception e) { if (e instanceof RuntimeException runtimeException) { @@ -37,9 +37,10 @@ public String format(String fileName, String text) { } else { throw new RuntimeException(e); } + } finally { + errWriter.flush(); + outWriter.flush(); } - errWriter.flush(); - outWriter.flush(); return outputStream.toString(StandardCharsets.UTF_8); } }