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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2011/01/12 16:50:52 UTC

[jira] Created: (DERBY-4970) ClassCastException from getBlob() on string parameter

ClassCastException from getBlob() on string parameter
-----------------------------------------------------

                 Key: DERBY-4970
                 URL: https://issues.apache.org/jira/browse/DERBY-4970
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.7.1.1
            Reporter: Knut Anders Hatlen


If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.

Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
        at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
        at Test.main(Test.java:13)

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


[jira] Updated: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4970:
--------------------------------------

    Attachment: Test.java

Attaching a repro.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>         Attachments: Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Assigned: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-4970:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Updated: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4970:
--------------------------------------

    Attachment: d4970.diff

The attached patch makes getBlob() and getClob() in EmbedCallableStatement throw a proper error when there's a type mismatch. The exception in the repro is changed from

    java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob

to

    java.sql.SQLDataException: An attempt was made to get a data value of type 'java.sql.Blob' from a data value of type 'VARCHAR'.

I haven't run any tests or added a regression test case yet.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>         Attachments: d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Updated: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4970:
--------------------------------------

    Issue & fix info: [Repro attached]

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>         Attachments: Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Commented: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981318#action_12981318 ] 

Dag H. Wanvik commented on DERBY-4970:
--------------------------------------

Looks good to me. Verified that test fails without the fix. +1


> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.8.0.0
>
>         Attachments: d4970-withTests.diff, d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Closed: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4970.
-------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.8.0.0
    Issue & fix info: [Repro attached]  (was: [Repro attached, Patch Available])

Committed revision 1058478.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.8.0.0
>
>         Attachments: d4970-withTests.diff, d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Updated: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4970:
--------------------------------------

    Attachment: d4970-withTests.diff

Attaching an updated patch which contains a regression test case in jdbcapi.ProcedureTest.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4970-withTests.diff, d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Commented: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980957#action_12980957 ] 

Knut Anders Hatlen commented on DERBY-4970:
-------------------------------------------

All tests ran cleanly on the second try.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4970-withTests.diff, d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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


[jira] Updated: (DERBY-4970) ClassCastException from getBlob() on string parameter

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4970:
--------------------------------------

    Issue & fix info: [Patch Available, Repro attached]  (was: [Repro attached])

I got one failure in suites.All when I ran the tests, a network server failed to start. It's probably not related to the patch, but I'll rerun the tests just in case. Setting the patch available flag.

> ClassCastException from getBlob() on string parameter
> -----------------------------------------------------
>
>                 Key: DERBY-4970
>                 URL: https://issues.apache.org/jira/browse/DERBY-4970
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d4970-withTests.diff, d4970.diff, Test.java
>
>
> If you call getBlob() on a string parameter in a CallableStatement, you'll get a ClassCastException. We should get a proper SQLException.
> Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Blob
>         at org.apache.derby.impl.jdbc.EmbedCallableStatement.getBlob(EmbedCallableStatement.java:580)
>         at Test.main(Test.java:13)

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