You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Peter Davis (JIRA)" <ji...@apache.org> on 2011/05/29 01:30:47 UTC
[jira] [Created] (DERBY-5250) Blob is truncating data to 32k~
Blob is truncating data to 32k~
-------------------------------
Key: DERBY-5250
URL: https://issues.apache.org/jira/browse/DERBY-5250
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.8.1.2, 10.7.1.1
Environment: Windows 7 amd64 running in eclipse using JDBC
Reporter: Peter Davis
Please be gentle with me, its my first bug post
I have a curious problem that occurs in the following scenario.
Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
private int[] data = new int[1000000];
public void saveByteStream(OutputStream os) throws IOException {
for (int i = 0; i < data.length; i++)
data[i] = i;
byte[] byte4 = new byte[4];
ByteBuffer buf = ByteBuffer.wrap(byte4);
for (int i = 0; i < data.length; i++) {
buf.rewind();
buf.putInt(data[i]);
os.write(byte4);
}
}
The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
public void loadByteStream(InputStream is) throws IOException {
byte[] byte4 = new byte[4];
ByteBuffer buf = ByteBuffer.wrap(byte4);
for (int i = 0; i < data.length; i++) {
buf.rewind();
is.read(byte4);
data[i] = buf.getInt();
}
}
The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
public void saveObjectStream(OutputStream os) throws IOException {
for (int i = 0; i < data.length; i++)
data[i] = i;
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(data);
}
private void loadObjectStream(InputStream is) throws IOException {
ObjectInputStream ois = new ObjectInputStream(is);
try {
data = (int[]) ois.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
If I direct these routines to a file they both work.
I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
Sysinfo gives the following slightly sanitised output
------------------ Java Information ------------------
Java Version: 1.6.0_22
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jre6
OS name: Windows 7
OS architecture: amd64
OS version: 6.1
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_22-b04
--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[derby.jar] 10.8.1.2 - (1095077)
[derbytools.jar] 10.8.1.2 - (1095077)
[derbynet.jar] 10.8.1.2 - (1095077)
[derbyclient.jar] 10.8.1.2 - (1095077)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United Kingdom [en_GB]]
Found support for locale: [cs]
version: 10.8.1.2 - (1095077)
Found support for locale: [de_DE]
version: 10.8.1.2 - (1095077)
Found support for locale: [es]
version: 10.8.1.2 - (1095077)
Found support for locale: [fr]
version: 10.8.1.2 - (1095077)
Found support for locale: [hu]
version: 10.8.1.2 - (1095077)
Found support for locale: [it]
version: 10.8.1.2 - (1095077)
Found support for locale: [ja_JP]
version: 10.8.1.2 - (1095077)
Found support for locale: [ko_KR]
version: 10.8.1.2 - (1095077)
Found support for locale: [pl]
version: 10.8.1.2 - (1095077)
Found support for locale: [pt_BR]
version: 10.8.1.2 - (1095077)
Found support for locale: [ru]
version: 10.8.1.2 - (1095077)
Found support for locale: [zh_CN]
version: 10.8.1.2 - (1095077)
Found support for locale: [zh_TW]
version: 10.8.1.2 - (1095077)
------------------------------------------------------
I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Knut Anders Hatlen closed DERBY-5250.
-------------------------------------
Resolution: Invalid
Issue & fix info: (was: [Newcomer])
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040785#comment-13040785 ]
Knut Anders Hatlen commented on DERBY-5250:
-------------------------------------------
Hi Peter,
Your loadByteStream() method doesn't check the return value from InputStream.read(byte[]), so it may run into problems if the read() call doesn't read all four bytes in one go (if it hits an internal buffer boundary, for example). Does it still fail if you replace it with the following (untested) code?
public void loadByteStream(InputStream is) throws IOException {
byte[] byte4 = new byte[4];
ByteBuffer buf = ByteBuffer.wrap(byte4);
for (int i = 0; i < data.length; i++) {
buf.rewind();
int bytesRead = 0;
while (bytesRead < byte4.length) {
int x = is.read(byte4, bytesRead, byte4.length - bytesRead);
if (x == -1) throw new EOFException();
bytesRead += x;
}
data[i] = buf.getInt();
}
}
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Peter Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040699#comment-13040699 ]
Peter Davis commented on DERBY-5250:
------------------------------------
I forgot to mention the table is defined as follows
create table entity (id int not null primary key generated by default as identity, type varchar(60), deleted boolean, feature int, geometry_class varchar(255), geometry blob)
The DB is running with autocommit at present
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Peter Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter Davis resolved DERBY-5250.
--------------------------------
Resolution: Fixed
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Peter Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040812#comment-13040812 ]
Peter Davis commented on DERBY-5250:
------------------------------------
That was spot on, sorry for wasting your time :/
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Reopened] (DERBY-5250) Blob is truncating data to 32k~
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Knut Anders Hatlen reopened DERBY-5250:
---------------------------------------
Bug behavior facts: (was: [Data corruption])
> Blob is truncating data to 32k~
> -------------------------------
>
> Key: DERBY-5250
> URL: https://issues.apache.org/jira/browse/DERBY-5250
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.7.1.1, 10.8.1.2
> Environment: Windows 7 amd64 running in eclipse using JDBC
> Reporter: Peter Davis
>
> Please be gentle with me, its my first bug post
> I have a curious problem that occurs in the following scenario.
> Having obtained an OutputStream via connection.getBlob() and blob.setBinaryStream(1) the following code is run before the transaction is commited
> private int[] data = new int[1000000];
> public void saveByteStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> buf.putInt(data[i]);
> os.write(byte4);
> }
> }
> The following is run after obtaining an InputStream from the a ResultSet "blob.getBinaryStream()"
> public void loadByteStream(InputStream is) throws IOException {
> byte[] byte4 = new byte[4];
> ByteBuffer buf = ByteBuffer.wrap(byte4);
> for (int i = 0; i < data.length; i++) {
> buf.rewind();
> is.read(byte4);
> data[i] = buf.getInt();
> }
> }
> The array should contain 1000,000 integers each integer having the value of the index, unfortunately after index 8166 the data is corrupted
> When these routines are replaced by the following, the problem doesn't occur. All other code remaining identical
> public void saveObjectStream(OutputStream os) throws IOException {
> for (int i = 0; i < data.length; i++)
> data[i] = i;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> oos.writeObject(data);
> }
> private void loadObjectStream(InputStream is) throws IOException {
> ObjectInputStream ois = new ObjectInputStream(is);
> try {
> data = (int[]) ois.readObject();
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
> If I direct these routines to a file they both work.
> I'm currently using 10.8.1.2 but have tried 10.7.1.1 with the same result
> Sysinfo gives the following slightly sanitised output
> ------------------ Java Information ------------------
> Java Version: 1.6.0_22
> Java Vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jre6
> OS name: Windows 7
> OS architecture: amd64
> OS version: 6.1
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_22-b04
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [derby.jar] 10.8.1.2 - (1095077)
> [derbytools.jar] 10.8.1.2 - (1095077)
> [derbynet.jar] 10.8.1.2 - (1095077)
> [derbyclient.jar] 10.8.1.2 - (1095077)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale : [English/United Kingdom [en_GB]]
> Found support for locale: [cs]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [de_DE]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [es]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [fr]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [hu]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [it]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ja_JP]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ko_KR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pl]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [pt_BR]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [ru]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_CN]
> version: 10.8.1.2 - (1095077)
> Found support for locale: [zh_TW]
> version: 10.8.1.2 - (1095077)
> ------------------------------------------------------
> I presume I'm doing something stupid, but for love nor life can I find it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira