From 3862417a0848fd8094bfcae3add84852d7eaf660 Mon Sep 17 00:00:00 2001 From: Peter Streef Date: Fri, 26 Jul 2024 15:05:10 +0200 Subject: [PATCH] generate empty if null --- .../src/main/java/org/openrewrite/yaml/CreateYamlFile.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rewrite-yaml/src/main/java/org/openrewrite/yaml/CreateYamlFile.java b/rewrite-yaml/src/main/java/org/openrewrite/yaml/CreateYamlFile.java index 6bbbef3d4a9..4ef52c58ddd 100644 --- a/rewrite-yaml/src/main/java/org/openrewrite/yaml/CreateYamlFile.java +++ b/rewrite-yaml/src/main/java/org/openrewrite/yaml/CreateYamlFile.java @@ -126,12 +126,11 @@ public Yaml visitDocuments(Yaml.Documents documents, ExecutionContext ctx) { } @Language("yml") - @Nullable private String getYamlContents(ExecutionContext ctx) { @Language("yml") String yamlContents = fileContents; if (yamlContents == null && fileContentsUrl != null) { yamlContents = Remote.builder(Paths.get(relativeFileName), URI.create(fileContentsUrl)).build().printAll(ctx); } - return yamlContents; + return yamlContents == null ? "" : yamlContents; } }