You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/31 08:00:00 UTC

cvs commit: jakarta-turbine-maven/src/java/org/apache/maven DVSLFormatter.java

jvanzyl     2002/12/30 23:00:00

  Modified:    src/java/org/apache/maven DVSLFormatter.java
  Log:
  refactoring. update to follow
  
  Revision  Changes    Path
  1.8       +26 -7     jakarta-turbine-maven/src/java/org/apache/maven/DVSLFormatter.java
  
  Index: DVSLFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/DVSLFormatter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DVSLFormatter.java	24 Nov 2002 19:00:37 -0000	1.7
  +++ DVSLFormatter.java	31 Dec 2002 07:00:00 -0000	1.8
  @@ -26,12 +26,12 @@
    *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  + *    "Apache MavenSession" must not be used to endorse or promote products
    *    derived from this software without prior written permission. For
    *    written permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  + *    "Apache MavenSession", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -87,11 +87,30 @@
        * @throws IllegalArgumentException If an invalid pattern is
        * specified.
        */
  -    public static final String formatNumber( Number value, String pattern )
  -        throws IllegalArgumentException
  +    public static final String formatNumber( String value, String pattern )
       {
  -        formatter.applyPattern( pattern );
  +        if ( pattern == null || value == null )
  +        {
  +            return "<error formatting: '" + value + "' with '" + pattern + "'>";
  +        }
   
  -        return formatter.format( value.doubleValue() );
  +        String ret = null;
  +
  +        try
  +        {
  +            // What the fuck is wrong with this thing. What a complete fucking
  +            // piece of utter shit. Can Sun fucking do anything right?!?
  +            // Enabling this causes allows absolutely nothing to work correctly.
  +            // Go check out the javadoc on this too, what crap. Just crap.
  +            //formatter.applyPattern( pattern );
  +
  +            ret = formatter.format( formatter.parse( value ).doubleValue() );
  +        }
  +        catch ( Exception e )
  +        {
  +            return "<error formatting: '" + value + "' with '" + pattern + "'>";
  +        }
  +
  +        return ret;
       }
   }