commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terefang Verigorn (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DBUTILS-117) Error in control the use of ParameterMetaData
Date Thu, 11 Dec 2014 17:56:13 GMT

    [ https://issues.apache.org/jira/browse/DBUTILS-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14242849#comment-14242849
] 

Terefang Verigorn commented on DBUTILS-117:
-------------------------------------------

using the Crate.io jdbc driver i get:

Exception in thread "main" java.lang.NullPointerException
	at org.apache.commons.dbutils.AbstractQueryRunner.fillStatement(AbstractQueryRunner.java:226)

i would propose the followinf fix:

if (!pmdKnownBroken) {
            pmd = stmt.getParameterMetaData();
            if(pmd!=null) {
             int stmtCount = pmd.getParameterCount();
             int paramsCount = params == null ? 0 : params.length;
 
             if (stmtCount != paramsCount) {
                 throw new SQLException("Wrong number of parameters: expected "
                         + stmtCount + ", was given " + paramsCount);
             }
            }
            else {
                        pmdKnownBroken = true;
            }
        }

> Error in control the use of ParameterMetaData
> ---------------------------------------------
>
>                 Key: DBUTILS-117
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-117
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Vadim Smirnov
>            Priority: Minor
>              Labels: easyfix, newbie
>             Fix For: 1.7
>
>         Attachments: DBUTILS-117-tests.patch, DBUTILS-117.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Error in fillStatement method of AbstractQueryRunner class.
> There is no try...catch statement near pmd = stmt.getParameterMetaData();
> So method fails instead of automaticallye turning pmdKnownBroken to true.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message