Interesting ... yeah the code in Cayenne seems to contradict the 
"setBinaryStream" contract. The javadoc states "pos - the position in the BLOB 
value at which to start writing; the first position is 1"... So yeah, looks 
like a bug. Somehow that worked with "0" before in our unit tests, but will try 
"1" as well :)

Should be able to verify tomorrow. 

Andrus


On Jul 3, 2012, at 12:54 PM, Durchholz, Joachim wrote:
>> Has this problem been fixed in 3.1B1?
> 
> I don't think so. The relevant line from the stack trace is line 255 in 
> java/org/apache/cayenne/dba/oracle/OracleLOBBatchAction.java.
> On trunk in /trunk/framework/cayenne-jdk1.5-unpublished/src/main/ , this line 
> reads:
> 
>  OutputStream out = blob.setBinaryStream(0);
> 
> Offsets in JDBC generally start at 1, not zero, and the JDBC specs on 
> Blob#setBinaryStream are no exception, so this should be
> 
>  OutputStream out = blob.setBinaryStream(1);
> 
>> And one that describes what's happening (not Cayenne specific):
>> http://java.ittoolbox.com/groups/technical-functional/java-l/invalid-arguments-in-call-in-line-oraclesqlblobcreatetemporary-oracle-10g-1468092JDBC
> 
> The salient point is in the last answer, by Ale Gonzalez: Don't use 0 on 
> setBinaryStream.
> Actually, it's even documented in the Javadoc for #setBinaryStream.
> (Somebody deserves to roast somewhere unpleasant for having JDBC use 1 and 
> the rest of the JDK use 0. It's a first-rate source of bugs.)
> 
>> Or is our only option to find and use an older Oracle JDBC adapter.
> 
> If you can work from the Cayenne sources, you might want to consider applying 
> that one-line fix to the sources until upstream gets around to fixing this.
> 

Reply via email to