Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 51535 invoked from network); 15 Feb 2006 11:32:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Feb 2006 11:32:06 -0000 Received: (qmail 80039 invoked by uid 500); 15 Feb 2006 11:32:05 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 79803 invoked by uid 500); 15 Feb 2006 11:32:04 -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 79794 invoked by uid 99); 15 Feb 2006 11:32:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 03:32:04 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.43] (HELO brmea-mail-2.sun.com) (192.18.98.43) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 03:32:04 -0800 Received: from phys-epost-1 ([129.159.136.14]) by brmea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id k1FBVg8u006346 for ; Wed, 15 Feb 2006 04:31:43 -0700 (MST) Received: from conversion-daemon.epost-mail1.sweden.sun.com by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IUQ00G017BPUR@epost-mail1.sweden.sun.com> (original mail from Andreas.Korneliussen@Sun.COM) for derby-dev@db.apache.org; Wed, 15 Feb 2006 12:31:42 +0100 (MET) Received: from [129.159.112.247] (khepri35.Norway.Sun.COM [129.159.112.247]) by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IUQ00GMZ80T1C@epost-mail1.sweden.sun.com> for derby-dev@db.apache.org; Wed, 15 Feb 2006 12:31:42 +0100 (MET) Date: Wed, 15 Feb 2006 12:31:41 +0100 From: Andreas Korneliussen Subject: Re: [jira] Commented: (DERBY-796) jdbc 4.0 specific Blob and Clob method support In-reply-to: To: derby-dev@db.apache.org Reply-to: Andreas.Korneliussen@Sun.COM Message-id: <43F3111D.4080808@sun.com> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050930) References: <1226307877.1139997133855.JavaMail.jira@ajax.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > if ((int) pos <= 0) { > throw new SqlException(agent_.logWriter_, > new MessageId(SQLState.BLOB_BAD_POSITION), new Long(pos)); > } Is the casting of pos from long to int safe ? Consider the case if pos is > Integer.MAXINT. Is it intentional that pos > Integer.MAXINT gives this exception ? How about: > if (pos <= 0L) { > throw new SqlException(agent_.logWriter_, > new MessageId(SQLState.BLOB_BAD_POSITION), new Long(pos)); > } or if it is intentional to give an exception if pos is bigger than Integer.MAXINT, one could write it more explicitly: > if (pos <= 0L || pos >= MAXPOS) { > throw new SqlException(agent_.logWriter_, > new MessageId(SQLState.BLOB_BAD_POSITION), new Long(pos)); > } Andreas