Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97FB06B8D for ; Mon, 30 May 2011 07:41:33 +0000 (UTC) Received: (qmail 60697 invoked by uid 500); 30 May 2011 07:41:33 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 60635 invoked by uid 500); 30 May 2011 07:41:33 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 60370 invoked by uid 99); 30 May 2011 07:41:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 07:41:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 07:41:29 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id F0412E8D95 for ; Mon, 30 May 2011 07:40:47 +0000 (UTC) Date: Mon, 30 May 2011 07:40:47 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: <532804343.52907.1306741247974.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1182081745.51337.1306625447367.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Closed] (DERBY-5250) Blob is truncating data to 32k~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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