[
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)