From 513f4c21a91ee98c2a863cbbbd45ce7a260d8e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Mon, 21 Oct 2024 08:53:55 +0200 Subject: [PATCH] Don't render blank lines (#164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- .../com/eprosima/idl/generator/manager/TemplateGroup.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eprosima/idl/generator/manager/TemplateGroup.java b/src/main/java/com/eprosima/idl/generator/manager/TemplateGroup.java index 0bea45b2..bce5ce45 100644 --- a/src/main/java/com/eprosima/idl/generator/manager/TemplateGroup.java +++ b/src/main/java/com/eprosima/idl/generator/manager/TemplateGroup.java @@ -98,7 +98,12 @@ public void setAttribute(String attribute, TemplateGroup tg) StringWriter out = new StringWriter(); STWriter wr = new AutoIndentWriter(out); template.get_st().write(wr, error_listener_); - m.getValue().get_st().add(attribute, out.toString()); + String out_string = out.toString(); + + if (!out_string.isBlank()) + { + m.getValue().get_st().add(attribute, out.toString()); + } // Unset the current TemplateSTGroup in TemplateManager. manager_.set_current_template_stgroup(null);