From 5ef86aed605c8d3ca4b376eab74e255166f7bf4d Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 15 Mar 2017 17:49:31 +0100 Subject: [PATCH] Make GenerateKey.DistinguishedName.toString more robust https://bz.apache.org/bugzilla/show_bug.cgi?id=60767 --- WHATSNEW | 7 +++++++ .../org/apache/tools/ant/taskdefs/GenerateKey.java | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 2c10b1efe..ae2cb15a8 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -8,6 +8,13 @@ Other changes: values always get quoted. Github Pull Request #32 +Fixed bugs: +----------- + + * 's child now skips s that lack a key or + value. + Bugzilla Report 60767 + Changes from Ant 1.9.8 TO Ant 1.9.9 =================================== diff --git a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java index 69e719ce7..c26ac3621 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java +++ b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java @@ -73,6 +73,10 @@ public class GenerateKey extends Task { public String getValue() { return value; } + + public boolean isComplete() { + return name != null && value != null; + } } /** @@ -119,9 +123,11 @@ public class GenerateKey extends Task { firstPass = false; final DnameParam param = (DnameParam) params.elementAt(i); - sb.append(encode(param.getName())); - sb.append('='); - sb.append(encode(param.getValue())); + if (param.isComplete()) { + sb.append(encode(param.getName())); + sb.append('='); + sb.append(encode(param.getValue())); + } } return sb.toString();