summaryrefslogtreecommitdiffstats
path: root/math/src
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-16 18:08:47 -0700
committerElliott Hughes <enh@google.com>2010-04-16 20:26:47 -0700
commit8454d3c5b9778ae359d11cd98ed81c589e951d0a (patch)
treefb1476844ca1b1be58f7cb7c9ceca523746763d3 /math/src
parent757a7942eed2b0aa457f8517a0259d2ac82c5b18 (diff)
downloadlibcore-8454d3c5b9778ae359d11cd98ed81c589e951d0a.zip
libcore-8454d3c5b9778ae359d11cd98ed81c589e951d0a.tar.gz
libcore-8454d3c5b9778ae359d11cd98ed81c589e951d0a.tar.bz2
Remove "messages" from the logging, math, and nio_char modules.
Change-Id: Ib61b132ce17fdd37956889e855bda35956f8ae62
Diffstat (limited to 'math/src')
-rw-r--r--math/src/main/java/java/math/BigDecimal.java65
-rw-r--r--math/src/main/java/java/math/BigInt.java10
-rw-r--r--math/src/main/java/java/math/BigInteger.java48
-rw-r--r--math/src/main/java/java/math/Division.java4
-rw-r--r--math/src/main/java/java/math/MathContext.java35
-rw-r--r--math/src/main/java/java/math/Multiplication.java5
-rw-r--r--math/src/main/java/java/math/RoundingMode.java5
-rw-r--r--math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java140
-rw-r--r--math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties45
9 files changed, 54 insertions, 303 deletions
diff --git a/math/src/main/java/java/math/BigDecimal.java b/math/src/main/java/java/math/BigDecimal.java
index 4e4875b..364470a 100644
--- a/math/src/main/java/java/math/BigDecimal.java
+++ b/math/src/main/java/java/math/BigDecimal.java
@@ -22,8 +22,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import org.apache.harmony.math.internal.nls.Messages;
-
/**
* This class represents immutable integer numbers of arbitrary length. Large
* numbers are typically used in security applications and therefore BigIntegers
@@ -378,8 +376,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
newScale = (long)scale - Integer.parseInt(scaleString);
scale = (int)newScale;
if (newScale != scale) {
- // math.02=Scale out of range.
- throw new NumberFormatException(Messages.getString("math.02")); //$NON-NLS-1$
+ throw new NumberFormatException("Scale out of range");
}
}
// Parsing the unscaled value
@@ -523,8 +520,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*/
public BigDecimal(double val) {
if (Double.isInfinite(val) || Double.isNaN(val)) {
- // math.03=Infinity or NaN
- throw new NumberFormatException(Messages.getString("math.03")); //$NON-NLS-1$
+ throw new NumberFormatException("Infinity or NaN");
}
long bits = Double.doubleToLongBits(val); // IEEE-754
long mantisa;
@@ -802,8 +798,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*/
public static BigDecimal valueOf(double val) {
if (Double.isInfinite(val) || Double.isNaN(val)) {
- // math.03=Infinity or NaN
- throw new NumberFormatException(Messages.getString("math.03")); //$NON-NLS-1$
+ throw new NumberFormatException("Infinity or NaN");
}
return new BigDecimal(Double.toString(val));
}
@@ -1113,8 +1108,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
throw new NullPointerException();
}
if (divisor.isZero()) {
- // math.04=Division by zero
- throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
+ throw new ArithmeticException("Division by zero");
}
long diffScale = ((long)this.scale - divisor.scale) - scale;
@@ -1289,8 +1283,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
int lastPow = FIVE_POW.length - 1;
if (divisor.isZero()) {
- // math.04=Division by zero
- throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
+ throw new ArithmeticException("Division by zero");
}
if (p.signum() == 0) {
return zeroScaledBy(diffScale);
@@ -1320,8 +1313,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
} while (true);
// If abs(q) != 1 then the quotient is periodic
if (!q.abs().equals(BigInteger.ONE)) {
- // math.05=Non-terminating decimal expansion; no exact representable decimal result.
- throw new ArithmeticException(Messages.getString("math.05")); //$NON-NLS-1$
+ throw new ArithmeticException("Non-terminating decimal expansion; no exact representable decimal result");
}
// The sign of the is fixed and the quotient will be saved in 'p'
if (q.signum() < 0) {
@@ -1434,8 +1426,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
int lastPow = TEN_POW.length - 1;
if (divisor.isZero()) {
- // math.04=Division by zero
- throw new ArithmeticException(Messages.getString("math.04")); //$NON-NLS-1$
+ throw new ArithmeticException("Division by zero");
}
if ((divisor.aproxPrecision() + newScale > this.aproxPrecision() + 1L)
|| (this.isZero())) {
@@ -1544,9 +1535,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
compRemDiv = Math.abs(quotAndRem[1].signum());
}
if (compRemDiv > 0) {
- // The quotient won't fit in 'mc.precision()' digits
- // math.06=Division impossible
- throw new ArithmeticException(Messages.getString("math.06")); //$NON-NLS-1$
+ throw new ArithmeticException("Division impossible");
}
}
}
@@ -1579,8 +1568,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
// To check if the result fit in 'mc.precision()' digits
if (resultPrecision > mcPrecision) {
- // math.06=Division impossible
- throw new ArithmeticException(Messages.getString("math.06")); //$NON-NLS-1$
+ throw new ArithmeticException("Division impossible");
}
integralValue.scale = toIntScale(newScale);
integralValue.setUnscaledValue(strippedBI);
@@ -1706,14 +1694,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
return ONE;
}
if ((n < 0) || (n > 999999999)) {
- // math.07=Invalid Operation
- throw new ArithmeticException(Messages.getString("math.07")); //$NON-NLS-1$
+ throw new ArithmeticException("Invalid operation");
}
long newScale = scale * (long)n;
// Let be: this = [u,s] so: this^n = [u^n, s*n]
- return ((isZero())
- ? zeroScaledBy(newScale)
- : new BigDecimal(getUnscaledValue().pow(n), toIntScale(newScale)));
+ return isZero() ? zeroScaledBy(newScale)
+ : new BigDecimal(getUnscaledValue().pow(n), toIntScale(newScale));
}
/**
@@ -1746,8 +1732,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
if ((m > 999999999) || ((mcPrecision == 0) && (n < 0))
|| ((mcPrecision > 0) && (elength > mcPrecision))) {
- // math.07=Invalid Operation
- throw new ArithmeticException(Messages.getString("math.07")); //$NON-NLS-1$
+ throw new ArithmeticException("Invalid operation");
}
if (mcPrecision > 0) {
newPrecision = new MathContext( mcPrecision + elength + 1,
@@ -2336,7 +2321,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (exponent >= 0) {
result.insert(end - scale, '.');
} else {
- result.insert(begin - 1, "0."); //$NON-NLS-1$
+ result.insert(begin - 1, "0.");
result.insert(begin + 1, CH_ZEROS, 0, -(int)exponent - 1);
}
} else {
@@ -2380,7 +2365,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (exponent >= 0) {
result.insert(end - scale, '.');
} else {
- result.insert(begin - 1, "0."); //$NON-NLS-1$
+ result.insert(begin - 1, "0.");
result.insert(begin + 1, CH_ZEROS, 0, -(int)exponent - 1);
}
} else {
@@ -2452,7 +2437,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (scale > 0) {
delta -= (intStr.length() - begin);
if (delta >= 0) {
- result.append("0."); //$NON-NLS-1$
+ result.append("0.");
// To append zeros after the decimal point
for (; delta > CH_ZEROS.length; delta -= CH_ZEROS.length) {
result.append(CH_ZEROS);
@@ -2510,14 +2495,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
BigInteger[] integerAndFraction;
// An optimization before do a heavy division
if ((scale > aproxPrecision()) || (scale > getUnscaledValue().getLowestSetBit())) {
- // math.08=Rounding necessary
- throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
+ throw new ArithmeticException("Rounding necessary");
}
integerAndFraction = getUnscaledValue().divideAndRemainder(Multiplication.powerOf10(scale));
if (integerAndFraction[1].signum() != 0) {
// It exists a non-zero fractional part
- // math.08=Rounding necessary
- throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
+ throw new ArithmeticException("Rounding necessary");
}
return integerAndFraction[0];
}
@@ -2908,8 +2891,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
switch (roundingMode) {
case UNNECESSARY:
if (fraction != 0) {
- // math.08=Rounding necessary
- throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
+ throw new ArithmeticException("Rounding necessary");
}
break;
case UP:
@@ -2964,8 +2946,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
// It fits in the primitive type
return bigInteger.longValue();
}
- // math.08=Rounding necessary
- throw new ArithmeticException(Messages.getString("math.08")); //$NON-NLS-1$
+ throw new ArithmeticException("Rounding necessary");
}
/**
@@ -2998,11 +2979,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*/
private static int toIntScale(long longScale) {
if (longScale < Integer.MIN_VALUE) {
- // math.09=Overflow
- throw new ArithmeticException(Messages.getString("math.09")); //$NON-NLS-1$
+ throw new ArithmeticException("Overflow");
} else if (longScale > Integer.MAX_VALUE) {
- // math.0A=Underflow
- throw new ArithmeticException(Messages.getString("math.0A")); //$NON-NLS-1$
+ throw new ArithmeticException("Underflow");
} else {
return (int)longScale;
}
diff --git a/math/src/main/java/java/math/BigInt.java b/math/src/main/java/java/math/BigInt.java
index 1f3ffdd..d1bd29b 100644
--- a/math/src/main/java/java/math/BigInt.java
+++ b/math/src/main/java/java/math/BigInt.java
@@ -16,10 +16,8 @@
package java.math;
-import org.apache.harmony.math.internal.nls.Messages;
-import org.openssl.NativeBN;
-
import java.util.Random;
+import org.openssl.NativeBN;
/*
* In contrast to BigIntegers this class doesn't fake two's complement representation.
@@ -85,12 +83,10 @@ class BigInt
while ((e = NativeBN.ERR_get_error()) != 0) {
reason = e & 255;
if (reason == 103) {
- // math.17=BigInteger divide by zero
- throw new ArithmeticException(Messages.getString("math.17")); //$NON-NLS-1$
+ throw new ArithmeticException("BigInteger division by zero");
}
if (reason == 108) {
- // math.19=BigInteger not invertible.
- throw new ArithmeticException(Messages.getString("math.19")); //$NON-NLS-1$
+ throw new ArithmeticException("BigInteger not invertible");
}
if (reason == 65) {
throw new OutOfMemoryError();
diff --git a/math/src/main/java/java/math/BigInteger.java b/math/src/main/java/java/math/BigInteger.java
index c463b48..1fbeb48 100644
--- a/math/src/main/java/java/math/BigInteger.java
+++ b/math/src/main/java/java/math/BigInteger.java
@@ -29,8 +29,6 @@ import java.io.ObjectOutputStream;
import java.util.Random;
import java.io.Serializable;
-import org.apache.harmony.math.internal.nls.Messages;
-
/**
* This class represents immutable integer numbers of arbitrary length. Large
* numbers are typically used in security applications and therefore BigIntegers
@@ -220,8 +218,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger(int numBits, Random rnd) {
if (numBits < 0) {
- // math.1B=numBits must be non-negative
- throw new IllegalArgumentException(Messages.getString("math.1B")); //$NON-NLS-1$
+ throw new IllegalArgumentException("numBits must be non-negative");
}
if (numBits == 0) {
sign = 0;
@@ -265,8 +262,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger(int bitLength, int certainty, Random rnd) {
if (bitLength < 2) {
- // math.1C=bitLength < 2
- throw new ArithmeticException(Messages.getString("math.1C")); //$NON-NLS-1$
+ throw new ArithmeticException("bitLength < 2");
}
bigInt = BigInt.generatePrimeDefault(bitLength, rnd, null);
bigIntIsValid = true;
@@ -327,12 +323,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
// !oldReprIsValid
} else {
if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) {
- // math.11=Radix out of range
- throw new NumberFormatException(Messages.getString("math.11")); //$NON-NLS-1$
+ throw new NumberFormatException("Radix out of range");
}
if (val.length() == 0) {
- // math.12=Zero length BigInteger
- throw new NumberFormatException(Messages.getString("math.12")); //$NON-NLS-1$
+ throw new NumberFormatException("Zero-length BigInteger");
}
BigInteger.setFromString(this, val, radix);
// oldReprIsValid == true;
@@ -361,15 +355,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
if (magnitude == null) {
throw new NullPointerException();
}
- if ((signum < -1) || (signum > 1)) {
- // math.13=Invalid signum value
- throw new NumberFormatException(Messages.getString("math.13")); //$NON-NLS-1$
+ if (signum < -1 || signum > 1) {
+ throw new NumberFormatException("Invalid signum value");
}
if (signum == 0) {
for (byte element : magnitude) {
if (element != 0) {
- // math.14=signum-magnitude mismatch
- throw new NumberFormatException(Messages.getString("math.14")); //$NON-NLS-1$
+ throw new NumberFormatException("signum-magnitude mismatch");
}
}
}
@@ -393,8 +385,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger(byte[] val) {
if (val.length == 0) {
- // math.12=Zero length BigInteger
- throw new NumberFormatException(Messages.getString("math.12")); //$NON-NLS-1$
+ throw new NumberFormatException("Zero-length BigInteger");
}
bigInt = new BigInt();
bigInt.putBigEndianTwosComplement(val);
@@ -600,8 +591,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public boolean testBit(int n) {
if (n < 0) {
- // math.15=Negative bit address
- throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
+ throw new ArithmeticException("n < 0");
}
int sign = signum();
if ((sign > 0) && bigIntIsValid && !oldReprIsValid) {
@@ -700,8 +690,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
public BigInteger flipBit(int n) {
establishOldRepresentation("flipBit");
if (n < 0) {
- // math.15=Negative bit address
- throw new ArithmeticException(Messages.getString("math.15")); //$NON-NLS-1$
+ throw new ArithmeticException("n < 0");
}
return BitLevel.flipBit(this, n);
}
@@ -1062,8 +1051,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger pow(int exp) {
if (exp < 0) {
- // math.16=Negative exponent
- throw new ArithmeticException(Messages.getString("math.16")); //$NON-NLS-1$
+ throw new ArithmeticException("exp < 0");
}
validate1("pow", this);
return new BigInteger(BigInt.exp(bigInt, exp, null));
@@ -1151,8 +1139,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger modInverse(BigInteger m) {
if (m.signum() <= 0) {
- // math.18=BigInteger: modulus not positive
- throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
+ throw new ArithmeticException("modulus not positive");
}
validate2("modInverse", this, m);
return new BigInteger(BigInt.modInverse(bigInt, m.bigInt, null));
@@ -1179,8 +1166,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger modPow(BigInteger exponent, BigInteger m) {
if (m.signum() <= 0) {
- // math.18=BigInteger: modulus not positive
- throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
+ throw new ArithmeticException("modulus not positive");
}
BigInteger base;
if (exponent.signum() < 0) {
@@ -1210,8 +1196,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*/
public BigInteger mod(BigInteger m) {
if (m.signum() <= 0) {
- // math.18=BigInteger: modulus not positive
- throw new ArithmeticException(Messages.getString("math.18")); //$NON-NLS-1$
+ throw new ArithmeticException("modulus not positive");
}
validate2("mod", this, m);
return new BigInteger(BigInt.modulus(bigInt, m.bigInt, null));
@@ -1239,14 +1224,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* a {@code BigInteger} instance. The probability that the returned {@code
* BigInteger} is prime is beyond (1-1/2^80).
*
- * @return smallest integer > {@code this} which is robably prime.
+ * @return smallest integer > {@code this} which is probably prime.
* @throws ArithmeticException
* if {@code this < 0}.
*/
public BigInteger nextProbablePrime() {
if (sign < 0) {
- // math.1A=start < 0: {0}
- throw new ArithmeticException(Messages.getString("math.1A", this)); //$NON-NLS-1$
+ throw new ArithmeticException("sign < 0");
}
return Primality.nextProbablePrime(this);
}
diff --git a/math/src/main/java/java/math/Division.java b/math/src/main/java/java/math/Division.java
index ce2519d..e93da7e 100644
--- a/math/src/main/java/java/math/Division.java
+++ b/math/src/main/java/java/math/Division.java
@@ -17,10 +17,6 @@
package java.math;
-// BEGIN android-removed
-// import org.apache.harmony.math.internal.nls.Messages;
-// END android-removed
-
/**
* Static library that provides all operations related with division and modular
* arithmetic to {@link BigInteger}. Some methods are provided in both mutable
diff --git a/math/src/main/java/java/math/MathContext.java b/math/src/main/java/java/math/MathContext.java
index cf1d4eb..ba33a88 100644
--- a/math/src/main/java/java/math/MathContext.java
+++ b/math/src/main/java/java/math/MathContext.java
@@ -22,8 +22,6 @@ import java.io.ObjectInputStream;
import java.io.Serializable;
import java.io.StreamCorruptedException;
-import org.apache.harmony.math.internal.nls.Messages;
-
/**
* Immutable objects describing settings such as rounding mode and digit
* precision for the numerical operations provided by class {@link BigDecimal}.
@@ -130,12 +128,10 @@ public final class MathContext implements Serializable {
*/
public MathContext(int precision, RoundingMode roundingMode) {
if (precision < 0) {
- // math.0C=Digits < 0
- throw new IllegalArgumentException(Messages.getString("math.0C")); //$NON-NLS-1$
+ throw new IllegalArgumentException("precision < 0");
}
if (roundingMode == null) {
- // math.0D=null RoundingMode
- throw new NullPointerException(Messages.getString("math.0D")); //$NON-NLS-1$
+ throw new NullPointerException("roundingMode == null");
}
this.precision = precision;
this.roundingMode = roundingMode;
@@ -162,8 +158,7 @@ public final class MathContext implements Serializable {
int digit; // It will contain the digit parsed
if ((charVal.length < 27) || (charVal.length > 45)) {
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
// Parsing "precision=" String
for (i = 0; (i < chPrecision.length) && (charVal[i] == chPrecision[i]); i++) {
@@ -171,14 +166,12 @@ public final class MathContext implements Serializable {
}
if (i < chPrecision.length) {
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
// Parsing the value for "precision="...
digit = Character.digit(charVal[i], 10);
if (digit == -1) {
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
// BEGIN android-changed
this.precision = digit;
@@ -194,14 +187,12 @@ public final class MathContext implements Serializable {
break;
}
// It isn't a valid digit, and isn't a white space
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
// Accumulating the value parsed
this.precision = this.precision * 10 + digit;
if (this.precision < 0) {
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
i++;
} while (true);
@@ -212,8 +203,7 @@ public final class MathContext implements Serializable {
}
if (j < chRoundingMode.length) {
- // math.0E=bad string format
- throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Bad string format");
}
// Parsing the value for "roundingMode"...
this.roundingMode = RoundingMode.valueOf(String.valueOf(charVal, i,
@@ -314,16 +304,13 @@ public final class MathContext implements Serializable {
* @throws StreamCorruptedException
* if {@code roundingMode == null}
*/
- private void readObject(ObjectInputStream s) throws IOException,
- ClassNotFoundException {
+ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
if (precision < 0) {
- // math.0F=bad precision value
- throw new StreamCorruptedException(Messages.getString("math.0F")); //$NON-NLS-1$
+ throw new StreamCorruptedException("precision < 0");
}
if (roundingMode == null) {
- // math.10=null roundingMode
- throw new StreamCorruptedException(Messages.getString("math.10")); //$NON-NLS-1$
+ throw new StreamCorruptedException("roundingMode == null");
}
}
diff --git a/math/src/main/java/java/math/Multiplication.java b/math/src/main/java/java/math/Multiplication.java
index 05c4605..25fd31c 100644
--- a/math/src/main/java/java/math/Multiplication.java
+++ b/math/src/main/java/java/math/Multiplication.java
@@ -17,8 +17,6 @@
package java.math;
-import org.apache.harmony.math.internal.nls.Messages;
-
/**
* Static library that provides all multiplication of {@link BigInteger} methods.
*/
@@ -142,8 +140,7 @@ class Multiplication {
long byteArraySize = 1 + (long)(exp / 2.4082399653118496);
if (byteArraySize > Runtime.getRuntime().freeMemory()) {
- // math.01=power of ten too big
- throw new OutOfMemoryError(Messages.getString("math.01")); //$NON-NLS-1$
+ throw new OutOfMemoryError();
}
if (exp <= Integer.MAX_VALUE) {
// To calculate: 5^exp * 2^exp
diff --git a/math/src/main/java/java/math/RoundingMode.java b/math/src/main/java/java/math/RoundingMode.java
index b51564f..f4c181e 100644
--- a/math/src/main/java/java/math/RoundingMode.java
+++ b/math/src/main/java/java/math/RoundingMode.java
@@ -17,8 +17,6 @@
package java.math;
-import org.apache.harmony.math.internal.nls.Messages;
-
/**
* Specifies the rounding behavior for operations whose results cannot be
* represented exactly.
@@ -118,8 +116,7 @@ public enum RoundingMode {
case BigDecimal.ROUND_UP:
return UP;
default:
- // math.00=Invalid rounding mode
- throw new IllegalArgumentException(Messages.getString("math.00")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid rounding mode");
}
}
}
diff --git a/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java b/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java
deleted file mode 100644
index 4b0075a..0000000
--- a/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
- * All changes made to this file manually will be overwritten
- * if this tool runs again. Better make changes in the template file.
- */
-
-// BEGIN android-note
-// Redundant code has been removed and is now called from MsgHelp.
-// END android-note
-
-package org.apache.harmony.math.internal.nls;
-
-// BEGIN android-added
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-added
-
-/**
- * This class retrieves strings from a resource bundle and returns them,
- * formatting them with MessageFormat when required.
- * <p>
- * It is used by the system classes to provide national language support, by
- * looking up messages in the <code>
- * org.apache.harmony.math.internal.nls.messages
- * </code>
- * resource bundle. Note that if this file is not available, or an invalid key
- * is looked up, or resource bundle support is not available, the key itself
- * will be returned as the associated message. This means that the <em>KEY</em>
- * should a reasonable human-readable (english) string.
- *
- */
-public class Messages {
-
- // BEGIN android-changed
- private static final String sResource =
- "org.apache.harmony.math.internal.nls.messages";
- // END android-changed
-
- /**
- * Retrieves a message which has no arguments.
- *
- * @param msg
- * String the key to look up.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg) {
- // BEGIN android-changed
- return MsgHelp.getString(sResource, msg);
- // END android-changed
- }
-
- /**
- * Retrieves a message which takes 1 argument.
- *
- * @param msg
- * String the key to look up.
- * @param arg
- * Object the object to insert in the formatted output.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg, Object arg) {
- return getString(msg, new Object[] { arg });
- }
-
- /**
- * Retrieves a message which takes 1 integer argument.
- *
- * @param msg
- * String the key to look up.
- * @param arg
- * int the integer to insert in the formatted output.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg, int arg) {
- return getString(msg, new Object[] { Integer.toString(arg) });
- }
-
- /**
- * Retrieves a message which takes 1 character argument.
- *
- * @param msg
- * String the key to look up.
- * @param arg
- * char the character to insert in the formatted output.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg, char arg) {
- return getString(msg, new Object[] { String.valueOf(arg) });
- }
-
- /**
- * Retrieves a message which takes 2 arguments.
- *
- * @param msg
- * String the key to look up.
- * @param arg1
- * Object an object to insert in the formatted output.
- * @param arg2
- * Object another object to insert in the formatted output.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg, Object arg1, Object arg2) {
- return getString(msg, new Object[] { arg1, arg2 });
- }
-
- /**
- * Retrieves a message which takes several arguments.
- *
- * @param msg
- * String the key to look up.
- * @param args
- * Object[] the objects to insert in the formatted output.
- * @return String the message for that key in the system message bundle.
- */
- static public String getString(String msg, Object[] args) {
- // BEGIN android-changed
- return MsgHelp.getString(sResource, msg, args);
- // END android-changed
- }
-
- // BEGIN android-note
- // Duplicate code was dropped in favor of using MsgHelp.
- // END android-note
-}
diff --git a/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties b/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties
deleted file mode 100644
index 0a40a43..0000000
--- a/math/src/main/java/org/apache/harmony/math/internal/nls/messages.properties
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# messages for EN locale
-math.00=Invalid rounding mode
-math.01=power of ten too big
-math.02=Scale out of range.
-math.03=Infinite 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}