db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3911) BTreeController.reclaim_deleted_rows() may hide exceptions
Date Tue, 24 Mar 2009 00:43:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12688514#action_12688514

Kathey Marsden commented on DERBY-3911:

Thanks Tiago for looking at in Ganymede. I will assume then that it is just an Eclipse bug.
 Someday I will be brave and upgrade my Eclipse.

 It is interesting though, in playing with this I was able to make a program that hides a
ClassCastException  with  an NPE  in the finally clause.  This one actually didn't give me
a warning in Eclipse.  It is an interesting case to think about when doing complex operations
in finally blocks.

public class FinallyTest {

    public static void main(String[] args) throws Exception {


    private static String makeMyString() throws Exception {
        String myString = null;

        try {
            myString = (String) new Object();
        } finally {
           // we lose our ClassCastException
            System.out.println("Finished finally");

        return myString;

    private static void release() throws Exception {
        Object aNullObject = null;


> java FinallyTest
Exception in thread "main" java.lang.NullPointerException
        at FinallyTest.release(FinallyTest.java:25)
        at FinallyTest.makeMyString(FinallyTest.java:16)
        at FinallyTest.main(FinallyTest.java:6)

> BTreeController.reclaim_deleted_rows() may hide exceptions
> ----------------------------------------------------------
>                 Key: DERBY-3911
>                 URL: https://issues.apache.org/jira/browse/DERBY-3911
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For:
>         Attachments: derby-3911.diff
> BTreeController.reclaim_deleted_rows() contains this piece of code:
>         catch (java.lang.ClassCastException cce)
>         {
>             // because we give up the latch on the leaf before entering this
>             // routine, the page might change from a leaf to branch.  If that
>             // happens this routine will get a ClassCastException, and we
>             // just give up trying to reclaim space.
>         }
>         finally
>         {
>             if (controlRow != null)
>                 controlRow.release();
>             return(purged_at_least_one_row);
>         }
> It intentionally hides ClassCastExceptions, but it also unintentionally hides all other
exceptions because of the return statement in the finally clause.
> Some related discussions can be found in DERBY-3216 and DERBY-3905.

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

View raw message