Skip to content

Commit f5df6d1

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

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,39 @@ public void testM() throws Exception {
268268
System.out.println(two.toString());
269269
Assert.assertEquals("Annotations should be identical.", one, two);
270270
}
271+
272+
@Test
273+
public void testN() throws Exception {
274+
275+
final XAnnotationParser parser = XAnnotationParser.INSTANCE;
276+
277+
final XAnnotation<?> one = parser.parse(Ten.class
278+
.getAnnotation(M.class));
279+
280+
final Element element = getElement("n.xml");
281+
282+
final XAnnotation<?> two = parser.parse(element);
283+
284+
System.out.println(one.toString());
285+
System.out.println(two.toString());
286+
Assertions.assertEquals(one, two, "Annotations should be identical.");
287+
}
288+
289+
@Test
290+
public void testO() throws Exception {
291+
292+
final XAnnotationParser parser = XAnnotationParser.INSTANCE;
293+
294+
final XAnnotation<?> one = parser.parse(Nine.class
295+
.getAnnotation(L.class));
296+
297+
final Element element = getElement("o.xml");
298+
299+
final XAnnotation<?> two = parser.parse(element);
300+
301+
System.out.println(one.toString());
302+
System.out.println(two.toString());
303+
Assertions.assertEquals(one, two, "Annotations should be identical.");
304+
305+
}
271306
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<annox:annotate xmlns:annox="urn:jaxb.jvnet.org:annox"
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="urn:jaxb.jvnet.org:annox"
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)