You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by dl...@apache.org on 2003/11/11 01:33:32 UTC

cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic DateTool.java

dlr         2003/11/10 16:33:32

  Modified:    src/java/org/apache/velocity/tools/generic DateTool.java
  Log:
  * src/java/org/apache/velocity/tools/generic/DateTool.java
    getDateFormat(int, int, Locale, TimeZone): Sun JDK 1.4.2 warns
    against using a "return" statement in a "finally" block.  I assume
    that this is because any exception which and put you into the
    "finally" block in the first place is subsequently discarded by the
    "return".  Be more explicit about this behavior by catching and
    suppressing any RuntimeException, and returning any DateFormat
    instance we've procured so far.  This mirrors previous behavior.
    Here's the JDK 1.4 warning message for reference:
  
      [javac] /home/dlr/src/velocity-tools/src/java/org/apache/velocity/tools/generic/DateTool.java:571: warning: finally clause cannot complete normally
      [javac]         }
      [javac]         ^
      [javac] Note: Some input files use or override a deprecated API.
      [javac] Note: Recompile with -deprecation for details.
      [javac] 1 warning
  
  Revision  Changes    Path
  1.6       +3 -3      jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/DateTool.java
  
  Index: DateTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/DateTool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- DateTool.java	6 Nov 2003 00:26:54 -0000	1.5
  +++ DateTool.java	11 Nov 2003 00:33:32 -0000	1.6
  @@ -565,10 +565,10 @@
               }
               df.setTimeZone(timezone);
           }
  -        finally
  +        catch (RuntimeException suppressed)
           {
  -            return df;
           }
  +        return df;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic DateTool.java

Posted by Nathan Bubna <na...@esha.com>.
dlr@apache.org sent:
...
>   Modified:    src/java/org/apache/velocity/tools/generic DateTool.java
>   Log:
>   * src/java/org/apache/velocity/tools/generic/DateTool.java
>     getDateFormat(int, int, Locale, TimeZone): Sun JDK 1.4.2 warns
>     against using a "return" statement in a "finally" block.  I assume
>     that this is because any exception which and put you into the
>     "finally" block in the first place is subsequently discarded by the
>     "return".  Be more explicit about this behavior by catching and
>     suppressing any RuntimeException, and returning any DateFormat
>     instance we've procured so far.  This mirrors previous behavior.
>     Here's the JDK 1.4 warning message for reference:
...
>   RCS file:
/home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/Da
teTool.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -u -r1.5 -r1.6
>   --- DateTool.java 6 Nov 2003 00:26:54 -0000 1.5
>   +++ DateTool.java 11 Nov 2003 00:33:32 -0000 1.6
>   @@ -565,10 +565,10 @@
>                }
>                df.setTimeZone(timezone);
>            }
>   -        finally
>   +        catch (RuntimeException suppressed)
>            {
>   -            return df;
>            }
>   +        return df;
>        }

interesting.  but yeah, i guess it is more explicit this way.  and that
reminds me i'm still using 1.4.1... :)

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org