Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351096

Summary: [DB][Derby] Adding two blobs at the same time, derby throws exception
Product: [Modeling] EMF Reporter: Egidijus Vaisnora <vaisegid>
Component: cdo.dbAssignee: Egidijus Vaisnora <vaisegid>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 Flags: stepper: review+
Version: 4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
test case
none
fix
none
Fix v2 none

Description Egidijus Vaisnora CLA 2011-07-04 10:16:16 EDT
Exception message:
Caused by: org.apache.derby.iapi.services.io.DerbyIOException: Input stream did not have exact amount of data as the requested length.
Comment 1 Egidijus Vaisnora CLA 2011-07-04 10:19:10 EDT
Created attachment 199051 [details]
test case
Comment 2 Egidijus Vaisnora CLA 2011-07-04 10:21:27 EDT
Issue is related that Derby read from the stream, when given read size matches actual stream size. 
See: http://db.apache.org/derby/papers/JDBCImplementation.html#setAsciiStream%2CsetBinaryStream%2CsetCharacterStream
Comment 3 Egidijus Vaisnora CLA 2011-07-04 10:45:00 EDT
Could we use apache IO library? Fix could be easily achieved with http://javasourcecode.org/html/open-source/commons-io/commons-io-2.0/org/apache/commons/io/input/BoundedInputStream.java.html
Comment 4 Eike Stepper CLA 2011-07-04 13:18:46 EDT
(In reply to comment #0)
> Exception message:
> Caused by: org.apache.derby.iapi.services.io.DerbyIOException: Input stream did
> not have exact amount of data as the requested length.

Is there no stack trace available or is it a secret? Even talking about an exception is not okay unless it's accompanied with a stack trace ;-(
Comment 5 Eike Stepper CLA 2011-07-04 13:27:44 EDT
(In reply to comment #3)
> Could we use apache IO library? Fix could be easily achieved with
> http://javasourcecode.org/html/open-source/commons-io/commons-io-2.0/org/apache/commons/io/input/BoundedInputStream.java.html

Adding new dependencies requires nasty legal process work. Since we do already have a LimitedReader class, I've copied/refactored it for you into a LimitedInputStream class.
Comment 6 Eike Stepper CLA 2011-07-04 13:28:02 EDT
Committed revision 8589:
- trunk/plugins/org.eclipse.net4j.util
Comment 7 Eike Stepper CLA 2011-07-04 13:28:11 EDT
Committed revision 8589
Comment 8 Egidijus Vaisnora CLA 2011-07-05 07:44:17 EDT
Created attachment 199109 [details]
fix
Comment 9 Eike Stepper CLA 2011-07-06 01:28:01 EDT
Created attachment 199159 [details]
Fix v2

Slightly reformatted
Comment 10 Egidijus Vaisnora CLA 2011-07-07 03:28:14 EDT
Committed in trunk revision 8619
Comment 11 Eike Stepper CLA 2012-09-21 07:16:17 EDT
Closing.