[JIRA] Commented: (JAXB-970) JAXB marshal if identation exceeds nested level 8

  • From: "matejsp (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Commented: (JAXB-970) JAXB marshal if identation exceeds nested level 8
  • Date: Tue, 24 Dec 2013 09:51:49 +0000 (UTC)
  • Auto-submitted: auto-generated


    [ 
https://java.net/jira/browse/JAXB-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=371853#action_371853
 ] 

matejsp commented on JAXB-970:
------------------------------

There is another issue in Encoding class.
indent8.write(this); does not work as it should.

*code*
            Encoded e = new Encoded(indentStr);
            indent8 = new Encoded();
            indent8.ensureSize(e.len*8);
            unitLen = e.len;
            for( int i=0; i<8; i++ )
                System.arraycopy(e.buf, 0, indent8.buf, unitLen*i, unitLen);
*code*

The problem is that Encoded.ensureSize does not change the field of encoded 
length.



> JAXB marshal if identation exceeds nested level 8
> -------------------------------------------------
>
>                 Key: JAXB-970
>                 URL: https://java.net/jira/browse/JAXB-970
>             Project: jaxb
>          Issue Type: Bug
>          Components: runtime
>    Affects Versions: 2.1.10, 2.2.4u2
>         Environment: JDK 1.6 and JDK 1.7
>            Reporter: matejsp
>            Assignee: Iaroslav Savytskyi
>            Priority: Minor
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> When calling JAXB marshal with pretty print it outputs:
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <a>
>     <b>
>         <c>
>             <d>
>                 <e>
>                     <f>
>                         <g>
>                             <h>
> <i>
>     <j/>
> </i>
>                             </h>
>                         </g>
>                     </f>
>                 </e>
>             </d>
>         </c>
>     </b>
> </a>
> 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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Commented: (JAXB-970) JAXB marshal if identation exceeds nested level 8

matejsp (JIRA) 12/24/2013
Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
 
 
Close
loading
Please Confirm
Close