commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1534450 - /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
Date Tue, 22 Oct 2013 01:27:39 GMT
Author: sebb
Date: Tue Oct 22 01:27:39 2013
New Revision: 1534450

URL: http://svn.apache.org/r1534450
Log:
DecimalFormat is not thread-safe.
Localising this also avoids warning about field hiding in toDisplayString

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java?rev=1534450&r1=1534449&r2=1534450&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
Tue Oct 22 01:27:39 2013
@@ -101,13 +101,13 @@ public class RationalNumber extends Numb
         return divisor != 0;
     }
 
-    private static final NumberFormat nf = DecimalFormat.getInstance();
-
     @Override
     public String toString() {
         if (divisor == 0) {
             return "Invalid rational (" + numerator + "/" + divisor + ")";
         }
+        final NumberFormat nf = DecimalFormat.getInstance();
+
         if ((numerator % divisor) == 0) {
             return nf.format(numerator / divisor);
         }



Mime
View raw message