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

Matt Hoffman edited comment on JENA-1920 at 6/19/20, 3:25 PM:
--------------------------------------------------------------

Sure, I'll record the issue there as well, but essentially I noticed that when  
a patch contained an object that had character sets larger than 4096 (default 
blobSize in BufferingWriter) but less than 8192 (default blockSize in 
BufferingWriter) would always result in an error on the RDF Delta side.


was (Author: hoffman):
Sure, I'll record the issue there as well,  but essentially I noticed that when 
 a path contained an object that had character sets larger than 4096 (default 
blobSize in BufferingWriter) but less than 8192 (default blockSize in 
BufferingWriter) would always result in an error on the RDF Delta side.

> BufferingWriter.java will flush the entirety of a char array despite provided 
> length.
> -------------------------------------------------------------------------------------
>
>                 Key: JENA-1920
>                 URL: https://issues.apache.org/jira/browse/JENA-1920
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Base
>    Affects Versions: Jena 3.15.0
>            Reporter: Matt Hoffman
>            Priority: Major
>
> I observed that when flushing a largeBlob the entirety of a char array will 
> be flushed out despite the length being provided indicating that only part of 
> the char array is populated.
> The below unit test illustrates.
>  
> {code:java}
> public void write_08 () {        
>     String alpha = 
> "0123456789abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWZYZ";
>     Random r = new Random();       
>     create(8192, 4096);
>     //initialized at the max        
>     char[] randomChars = new char[8192];                
>     //define just enough to make it a 'large blob'        
>     for(int i = 0; i < 5000; i++){
>         randomChars[i] = alpha.charAt(r.nextInt(alpha.length()));
>     }
>     w.output(randomChars,0, 5000);        
>     w.close();
>     String x = string();
>      assertEquals(5000, x.length());    
> }
> {code}
> Results in
> {noformat}
> [ERROR] write_08(org.apache.jena.atlas.io.TestBufferingWriter)  Time elapsed: 
> 0.001 s  <<< FAILURE!
> java.lang.AssertionError: expected:<5000> but was:<8192>
>       at 
> org.apache.jena.atlas.io.TestBufferingWriter.write_08(TestBufferingWriter.java:141){noformat}



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

Reply via email to