Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351096 - [DB][Derby] Adding two blobs at the same time, derby throws exception
Summary: [DB][Derby] Adding two blobs at the same time, derby throws exception
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.db (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Egidijus Vaisnora CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-04 10:16 EDT by Egidijus Vaisnora CLA
Modified: 2012-09-21 07:16 EDT (History)
0 users

See Also:
stepper: review+


Attachments
test case (2.35 KB, patch)
2011-07-04 10:19 EDT, Egidijus Vaisnora CLA
no flags Details | Diff
fix (4.92 KB, patch)
2011-07-05 07:44 EDT, Egidijus Vaisnora CLA
no flags Details | Diff
Fix v2 (4.94 KB, patch)
2011-07-06 01:28 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.