Use Enum.toString() instead of Enum.name() in XmlStringBuilder.optElement()

This commit is contained in:
Florian Schmaus 2018-10-19 09:16:42 +02:00
parent 01f9b228f2
commit 00ce194109
1 changed files with 3 additions and 1 deletions

View File

@ -481,7 +481,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
}
public XmlStringBuilder emptyElement(Enum<?> element) {
return emptyElement(element.name());
// Use Enum.toString() instead Enum.name() here, since some enums override toString() in order to replace
// underscores ('_') with dash ('-') for example (name() is declared final in Enum).
return emptyElement(element.toString());
}
public XmlStringBuilder emptyElement(String element) {