You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2020/01/16 04:13:35 UTC
[ant] branch master updated: Fix space issue in
AntStructure.DTDPrinter
This is an automated email from the ASF dual-hosted git repository.
jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 9b0842f Fix space issue in AntStructure.DTDPrinter
9b0842f is described below
commit 9b0842fafa3bf3afe11438b6349ed55173cf4327
Author: Tony Gravagno <xh...@snkmail.com>
AuthorDate: Sun Jan 12 19:16:19 2020 -0800
Fix space issue in AntStructure.DTDPrinter
Task AntStructure renders a project DTD. In AntStructure class DTDPrinter, line 327, a single statement is used to concatenate a list of enumerated values which are valid for an attribute. The list is enclosed in parentheses. At line 348 the string "#IMPLIED" is appended to all attribute definitions regardless of type. For other types like Boolean and CDATA, a space is appended. Not for these enumerations. This results in a DTD validation error. Ref [XERCES definition](https://xerces. [...]
The full message displayed in VSCode may be different from elsewhere:
White space is required before the attribute default in the declaration
of attribute "x" for element "y".
xml(MSG_SPACE_REQUIRED_BEFORE_DEFAULTDECL_IN_ATTDEF)
This simple one-line change appends the space character required to avoid that error.
**Note:** This should not be modified into a change on the `joinAlts` Collector which surrounds values in parentheses. That Collector is used elsewhere where regex syntax is applied immediately after. See line 298. That asterisk cannot be separated from the values with a space. The space must only be applied to line 327.
---
CONTRIBUTORS | 1 +
WHATSNEW | 3 +++
contributors.xml | 4 ++++
src/main/org/apache/tools/ant/taskdefs/AntStructure.java | 4 ++--
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a831e8f..4b21cf7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -433,6 +433,7 @@ Tom Eugelink
Tom May
Tomasz Bech
Tomáš Zezula
+Tony Gravagno
Trejkaz Xaoza
Ulrich Schmidt
Uwe Schindler
diff --git a/WHATSNEW b/WHATSNEW
index 23b8e49..2cb3c21 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -34,6 +34,9 @@ Fixed bugs:
then the forked mode launch would fail.
Bugzilla Report 63958
+ * Fixes an issue in AntStructure where an incorrect DTD was being generated.
+ Github Pull Request #116
+
Other changes:
--------------
diff --git a/contributors.xml b/contributors.xml
index 4e88f27..8de1b86 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -1784,6 +1784,10 @@
<last>Zezula</last>
</name>
<name>
+ <first>Tony</first>
+ <last>Gravagno</last>
+ </name>
+ <name>
<first>Trejkaz</first>
<last>Xaoza</last>
</name>
diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
index 9a72679..4d8909b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -324,7 +324,7 @@ public class AntStructure extends Task {
|| !areNmtokens(values)) {
sb.append("CDATA ");
} else {
- sb.append(Stream.of(values).collect(joinAlts));
+ sb.append(Stream.of(values).collect(joinAlts)).append(" ");
}
} catch (final InstantiationException | IllegalAccessException ie) {
sb.append("CDATA ");
@@ -337,7 +337,7 @@ public class AntStructure extends Task {
sb.append("CDATA ");
} else {
sb.append(Stream.of(values).map(Enum::name)
- .collect(joinAlts));
+ .collect(joinAlts)).append(" ");
}
} catch (final Exception x) {
sb.append("CDATA ");