db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-1599) Clob.getSubString() throws NullPointerException when created by updatable result set
Date Fri, 02 Nov 2007 14:55:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-1599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539605
] 

Daniel John Debrunner commented on DERBY-1599:
----------------------------------------------

Knut Anders> By the way, what's the correct return value from a getter right after a column
has been modified with one of the update methods? The old value or the updated value? Currently,
we return the new value, but perhaps we should return the old value until we have called updateRow()?

>From a literal reading of the javadoc I would say the new value, this is because the updateXXX
methods say update the current row of the ResultSet (not the database) and the getXXX methods
retrieve column values from the current row of the ResultSet (not the database).

I do think that updateCharacterStream() followed by getCharacterStream() (or any getXXX) should
work. The logical behaviour of this is:

  updateCharacterStream() - set column value in current row in ResultSet to SQL value represented
by the contents of the character stream.
  getCharacterStream() - convert SQL column value to Java character stream and return it to
the user.
  
  updateRow() - send updated SQL values to database and update row in the database

Now taking the character stream from the updateCharacterStream and sending in directly to
the database in updateRow is an optimization that Derby can & should take, but when there
is a  getCharacterStream() that optimization can no longer be taken (though in somes cases
it could be I think).




> Clob.getSubString() throws NullPointerException when created by updatable result set
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-1599
>                 URL: https://issues.apache.org/jira/browse/DERBY-1599
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client
>    Affects Versions: 10.1.3.1, 10.2.1.6
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: Repro.java
>
>
> If you create a clob value with one of the ResultSet.updateXXX methods that take a stream
or a reader, and retrieve that value with ResultSet.getClob(), a NullPointerException will
be thrown when getSubString() is called on the returned Clob object. This happens with the
network client driver, and it has been observed on Derby 10.1.3.1 and trunk.
> Exception in thread "main" java.lang.NullPointerException
>         at org.apache.derby.client.am.Clob.getSubStringX(Clob.java:229)
>         at org.apache.derby.client.am.Clob.getSubString(Clob.java:210)
>         at Repro.main(Repro.java:24)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message