cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agssa.net>
Subject Re: svn commit: r124610 - in cocoon/branches/BRANCH_2_1_X/src/blocks: databases/java/org/apache/cocoon/acting databases/java/org/apache/cocoon/components/source/impl databases/java/org/apache/cocoon/reading hsqldb/java/org/apache/cocoon/components/hsqldb petstore/java/org/apache/cocoon/components/flow/javascript
Date Sat, 08 Jan 2005 17:42:16 GMT
On Sab, 8 de Enero de 2005, 7:41, Ugo Cei dijo:
>> +                    ResultSet set = null;
>> +                    try {
>> +                        set =
>> conn.createStatement().executeQuery(selectQuery);
>
> Assuming the preceding statement throws an exception ...
>
>> +                        set.next();
>> +                        int value = set.getInt("maxid") + 1;
>> +
>> +                        statement.setInt(currentIndex, value);
>> +
>> +
>> request.setAttribute(keys[i].getAttribute("param"),
>> String.valueOf(value));
>> +                    } catch (SQLException sqle){
>> +                        getLogger().warn("There was an error closing
>> the ResultSet", sqle);
>> +                        throw sqle;
>> +                    } finally {
>> +                        set.close();
>> +                        set.getStatement().close();
>
> ... one of these last two statements will thrown a NPE, if I'm not
> mistaken. We should check that set and set.getStatement() are not null,
> right?
>
> Moreover:
>
>> +                        getLogger().warn("There was an error closing
>> the ResultSet", sqle);
>
> The exception is not caught while closing the ResultSet, so the message
> is misleading.

Thanks Ugo. You are right, I tried to fix it in a second commit:

http://marc.theaimsgroup.com/?l=xml-cocoon-cvs&m=110515609528180&w=2

But still need refactoring. I will review it now.

Best Regards,

Antonio Gallardo.


Mime
View raw message