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; } }