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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to