Skip to content

Commit 5b80441

Browse files
[highsource#619] values should be trim
1 parent fa5bdba commit 5b80441

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

jaxb-annox-parent/jaxb-annox/src/main/java/org/jvnet/jaxb/annox/util/AnnotationElementUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public static String getFieldValue(final Element annotationElement,
3232
}
3333
if ("value".equals(name) && value == null) {
3434
value = annotationElement.getTextContent();
35+
if (!StringUtils.isEmpty(value)) {
36+
value = value.trim();
37+
}
3538
}
3639
return value;
3740
}

jaxb-annox-parent/jaxb-annox/src/test/java/org/jvnet/jaxb/annox/parser/tests/XAnnotationParserTest.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,37 @@ public void testM() throws Exception {
268268
System.out.println(two.toString());
269269
Assert.assertEquals("Annotations should be identical.", one, two);
270270
}
271+
272+
public void testN() throws Exception {
273+
274+
final XAnnotationParser parser = XAnnotationParser.INSTANCE;
275+
276+
final XAnnotation<?> one = parser.parse(Ten.class
277+
.getAnnotation(M.class));
278+
279+
final Element element = getElement("n.xml");
280+
281+
final XAnnotation<?> two = parser.parse(element);
282+
283+
System.out.println(one.toString());
284+
System.out.println(two.toString());
285+
Assert.assertEquals("Annotations should be identical.", one, two);
286+
}
287+
288+
public void testO() throws Exception {
289+
290+
final XAnnotationParser parser = XAnnotationParser.INSTANCE;
291+
292+
final XAnnotation<?> one = parser.parse(Nine.class
293+
.getAnnotation(L.class));
294+
295+
final Element element = getElement("o.xml");
296+
297+
final XAnnotation<?> two = parser.parse(element);
298+
299+
System.out.println(one.toString());
300+
System.out.println(two.toString());
301+
Assert.assertEquals("Annotations should be identical.", one, two);
302+
303+
}
271304
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<annox:annotate xmlns:annox="http://annox.dev.java.net"
2+
annox:class="org.jvnet.jaxb.annox.parser.tests.M">
3+
<annox:annotate annox:class="org.jvnet.jaxb.annox.parser.tests.K">
4+
k kay</annox:annotate>
5+
<annox:annotate annox:class="org.jvnet.jaxb.annox.parser.tests.K">
6+
7+
K KAY
8+
</annox:annotate>
9+
</annox:annotate>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<annox:annotate xmlns:annox="http://annox.dev.java.net"
2+
annox:class="org.jvnet.jaxb.annox.parser.tests.L">
3+
<annox:annotate annox:class="org.jvnet.jaxb.annox.parser.tests.J">
4+
jay
5+
</annox:annotate>
6+
</annox:annotate>

0 commit comments

Comments
 (0)