You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by cm...@apache.org on 2002/11/28 17:50:31 UTC

cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/server/runner XMLFormatter.java

cmlenz      2002/11/28 08:50:31

  Modified:    framework/src/java/share/org/apache/cactus/server/runner
                        XMLFormatter.java
  Log:
  When formatting test execution duration as string, don't use the default
  locale. The XSLT-transformation, at least the junit-noframes.xsl, requires
  dotted decimal notation to work correctly, otherwise NaN is displayed which
  isn't very informative ;-)
  
  We'll just default to the US locale to enforce dotted decimal notation.
  
  Revision  Changes    Path
  1.9       +10 -2     jakarta-cactus/framework/src/java/share/org/apache/cactus/server/runner/XMLFormatter.java
  
  Index: XMLFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/server/runner/XMLFormatter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLFormatter.java	1 Sep 2002 17:05:26 -0000	1.8
  +++ XMLFormatter.java	28 Nov 2002 16:50:31 -0000	1.9
  @@ -57,6 +57,7 @@
   package org.apache.cactus.server.runner;
   
   import java.text.NumberFormat;
  +import java.util.Locale;
   
   import junit.framework.AssertionFailedError;
   import junit.framework.Test;
  @@ -99,6 +100,13 @@
       private long currentTestStartTime;
   
       /**
  +     * The number format used to convert durations into strings. Don't use the
  +     * default locale for that, because the resulting string needs to use 
  +     * dotted decimal notation for an XSLT transformation to work correctly.
  +     */
  +    private NumberFormat durationFormat = NumberFormat.getInstance(Locale.US);
  +
  +    /**
        * XML string containing executed test case results
        */
       private StringBuffer currentTestCaseResults = new StringBuffer();
  @@ -154,7 +162,7 @@
        */
       private String getDurationAsString(long theDuration)
       {
  -        return NumberFormat.getInstance().format((double) theDuration / 1000);
  +        return durationFormat.format((double) theDuration / 1000);
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>