db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Korneliussen <Andreas.Kornelius...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-796) jdbc 4.0 specific Blob and Clob method support
Date Wed, 15 Feb 2006 11:31:41 GMT
>       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

Mime
View raw message