harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r450020 - in /incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java: java/math/ org/apache/harmony/math/internal/nls/
Date Tue, 26 Sep 2006 12:22:37 GMT
Author: tellison
Date: Tue Sep 26 05:22:36 2006
New Revision: 450020

URL: http://svn.apache.org/viewvc?view=rev&rev=450020
Log:
Apply patch HARMONY-1323 ([classlib][internationalization]Internationalization of the math
module)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Conversion.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/MathContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Multiplication.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/RoundingMode.java
    incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigDecimal.java
Tue Sep 26 05:22:36 2006
@@ -21,6 +21,8 @@
 import java.io.Serializable;
 import java.io.StreamCorruptedException;
 
+import org.apache.harmony.math.internal.nls.Messages;
+
 /**
  * @author Intel Middleware Product Division
  * @author Instituto Tecnologico de Cordoba
@@ -279,7 +281,8 @@
             newScale = (long)scale - Integer.parseInt(scaleString);
             scale = (int)newScale;
             if (newScale != scale) {
-                throw new NumberFormatException("Scale out of range.");
+                // math.02=Scale out of range.
+                throw new NumberFormatException(Messages.getString("math.02")); //$NON-NLS-1$
             }
         }
         // Parsing the unscaled value
@@ -317,7 +320,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigDecimal(double val) {
         if (Double.isInfinite(val) || Double.isNaN(val)) {
-            throw new NumberFormatException("Infinite or NaN");
+            // math.03=Infinity or NaN
+            throw new NumberFormatException(Messages.getString("math.03")); //$NON-NLS-1$
         }
         long bits = Double.doubleToLongBits(val); // IEEE-754
         long mantisa;
@@ -440,7 +444,8 @@
     /** @ar.org.fitc.spec_ref */
     public static BigDecimal valueOf(double val) {
         if (Double.isInfinite(val) || Double.isNaN(val)) {
-            throw new NumberFormatException("Infinity or NaN");
+            // math.03=Infinity or NaN
+            throw new NumberFormatException(Messages.getString("math.03")); //$NON-NLS-1$
         }
         return new BigDecimal(Double.toString(val));
     }
@@ -641,7 +646,8 @@
             throw new NullPointerException();
         }
         if (divisor.isZero()) {
-            throw new ArithmeticException("Division by zero");
+            // math.04=Division by zero
+            throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
         }
         
         long diffScale = ((long)this.scale - divisor.scale) - (long)scale;
@@ -761,7 +767,8 @@
         int lastPow = FIVE_POW.length - 1;
 
         if (divisor.isZero()) {
-            throw new ArithmeticException("Division by zero");
+            // math.04=Division by zero
+            throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
         }
         if (p.signum() == 0) {
             return zeroScaledBy(diffScale);
@@ -791,8 +798,8 @@
         } while (true);
         // If  abs(q) != 1  then the quotient is periodic
         if (!q.abs().equals(BigInteger.ONE)) {
-            throw new ArithmeticException("Non-terminating decimal expansion;"
-                    + " no exact representable decimal result.");
+            // math.05=Non-terminating decimal expansion; no exact representable decimal
result.
+            throw new ArithmeticException(Messages.getString("math.05")); //$NON-NLS-1$
         }
         // The sign of the is fixed and the quotient will be saved in 'p'
         if (q.signum() < 0) {
@@ -875,7 +882,8 @@
         int lastPow = TEN_POW.length - 1;
 
         if (divisor.isZero()) {
-            throw new ArithmeticException("Division by zero");
+            // math.04=Division by zero
+            throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
         }
         if ((divisor.aproxPrecision() + newScale > this.aproxPrecision() + 1L)
         || (this.isZero())) {
@@ -965,7 +973,8 @@
                 }
                 if (compRemDiv > 0) {
                     // The quotient won't fit in 'mc.precision()' digits
-                    throw new ArithmeticException("Division impossible");
+                    // math.06=Division impossible
+                    throw new ArithmeticException(Messages.getString("math.06")); //$NON-NLS-1$
                 }
             }
         }
