[ 
https://issues.apache.org/jira/browse/JENA-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17140796#comment-17140796
 ] 

Andy Seaborne commented on JENA-1919:
-------------------------------------

https://github.com/apache/jena/pull/762

> ArrayIndexOutOfBounds in BufferingWriter.java
> ---------------------------------------------
>
>                 Key: JENA-1919
>                 URL: https://issues.apache.org/jira/browse/JENA-1919
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Base
>    Affects Versions: Jena 3.15.0
>            Reporter: Matt Hoffman
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I observed that the blockSize does not control the actual size of the 
> underlying char array 'buffer' which will result in ArrayIndexOutOfBounds.
> Locally I added the test below to TestBufferingWriter.java to illustrate.
>   
> {code:java}
> public void write_07 () {
>    String alpha = 
> "0123456789abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWZYZ";
>     create(8194, 4098);
>     Random r = new Random();
>     for (int i = 0; i < 8194;i++) {
>         w.output(alpha.charAt(r.nextInt(alpha.length())));
>     }
>     w.close();
>     String x = string();
>     assertEquals(x.length(), 8194);
> }
> {code}
> Which produces.
> {noformat}
> [ERROR] write_07(org.apache.jena.atlas.io.TestBufferingWriter)  Time elapsed: 
> 0.007 s  <<< ERROR!
> java.lang.ArrayIndexOutOfBoundsException: 8192
>       at 
> org.apache.jena.atlas.io.TestBufferingWriter.write_07(TestBufferingWriter.java:112){noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to