Re: svn commit: r584611 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/ apache/cayenne: ObjectId.java access/jdbc/SQLTemplateAction.java util/IndexPropertyList.java

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Oct 15 2007 - 03:23:27 EDT

  • Next message: Kevin Menard: "Re: svn commit: r584611 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/ apache/cayenne: ObjectId.java access/jdbc/SQLTemplateAction.java util/IndexPropertyList.java"

    "break" is not really a noop, as we are dealing with "while(true)"
    loop. This may not be coded well, but if I remember correctly the
    intent was to get out of the loop for iterated results, without
    checking for possible update counts. Sure we should not probably put
    it in "finally".

    Andrus

    On Oct 15, 2007, at 1:27 AM, Kevin Menard wrote:

    > Because it was in a finally block. It appeared as though the break
    > was
    > added because returning from a finally is a big no-no. But, the
    > break was
    > essentially a noop for that one case. By inverting the logic and
    > dealing
    > with only the condition you care about, the other is a de facto noop.
    >
    > Hopefully I explained that well enough. It's late for me, too.
    > I'm in my
    > German hotel room whittling away time.
    >
    > --
    > Kevin
    >
    >
    > On 10/14/07 6:14 PM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:
    >
    >> Hi Kevin,
    >>
    >> Nice work cleaning up the code tonight!
    >>
    >> One question - why do you think the break statement below is not
    >> needed? (Keep in mind that it is past 1am in my TZ right now, so I
    >> may be asking stupid/obvious stuff :-))
    >>
    >> Andrus
    >>
    >>
    >> On Oct 15, 2007, at 12:30 AM, kmenar..pache.org wrote:
    >>
    >>> Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/
    >>> src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
    >>> URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/
    >>> cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/
    >>> jdbc/SQLTemplateAction.java?rev=584611&r1=584610&r2=584611&view=diff
    >>> ====================================================================
    >>> ==
    >>> ========
    >>> --- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/
    >>> main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
    >>> (original)
    >>> +++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/
    >>> main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java Sun
    >>> Oct 14 14:30:39 2007
    >>>.. -159,10 +157,7 @@
    >>> t1);
    >>> }
    >>> finally {
    >>> - if (iteratedResult) {
    >>> - break;
    >>> - }
    >>> - else {
    >>> + if (!iteratedResult) {
    >>> resultSet.close();
    >>> }
    >>> }
    >>
    >
    > --
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Oct 15 2007 - 03:23:59 EDT