eclipse-ee4j / eclipse-ee4j/jaxb-ri
JAXB marshal if identation exceeds nested level 8
@glassfishrobot is already working on this.
Since Sep 21, 2018.
- Dominant language
- Java
- Stars
- 222
- Forks
- 131
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
When calling JAXB marshal with pretty print it outputs:
The problem is when reaching indentation level 8 it restarts indentation.
The problem is in the:
IndentingUTF8XmlOutput.java
buggy function:
private void printIndent() throws IOException
{ write('\n'); int i = depth%8; write( indent8.buf, 0, i*unitLen ); i>>=3; // really i /= 8; for( ; i>0; i-- ) indent8.write(this); }
You can see that variable i is using remainder of division with 8.
After that i>>3 is already the remainder.
i >>= 3 (i = i >> 3) should be instead ... i = depth >> 3;
Other implementations does not exhibit such behavior.
Environment
JDK 1.6 and JDK 1.7
Affected Versions
[2.1.10, 2.2.4u2]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.