Allow nulls for write elements in MXSerializer#29
Allow nulls for write elements in MXSerializer#29slawekjaranowski merged 1 commit intocodehaus-plexus:masterfrom
Conversation
|
@garydgregory thanks ... I afraid thet we will have a conflict with my PR #28 If you let me I first merge my PR and that you can rebase your |
8a472f5 to
e03c11f
Compare
|
@slawekjaranowski |
|
@michael-o @elharo can you also look at it 😄 |
|
I'd like to see this rebased first... |
|
After the rebase is done let's try MJAVADOC again with a snapshot of Plexus XML and see what happens. |
e03c11f to
5a5581a
Compare
|
I rebased on master again. |
| new MXSerializer().writeElementContent(null, stringWriter); | ||
| new MXSerializer().writeAttributeValue(null, stringWriter); |
There was a problem hiding this comment.
should support ?
new MXSerializer().writeElementContent("value", null);
new MXSerializer().writeAttributeValue("value", null);There was a problem hiding this comment.
Also add some of assertions for what content of stringWriter should be.
src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java
Outdated
Show resolved
Hide resolved
|
Please also change of PR / commit message to show what really is changed, what is root cause eg
|
|
Test: output: |
|
What about the pretty printer? |
elharo
left a comment
There was a problem hiding this comment.
some suggestion. I don't see anything actually incorrect here.
| } else { | ||
| if (value != null) { | ||
| // .[apostrophe and <, & escaped], | ||
| final char quot = attributeUseApostrophe ? '\'' : '"'; |
There was a problem hiding this comment.
Not sure why we even make a choice here. Would be simpler to pick one and stick with it.
| out.write(quotEntity); | ||
| pos = i + 1; | ||
| } else if (ch < 32) { | ||
| // in XML 1.0 only legal character are #x9 | #xA | #xD |
| // pass through | ||
|
|
||
| // } else if(ch == 13) { //escape | ||
| // and they must be escaped otherwise in attribute value they are normalized to spaces |
| pos = i + 1; | ||
| } else { | ||
| throw new IllegalStateException( | ||
| "character " + Integer.toString(ch) + " is not allowed in output" + getLocation()); |
| } else { | ||
| throw new IllegalStateException( | ||
| "character " + Integer.toString(ch) + " is not allowed in output" + getLocation()); | ||
| // in XML 1.1 legal are [#x1-#xD7FF] |
| if (ch == 9 || ch == 10 || ch == 13) { | ||
| // pass through | ||
|
|
||
| // } else if(ch == 13) { //escape |
5a5581a to
b2263d5
Compare
|
@elharo Thank you for your comments. I'll let the Maven team address those since I feel they are out of scope for this PR. |
| * Tests MJAVADOC-793. | ||
| */ | ||
| @Test | ||
| public void testMJAVADOC793() throws IOException { |
There was a problem hiding this comment.
This should be renamed. This is not related to the Javadoc plugin. IT simply does not allow null values. testNullValues()?
There was a problem hiding this comment.
Done: testWriteNullValues().
you right if needed should be fixed in separate PR |
slawekjaranowski
left a comment
There was a problem hiding this comment.
looks OK please chenge test name and commit PR title
b2263d5 to
5a58475
Compare
|
@michael-o I hope your doubts was resolved, so I will merge and process forward |
| } | ||
|
|
||
| /** | ||
| * Tests MJAVADOC-793. |
There was a problem hiding this comment.
Well, that comment is wrong here as well.
Yes, but my question about the |
https://issues.apache.org/jira/browse/MJAVADOC-793
Allow nulls for write elements in
MXSerializer.