[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-407) Archive.toString might throw java.lang.IndexOutOfBoundsException

Andrew Rubinger (JIRA) jira-events at lists.jboss.org
Fri May 18 20:44:17 EDT 2012


     [ https://issues.jboss.org/browse/SHRINKWRAP-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Rubinger updated SHRINKWRAP-407:
---------------------------------------

           Status: Resolved  (was: Pull Request Sent)
    Fix Version/s: 1.1.0-alpha-3
       Resolution: Done


Upstream: https://github.com/shrinkwrap/shrinkwrap/commit/4b77293637a6cfafce81ecada48cba92b8605870
                
> Archive.toString might throw java.lang.IndexOutOfBoundsException
> ----------------------------------------------------------------
>
>                 Key: SHRINKWRAP-407
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-407
>             Project: ShrinkWrap
>          Issue Type: Bug
>          Components: impl-base
>    Affects Versions: 1.1.0-alpha-2
>            Reporter: Tommy Tynjä
>            Assignee: Tommy Tynjä
>             Fix For: 1.1.0-alpha-3
>
>
> In some cases when outputting archive contents via the Archive.toString(Formatter) method, I get a java.lang.IndexOutOfBoundsException when writing to the output stream. After some investigation I found the cause being an erroneous calculation in the buffered write.
> The error can be reproduced with the following test case added to ArchiveWriteToTestCase in impl-base:
> {code:java} 
> @Test
> public void shouldBufferWritesCorrectly() throws IOException {
>     MockOutputStream outputStream = new MockOutputStream();
>     byte[] content = new byte[9202];
>     for (int i = 0; i < content.length; i++) {
>         content[i] = (i + "").getBytes()[0];
>     }
>     IOUtil.bufferedWriteWithFlush(outputStream, content);
>     Assert.assertArrayEquals("Inconsistent writes?", content, outputStream.getContents());
> }
> {code} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the shrinkwrap-issues mailing list