@@ -998,7 +1007,8 @@
         }
         // To check if the result fit in 'mc.precision()' digits
         if (resultPrecision > mcPrecision) {
-            throw new ArithmeticException("Division impossible");
+            // math.06=Division impossible
+            throw new ArithmeticException(Messages.getString("math.06")); //$NON-NLS-1$
         } else {
             integralValue.scale = toIntScale(newScale);
             integralValue.setUnscaledValue(strippedBI);
@@ -1040,7 +1050,8 @@
             return ONE;
         }
         if ((n < 0) || (n > 999999999)) {
-            throw new ArithmeticException("Invalid operation");
+            // math.07=Invalid Operation
+            throw new ArithmeticException(Messages.getString("math.07")); //$NON-NLS-1$
         }
         long newScale = scale * (long)n;
         // Let be: this = [u,s]   so:  this^n = [u^n, s*n]
@@ -1065,7 +1076,8 @@
         }
         if ((m > 999999999) || ((mcPrecision == 0) && (n < 0))
                 || ((mcPrecision > 0) && (elength > mcPrecision))) {
-            throw new ArithmeticException("Invalid Operation");
+            // math.07=Invalid Operation
+            throw new ArithmeticException(Messages.getString("math.07")); //$NON-NLS-1$
         }
         if (mcPrecision > 0) {
             newPrecision = new MathContext( mcPrecision + elength + 1,
@@ -1393,7 +1405,7 @@
             if (exponent >= 0) {
                 result.insert(end - scale, '.');
             } else {
-                result.insert(begin - 1, "0.");
+                result.insert(begin - 1, "0."); //$NON-NLS-1$
                 result.insert(begin + 1, CH_ZEROS, 0, -(int)exponent - 1);
             }
         } else {
@@ -1426,7 +1438,7 @@
             if (exponent >= 0) {
                 result.insert(end - scale, '.');
             } else {
-                result.insert(begin - 1, "0.");
+                result.insert(begin - 1, "0."); //$NON-NLS-1$
                 result.insert(begin + 1, CH_ZEROS, 0, -(int)exponent - 1);
             }
         } else {
@@ -1484,7 +1496,7 @@
         if (scale > 0) {
             delta -= (intStr.length() - begin);
             if (delta >= 0) {
-                result.append("0.");
+                result.append("0."); //$NON-NLS-1$
                 // To append zeros after the decimal point
                 for (; delta > CH_ZEROS.length; delta -= CH_ZEROS.length) {
                     result.append(CH_ZEROS);
@@ -1529,12 +1541,14 @@
             BigInteger[] integerAndFraction;
             // An optimization before do a heavy division
             if ((scale > aproxPrecision()) || (scale > getUnscaledValue().getLowestSetBit()))
{
-                throw new ArithmeticException("Rounding necessary");
+                // math.08=Rounding necessary
+                throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
             }
             integerAndFraction = getUnscaledValue().divideAndRemainder(Multiplication.powerOf10(scale));
             if (integerAndFraction[1].signum() != 0) {
                 // It exists a non-zero fractional part 
-                throw new ArithmeticException("Rounding necessary");
+                // math.08=Rounding necessary
+                throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
             } else {
                 return integerAndFraction[0];
             }
@@ -1810,7 +1824,8 @@
         switch (roundingMode) {
             case UNNECESSARY:
                 if (fraction != 0) {
-                    throw new ArithmeticException("Rounding necessary");
+                    // math.08=Rounding necessary
+                    throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
                 }
                 break;
             case UP:
@@ -1864,7 +1879,8 @@
             // It fits in the primitive type
             return bigInteger.longValue();
         } else {
-            throw new ArithmeticException("Rounding necessary");
+            // math.08=Rounding necessary
+            throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
         }
     }
 
@@ -1893,9 +1909,11 @@
      */
     private static int toIntScale(long longScale) {
         if (longScale < Integer.MIN_VALUE) {
-            throw new ArithmeticException("Overflow");
+            // math.09=Overflow
+            throw new ArithmeticException(Messages.getString("math.09")); //$NON-NLS-1$
         } else if (longScale > Integer.MAX_VALUE) {
-            throw new ArithmeticException("Underflow");
+            // math.0A=Underflow
+            throw new ArithmeticException(Messages.getString("math.0A")); //$NON-NLS-1$
         } else {
             return (int)longScale;
         }
@@ -1927,7 +1945,8 @@
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
         in.defaultReadObject();
         if (getUnscaledValue() == null) {
-            throw new StreamCorruptedException("null unscaled value");
+            // math.0B=null unscaled value
+            throw new StreamCorruptedException(Messages.getString("math.0B")); //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/BigInteger.java
Tue Sep 26 05:22:36 2006
@@ -21,6 +21,8 @@
 import java.util.Random;
 import java.io.Serializable;
 
+import org.apache.harmony.math.internal.nls.Messages;
+
 /**
  * @author Intel Middleware Product Division
  * @author Instituto Tecnologico de Cordoba
@@ -97,7 +99,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger(int numBits, Random rnd) {
         if (numBits < 0) {
-            throw new IllegalArgumentException("numBits must be non-negative");
+            // math.1B=numBits must be non-negative
+            throw new IllegalArgumentException(Messages.getString("math.1B")); //$NON-NLS-1$
         }
         if (rnd == null) {
             throw new NullPointerException();
@@ -122,7 +125,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger(int bitLength, int certainty, Random rnd) {
         if (bitLength < 2) {
-            throw new ArithmeticException("bitLength < 2");
+            // math.1C=bitLength < 2
+            throw new ArithmeticException(Messages.getString("math.1C")); //$NON-NLS-1$
         }
         BigInteger me = Primality.consBigInteger(bitLength, certainty, rnd);
         sign = me.sign;
@@ -141,10 +145,12 @@
             throw new NullPointerException();
         }
         if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) {
-            throw new NumberFormatException("Radix out of range");
+            // math.11=Radix out of range
+            throw new NumberFormatException(Messages.getString("math.11")); //$NON-NLS-1$
         }
         if (val.length() == 0) {
-            throw new NumberFormatException("Zero length BigInteger");
+            // math.12=Zero length BigInteger
+            throw new NumberFormatException(Messages.getString("math.12")); //$NON-NLS-1$
         }
         BigInteger me = Conversion.string2BigInteger(val, radix);
         sign = me.sign;
@@ -158,12 +164,14 @@
             throw new NullPointerException();
         }
         if ((signum < -1) || (signum > 1)) {
-            throw new NumberFormatException("Invalid signum value");
+            // math.13=Invalid signum value
+            throw new NumberFormatException(Messages.getString("math.13")); //$NON-NLS-1$
         }
         if (signum == 0) {
             for (int i = 0; i < magnitude.length; i++) {
                 if (magnitude[i] != 0) {
-                    throw new NumberFormatException("signum-magnitude mismatch");
+                    // math.14=signum-magnitude mismatch
+                    throw new NumberFormatException(Messages.getString("math.14")); //$NON-NLS-1$
                 }
             }
         }
@@ -181,7 +189,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger(byte[] val) {
         if (val.length == 0) {
-            throw new NumberFormatException("Zero length BigInteger");
+            // math.12=Zero length BigInteger
+            throw new NumberFormatException(Messages.getString("math.12")); //$NON-NLS-1$
         }
         if (val[0] < 0) {
             sign = -1;
@@ -374,7 +383,8 @@
             return ((digits[0] & 1) != 0);
         }
         if (n < 0) {
-            throw new ArithmeticException("Negative bit address");
+            // math.15=Negative bit address
+            throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
         }
         int intCount = n >> 5;
         if (intCount >= numberLength) {
@@ -394,7 +404,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger setBit(int n) {
         if (n < 0) {
-            throw new ArithmeticException("Negative bit address");
+            // math.15=Negative bit address
+            throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
         }
         int intCount = n >> 5; // count of integers: count / 32
         return (((sign < 0) && (intCount >= numberLength)) ? this : BitLevel
@@ -404,7 +415,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger clearBit(int n) {
         if (n < 0) {
-            throw new ArithmeticException("Negative bit address");
+            // math.15=Negative bit address
+            throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
         }
         int intCount = n >> 5;
         return (((sign == 0) || ((sign > 0) && (intCount >= numberLength)))
? this
@@ -414,7 +426,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger flipBit(int n) {
         if (n < 0) {
-            throw new ArithmeticException("Negative bit address");
+            // math.15=Negative bit address
+            throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
         }
         return BitLevel.changeBit(this, n >> 5, n & 31, 1);
     }
@@ -586,7 +599,8 @@
         } else if (exp == 0) {
             return ONE;
         } else {// (exp < 0)
-            throw new ArithmeticException("Negative exponent");
+            // math.16=Negative exponent
+            throw new ArithmeticException(Messages.getString("math.16")); //$NON-NLS-1$
         }
     }
 
@@ -594,7 +608,8 @@
     public BigInteger[] divideAndRemainder(BigInteger divisor) {
         int divisorSign = divisor.sign;
         if (divisorSign == 0) {
-            throw new ArithmeticException("BigInteger divide by zero");
+            // math.17=BigInteger divide by zero
+            throw new ArithmeticException(Messages.getString("math.17")); //$NON-NLS-1$
         }
         int divisorLen = divisor.numberLength;
         int[] divisorDigits = divisor.digits;
@@ -631,7 +646,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger divide(BigInteger divisor) {
         if (divisor.sign == 0) {
-            throw new ArithmeticException("BigInteger divide by zero");
+            // math.17=BigInteger divide by zero
+            throw new ArithmeticException(Messages.getString("math.17")); //$NON-NLS-1$
         }
         int divisorSign = divisor.sign;
         if (divisor.isOne()) {
@@ -676,7 +692,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger remainder(BigInteger divisor) {
         if (divisor.sign == 0) {
-            throw new ArithmeticException("BigInteger divide by zero");
+            // math.17=BigInteger divide by zero
+            throw new ArithmeticException(Messages.getString("math.17")); //$NON-NLS-1$
         }
         int thisLen = numberLength;
         int divisorLen = divisor.numberLength;
@@ -702,11 +719,13 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger modInverse(BigInteger m) {
         if (m.sign <= 0) {
-            throw new ArithmeticException("BigInteger: modulus not positive");
+            // math.18=BigInteger: modulus not positive
+            throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
         }
         // If both are even, no inverse exists
         if (!(testBit(0) || m.testBit(0))) {
-            throw new ArithmeticException("BigInteger not invertible.");
+            // math.19=BigInteger not invertible.
+            throw new ArithmeticException(Messages.getString("math.19")); //$NON-NLS-1$
         }
         if (m.isOne()) {
             return ZERO;
@@ -714,7 +733,8 @@
         // From now on: (m > 1)
         BigInteger res = Division.modInverse(abs(), m);
         if (res.sign == 0) {
-            throw new ArithmeticException("BigInteger not invertible.");
+            // math.19=BigInteger not invertible.
+            throw new ArithmeticException(Messages.getString("math.19")); //$NON-NLS-1$
         }
         return ((sign < 0) ? m.subtract(res) : res);
     }
@@ -722,7 +742,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger modPow(BigInteger exponent, BigInteger m) {
         if (m.sign <= 0) {
-            throw new ArithmeticException("BigInteger: modulus not positive");
+            // math.18=BigInteger: modulus not positive
+            throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
         }
         BigInteger base = this;
         if (exponent.sign < 0) {
@@ -743,7 +764,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger mod(BigInteger m) {
         if (m.sign <= 0) {
-            throw new ArithmeticException("BigInteger: modulus not positive");
+            // math.18=BigInteger: modulus not positive
+            throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
         }
         BigInteger rem = remainder(m);
         return ((rem.sign < 0) ? rem.add(m) : rem);
@@ -757,7 +779,8 @@
     /** @ar.org.fitc.spec_ref */
     public BigInteger nextProbablePrime() {
         if (sign < 0) {
-            throw new ArithmeticException("start < 0: " + this);
+            // math.1A=start < 0: {0}
+            throw new ArithmeticException(Messages.getString("math.1A", this)); //$NON-NLS-1$
         }
         return Primality.nextProbablePrime(this);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Conversion.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Conversion.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Conversion.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Conversion.java
Tue Sep 26 05:22:36 2006
@@ -113,7 +113,7 @@
         int digits[] = val.digits;
 
         if (sign == 0) {
-            return "0";
+            return "0"; //$NON-NLS-1$
         }
         if (numberLength == 1) {
             int highDigit = digits[numberLength - 1];
@@ -200,25 +200,25 @@
         if (sign == 0) {
             switch (scale) {
                 case 0:
-                    return "0";
+                    return "0"; //$NON-NLS-1$
                 case 1:
-                    return "0.0";
+                    return "0.0"; //$NON-NLS-1$
                 case 2:
-                    return "0.00";
+                    return "0.00"; //$NON-NLS-1$
                 case 3:
-                    return "0.000";
+                    return "0.000"; //$NON-NLS-1$
                 case 4:
-                    return "0.0000";
+                    return "0.0000"; //$NON-NLS-1$
                 case 5:
-                    return "0.00000";
+                    return "0.00000"; //$NON-NLS-1$
                 case 6:
-                    return "0.000000";
+                    return "0.000000"; //$NON-NLS-1$
                 default:
                     StringBuffer result1 = new StringBuffer();
                     if (scale < 0) {
-                        result1.append("0E+");
+                        result1.append("0E+"); //$NON-NLS-1$
                     } else {
-                        result1.append("0E");
+                        result1.append("0E"); //$NON-NLS-1$
                     }
                     result1.append(-scale);
                     return result1.toString();
@@ -361,21 +361,21 @@
         }
         if (value == 0) {
             switch (scale) {
-                case 0: return "0";
-                case 1: return "0.0";
-                case 2: return "0.00";
-                case 3: return "0.000";
-                case 4: return "0.0000";
-                case 5: return "0.00000";
-                case 6: return "0.000000";
+                case 0: return "0"; //$NON-NLS-1$
+                case 1: return "0.0"; //$NON-NLS-1$
+                case 2: return "0.00"; //$NON-NLS-1$
+                case 3: return "0.000"; //$NON-NLS-1$
+                case 4: return "0.0000"; //$NON-NLS-1$
+                case 5: return "0.00000"; //$NON-NLS-1$
+                case 6: return "0.000000"; //$NON-NLS-1$
                 default:
                     StringBuffer result1 = new StringBuffer();
                     if (scale  < 0) {
-                        result1.append("0E+");
+                        result1.append("0E+"); //$NON-NLS-1$
                     } else {
-                        result1.append("0E");
+                        result1.append("0E"); //$NON-NLS-1$
                     }
-                    result1.append( (scale == Integer.MIN_VALUE) ? "2147483648" : Integer.toString(-scale));
+                    result1.append( (scale == Integer.MIN_VALUE) ? "2147483648" : Integer.toString(-scale));
//$NON-NLS-1$
                     return result1.toString();
             }
         } else {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/MathContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/MathContext.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/MathContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/MathContext.java
Tue Sep 26 05:22:36 2006
@@ -21,6 +21,8 @@
 import java.io.Serializable;
 import java.io.StreamCorruptedException;
 
+import org.apache.harmony.math.internal.nls.Messages;
+
 /**
  * @ar.org.fitc.spec_ref
  * @author Intel Middleware Product Division
@@ -91,10 +93,12 @@
     /** @ar.org.fitc.spec_ref */
     public MathContext(int setPrecision, RoundingMode setRoundingMode) {
         if (setPrecision < 0) {
-            throw new IllegalArgumentException("Digits < 0");
+            // math.0C=Digits < 0
+            throw new IllegalArgumentException(Messages.getString("math.0C")); //$NON-NLS-1$
         }
         if (setRoundingMode == null) {
-            throw new NullPointerException("null RoundingMode");
+            // math.0D=null RoundingMode
+            throw new NullPointerException(Messages.getString("math.0D")); //$NON-NLS-1$
         }
         precision = setPrecision;
         roundingMode = setRoundingMode;
@@ -108,19 +112,22 @@
         int digit; // It will contain the digit parsed
 
         if ((charVal.length < 27) || (charVal.length > 45)) {
-            throw new IllegalArgumentException("bad string format");
+            // math.0E=bad string format
+            throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
         }
         // Parsing "precision=" String
         for (i = 0; (i < chPrecision.length) && (charVal[i] == chPrecision[i]);
i++)
             ;
 
         if (i < chPrecision.length) {
-            throw new IllegalArgumentException("bad string format");
+            // math.0E=bad string format
+            throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
         }
         // Parsing the value for "precision="...
         digit = Character.digit(charVal[i], 10);
         if (digit == -1) {
-            throw new IllegalArgumentException("bad string format");
+            // math.0E=bad string format
+            throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
         }
         this.precision = this.precision * 10 + digit;
         i++;
@@ -133,13 +140,15 @@
                     i++;
                     break;
                 } else {// It isn't  a valid digit, and isn't a white space
-                    throw new IllegalArgumentException("bad string format");
+                    // math.0E=bad string format
+                    throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
                 }
             }
             // Acumulating the value parsed
             this.precision = this.precision * 10 + digit;
             if (this.precision < 0) {
-                throw new IllegalArgumentException("bad string format");
+                // math.0E=bad string format
+                throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
             }
             i++;
         } while (true);
@@ -149,7 +158,8 @@
             ;
 
         if (j < chRoundingMode.length) {
-            throw new IllegalArgumentException("bad string format");
+            // math.0E=bad string format
+            throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
         }
         // Parsing the value for "roundingMode"...
         this.roundingMode = RoundingMode.valueOf(String.valueOf(charVal, i,
@@ -201,10 +211,12 @@
             ClassNotFoundException {
         s.defaultReadObject();
         if (precision < 0) {
-            throw new StreamCorruptedException("bad precision value");
+            // math.0F=bad precision value
+            throw new StreamCorruptedException(Messages.getString("math.0F")); //$NON-NLS-1$
         }
         if (roundingMode == null) {
-            throw new StreamCorruptedException("null roundingMode");
+            // math.10=null roundingMode
+            throw new StreamCorruptedException(Messages.getString("math.10")); //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Multiplication.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Multiplication.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Multiplication.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/Multiplication.java
Tue Sep 26 05:22:36 2006
@@ -16,6 +16,8 @@
 
 package java.math;
 
+import org.apache.harmony.math.internal.nls.Messages;
+
 /**
  * Static library that provides all multiplication of {@link BigInteger} methods.
  *
@@ -388,7 +390,8 @@
         long byteArraySize = 1 + (long)(exp / 2.4082399653118496);
         
         if (byteArraySize > Runtime.getRuntime().freeMemory()) {
-            throw new OutOfMemoryError("power of ten too big");
+            // math.01=power of ten too big
+            throw new OutOfMemoryError(Messages.getString("math.01")); //$NON-NLS-1$
         }
         if (exp <= Integer.MAX_VALUE) {
             // To calculate:    5^exp * 2^exp

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/RoundingMode.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/RoundingMode.java?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/RoundingMode.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/java/math/RoundingMode.java
Tue Sep 26 05:22:36 2006
@@ -16,6 +16,8 @@
 
 package java.math;
 
+import org.apache.harmony.math.internal.nls.Messages;
+
 /**
  * @ar.org.fitc.spec_ref
  * @author Intel Middleware Product Division
@@ -75,7 +77,8 @@
             case BigDecimal.ROUND_UP:
                 return UP;
             default:
-                throw new IllegalArgumentException("Invalid rounding mode");
+                // math.00=Invalid rounding mode
+                throw new IllegalArgumentException(Messages.getString("math.00")); //$NON-NLS-1$
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties?view=diff&rev=450020&r1=450019&r2=450020
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties
Tue Sep 26 05:22:36 2006
@@ -14,3 +14,32 @@
 # 
 
 # messages for EN locale
+math.00=Invalid rounding mode
+math.01=power of ten too big
+math.02=Scale out of range.
+math.03=Infinity or NaN
+math.04=Division by zero
+math.05=Non-terminating decimal expansion; no exact representable decimal result.
+math.06=Division impossible
+math.07=Invalid Operation
+math.08=Rounding necessary
+math.09=Overflow
+math.0A=Underflow
+math.0B=null unscaled value
+math.0C=Digits < 0
+math.0D=null RoundingMode
+math.0E=bad string format
+math.0F=bad precision value
+math.10=null roundingMode
+math.1B=numBits must be non-negative
+math.1C=bitLength < 2
+math.11=Radix out of range
+math.12=Zero length BigInteger
+math.13=Invalid signum value
+math.14=signum-magnitude mismatch
+math.15=Negative bit address
+math.16=Negative exponent
+math.17=BigInteger divide by zero
+math.18=BigInteger: modulus not positive
+math.19=BigInteger not invertible.
+math.1A=start < 0: {0}



Mime
View raw message