summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--luni/src/main/java/java/io/ObjectInputStream.java91
-rw-r--r--luni/src/main/java/java/lang/EnumConstantNotPresentException.java6
-rw-r--r--luni/src/main/java/java/util/Collections.java8
-rw-r--r--luni/src/main/java/java/util/Date.java66
-rw-r--r--luni/src/main/java/java/util/Properties.java17
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java12
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java38
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/internal/nls/Messages.java147
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties23
-rw-r--r--luni/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties23
-rw-r--r--luni/src/test/java/tests/api/java/util/CollectionsTest.java2
-rw-r--r--nio/src/main/java/java/nio/DirectByteBuffer.java4
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java3
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/Util.java162
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java11
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java45
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java44
-rw-r--r--nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties28
-rw-r--r--prefs/src/main/java/java/util/prefs/AbstractPreferences.java87
-rw-r--r--prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java13
-rw-r--r--prefs/src/main/java/java/util/prefs/Preferences.java12
-rw-r--r--prefs/src/main/java/java/util/prefs/XMLParser.java173
-rw-r--r--prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java140
-rw-r--r--prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties33
-rw-r--r--security/src/main/java/org/bouncycastle/x509/CertPathReviewerMessages_de.properties563
-rw-r--r--sql/src/main/java/java/sql/DriverManager.java49
-rw-r--r--sql/src/main/java/java/sql/SQLWarning.java4
-rw-r--r--sql/src/main/java/java/sql/Timestamp.java46
-rw-r--r--sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java146
-rw-r--r--sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties61
-rw-r--r--text/src/main/java/java/text/AttributedCharacterIterator.java18
-rw-r--r--text/src/main/java/java/text/AttributedString.java8
-rw-r--r--text/src/main/java/java/text/Bidi.java39
-rw-r--r--text/src/main/java/java/text/BreakIterator.java1
-rw-r--r--text/src/main/java/java/text/DateFormat.java69
-rw-r--r--text/src/main/java/java/text/Format.java22
-rw-r--r--text/src/main/java/java/text/MessageFormat.java139
-rw-r--r--text/src/main/java/java/text/NumberFormat.java119
-rw-r--r--text/src/main/java/java/text/RuleBasedCollator.java21
-rw-r--r--text/src/main/java/java/text/SimpleDateFormat.java56
-rw-r--r--text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java146
-rw-r--r--text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties49
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/internal/nls/Messages.java147
-rw-r--r--x-net/src/main/java/org/apache/harmony/xnet/internal/nls/messages.properties17
44 files changed, 481 insertions, 2427 deletions
diff --git a/luni/src/main/java/java/io/ObjectInputStream.java b/luni/src/main/java/java/io/ObjectInputStream.java
index 9d79641a..8af16e8 100644
--- a/luni/src/main/java/java/io/ObjectInputStream.java
+++ b/luni/src/main/java/java/io/ObjectInputStream.java
@@ -22,6 +22,7 @@ package java.io;
// yet migrated that API. As a consequence, there's a lot of changes here...
// END android-note
+import dalvik.system.VMStack;
import java.io.EmulatedFields.ObjectSlot;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
@@ -34,18 +35,7 @@ import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-
-// BEGIN android-added
-import dalvik.system.VMStack;
-// END android-added
-
-// BEGIN android-removed
-// import org.apache.harmony.misc.accessors.ObjectAccessor;
-// import org.apache.harmony.misc.accessors.AccessorFactory;
-// END android-removed
-
import org.apache.harmony.kernel.vm.VM;
-import org.apache.harmony.luni.internal.nls.Messages;
import org.apache.harmony.luni.util.Msg;
import org.apache.harmony.luni.util.PriviAction;
@@ -125,14 +115,14 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
new HashMap<String, Class<?>>();
static {
- PRIMITIVE_CLASSES.put("byte", byte.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("short", short.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("int", int.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("long", long.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("boolean", boolean.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("char", char.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("float", float.class); //$NON-NLS-1$
- PRIMITIVE_CLASSES.put("double", double.class); //$NON-NLS-1$
+ PRIMITIVE_CLASSES.put("byte", byte.class);
+ PRIMITIVE_CLASSES.put("short", short.class);
+ PRIMITIVE_CLASSES.put("int", int.class);
+ PRIMITIVE_CLASSES.put("long", long.class);
+ PRIMITIVE_CLASSES.put("boolean", boolean.class);
+ PRIMITIVE_CLASSES.put("char", char.class);
+ PRIMITIVE_CLASSES.put("float", float.class);
+ PRIMITIVE_CLASSES.put("double", double.class);
}
// BEGIN android-removed
@@ -406,7 +396,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
try {
Method method = implementationClass
.getMethod(
- "readFields", //$NON-NLS-1$
+ "readFields",
ObjectStreamClass.EMPTY_CONSTRUCTOR_PARAM_TYPES);
if (method.getDeclaringClass() != thisClass) {
return Boolean.TRUE;
@@ -416,7 +406,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
try {
Method method = implementationClass
.getMethod(
- "readUnshared", //$NON-NLS-1$
+ "readUnshared",
ObjectStreamClass.EMPTY_CONSTRUCTOR_PARAM_TYPES);
if (method.getDeclaringClass() != thisClass) {
return Boolean.TRUE;
@@ -694,11 +684,11 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
// Force buffer null check first!
if (offset > buffer.length || offset < 0) {
// K002e=Offset out of bounds \: {0}
- throw new ArrayIndexOutOfBoundsException(Msg.getString("K002e", offset)); //$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Msg.getString("K002e", offset));
}
if (length < 0 || length > buffer.length - offset) {
// K0031=Length out of bounds \: {0}
- throw new ArrayIndexOutOfBoundsException(Msg.getString("K0031", length)); //$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Msg.getString("K0031", length));
}
if (length == 0) {
return 0;
@@ -838,7 +828,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
return null;
default:
throw new StreamCorruptedException(Msg.getString(
- "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
+ "K00d2", Integer.toHexString(tc & 0xff)));
}
}
@@ -882,13 +872,13 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
return null;
case TC_EXCEPTION:
Exception exc = readException();
- throw new WriteAbortedException(Msg.getString("K00d3"), exc); //$NON-NLS-1$
+ throw new WriteAbortedException(Msg.getString("K00d3"), exc);
case TC_RESET:
resetState();
return null;
default:
throw new StreamCorruptedException(Msg.getString(
- "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
+ "K00d2", Integer.toHexString(tc & 0xff)));
}
}
@@ -936,14 +926,14 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
case TC_REFERENCE:
if (unshared) {
readNewHandle();
- throw new InvalidObjectException(Msg.getString("KA002")); //$NON-NLS-1$
+ throw new InvalidObjectException(Msg.getString("KA002"));
}
return readCyclicReference();
case TC_NULL:
return null;
case TC_EXCEPTION:
Exception exc = readException();
- throw new WriteAbortedException(Msg.getString("K00d3"), exc); //$NON-NLS-1$
+ throw new WriteAbortedException(Msg.getString("K00d3"), exc);
case TC_RESET:
resetState();
break;
@@ -954,7 +944,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
throw e;
default:
throw new StreamCorruptedException(Msg.getString(
- "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
+ "K00d2", Integer.toHexString(tc & 0xff)));
}
// Only TC_RESET falls through
} while (true);
@@ -1100,7 +1090,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
return classSig;
}
- while (classSig.startsWith("[L", start) //$NON-NLS-1$
+ while (classSig.startsWith("[L", start)
&& classSig.charAt(end - 1) == ';') {
start += 2;
end--;
@@ -1282,7 +1272,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
break;
default:
throw new StreamCorruptedException(Msg.getString(
- "K00d5", fieldDesc.getTypeCode())); //$NON-NLS-1$
+ "K00d5", fieldDesc.getTypeCode()));
}
// END android-changed
} catch (NoSuchFieldError err) {
@@ -1319,9 +1309,9 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
Class<?> valueType = toSet.getClass();
if (!fieldType.isAssignableFrom(valueType)) {
throw new ClassCastException(Msg.getString(
- "K00d4", new String[] { //$NON-NLS-1$
+ "K00d4", new String[] {
fieldType.toString(), valueType.toString(),
- classDesc.getName() + "." //$NON-NLS-1$
+ classDesc.getName() + "."
+ fieldName }));
}
try {
@@ -1625,7 +1615,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
- throw new InvalidClassException(Msg.getString("K00d1")); //$NON-NLS-1$
+ throw new InvalidClassException(Msg.getString("K00d1"));
}
Integer newHandle = nextHandle();
@@ -1683,7 +1673,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
}
} else {
throw new ClassNotFoundException(Msg.getString(
- "K00d7", classDesc.getName())); //$NON-NLS-1$
+ "K00d7", classDesc.getName()));
}
} else {
// Array of Objects
@@ -1727,7 +1717,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
}
return localClass;
}
- throw new InvalidClassException(Msg.getString("K00d1")); //$NON-NLS-1$
+ throw new InvalidClassException(Msg.getString("K00d1"));
}
/*
@@ -1746,7 +1736,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
return null;
default:
throw new StreamCorruptedException(Msg.getString(
- "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
+ "K00d2", Integer.toHexString(tc & 0xff)));
}
}
@@ -1769,7 +1759,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
if (0L != classDesc.getSerialVersionUID()
|| 0L != superClass.getSerialVersionUID()) {
throw new InvalidClassException(superClass.getName(), Msg
- .getString("K00da", superClass, //$NON-NLS-1$
+ .getString("K00da", superClass,
superClass));
}
byte tc = nextTC();
@@ -1797,7 +1787,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
case TC_REFERENCE:
if (unshared) {
readNewHandle();
- throw new InvalidObjectException(Msg.getString("KA002")); //$NON-NLS-1$
+ throw new InvalidObjectException(Msg.getString("KA002"));
}
name = (String) readCyclicReference();
break;
@@ -1904,14 +1894,11 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
* @throws IOException
* if an error occurs while reading from the source stream.
*/
- protected ObjectStreamClass readClassDescriptor() throws IOException,
- ClassNotFoundException {
-
+ protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
ObjectStreamClass newClassDesc = new ObjectStreamClass();
String name = input.readUTF();
if (name.length() == 0) {
- // luni.07 = The stream is corrupted
- throw new IOException(Messages.getString("luni.07")); //$NON-NLS-1$
+ throw new IOException("The stream is corrupted");
}
newClassDesc.setName(name);
newClassDesc.setSerialVersionUID(input.readLong());
@@ -2008,7 +1995,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
// Has to have an empty constructor
if (constructor == null) {
throw new InvalidClassException(constructorClass.getName(), Msg
- .getString("K00dc")); //$NON-NLS-1$
+ .getString("K00dc"));
}
int constructorModifiers = constructor.getModifiers();
@@ -2019,7 +2006,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
|| (wasExternalizable && !Modifier
.isPublic(constructorModifiers))) {
throw new InvalidClassException(constructorClass.getName(), Msg
- .getString("K00dc")); //$NON-NLS-1$
+ .getString("K00dc"));
}
// We know we are testing from a subclass, so the only other case
@@ -2032,7 +2019,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
// visibility. Check if same package
if (!inSamePackage(constructorClass, objectClass)) {
throw new InvalidClassException(constructorClass.getName(),
- Msg.getString("K00dc")); //$NON-NLS-1$
+ Msg.getString("K00dc"));
}
}
@@ -2066,7 +2053,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
- throw new InvalidClassException(Msg.getString("K00d1")); //$NON-NLS-1$
+ throw new InvalidClassException(Msg.getString("K00d1"));
}
Integer newHandle = nextHandle();
@@ -2453,7 +2440,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
Object res = objectsRead.get(handle);
if (res == UNSHARED_OBJ) {
- throw new InvalidObjectException(Msg.getString("KA010")); //$NON-NLS-1$
+ throw new InvalidObjectException(Msg.getString("KA010"));
}
return res;
@@ -2506,7 +2493,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
throw new NotActiveException();
}
if (object == null) {
- throw new InvalidObjectException(Msg.getString("K00d9")); //$NON-NLS-1$
+ throw new InvalidObjectException(Msg.getString("K00d9"));
}
// From now on it is just insertion in a SortedCollection. Since
// the Java class libraries don't provide that, we have to
@@ -2721,7 +2708,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
if (loadedStreamClass.getSerialVersionUID() != localStreamClass
.getSerialVersionUID()) {
throw new InvalidClassException(loadedStreamClass.getName(), Msg
- .getString("K00da", loadedStreamClass, //$NON-NLS-1$
+ .getString("K00da", loadedStreamClass,
localStreamClass));
}
@@ -2730,7 +2717,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput,
if (!loadedClassBaseName.equals(localClassBaseName)) {
throw new InvalidClassException(loadedStreamClass.getName(), Msg
- .getString("KA015", loadedClassBaseName, //$NON-NLS-1$
+ .getString("KA015", loadedClassBaseName,
localClassBaseName));
}
diff --git a/luni/src/main/java/java/lang/EnumConstantNotPresentException.java b/luni/src/main/java/java/lang/EnumConstantNotPresentException.java
index aec32d0..71923bb 100644
--- a/luni/src/main/java/java/lang/EnumConstantNotPresentException.java
+++ b/luni/src/main/java/java/lang/EnumConstantNotPresentException.java
@@ -43,10 +43,8 @@ public class EnumConstantNotPresentException extends RuntimeException {
* the missing constant name.
*/
@SuppressWarnings("unchecked")
- public EnumConstantNotPresentException(Class<? extends Enum> enumType,
- String constantName) {
- // luni.03=The enum constant {0}.{1} is missing
- super(Msg.getString("luni.03", enumType.getName(), constantName)); //$NON-NLS-1$
+ public EnumConstantNotPresentException(Class<? extends Enum> enumType, String constantName) {
+ super("enum constant " + enumType.getName() + "." + constantName + " is missing");
this.enumType = enumType;
this.constantName = constantName;
}
diff --git a/luni/src/main/java/java/util/Collections.java b/luni/src/main/java/java/util/Collections.java
index 9774888..7e96e10 100644
--- a/luni/src/main/java/java/util/Collections.java
+++ b/luni/src/main/java/java/util/Collections.java
@@ -22,8 +22,6 @@ import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.lang.reflect.Array;
-
-import org.apache.harmony.luni.internal.nls.Messages;
import org.apache.harmony.luni.util.Msg;
/**
@@ -2687,10 +2685,8 @@ public class Collections {
*/
static <E> E checkType(E obj, Class<? extends E> type) {
if (obj != null && !type.isInstance(obj)) {
- // luni.05=Attempt to insert {0} element into collection with
- // element type {1}
- throw new ClassCastException(Messages.getString(
- "luni.05", obj.getClass(), type)); //$NON-NLS-1$
+ throw new ClassCastException("Attempt to insert element of type " + obj.getClass() +
+ " into collection of type " + type);
}
return obj;
}
diff --git a/luni/src/main/java/java/util/Date.java b/luni/src/main/java/java/util/Date.java
index f69381a..90cd270 100644
--- a/luni/src/main/java/java/util/Date.java
+++ b/luni/src/main/java/java/util/Date.java
@@ -25,8 +25,6 @@ import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
-import org.apache.harmony.luni.internal.nls.Messages;
-
/**
* {@code Date} represents a specific moment in time, to the millisecond.
*
@@ -45,13 +43,6 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
private transient long milliseconds;
- private static String[] dayOfWeekNames = { "Sun", "Mon", "Tue", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "Wed", "Thu", "Fri", "Sat" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- private static String[] monthNames = { "Jan", "Feb", "Mar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "Apr", "May", "Jun", "Jul", //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "Aug", "Sep", "Oct", "Nov", "Dec"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-
/**
* Initializes this {@code Date} instance to the current time.
*/
@@ -377,10 +368,8 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
*/
@Deprecated
public static long parse(String string) {
-
if (string == null) {
- // luni.06=The string argument is null
- throw new IllegalArgumentException(Messages.getString("luni.06")); //$NON-NLS-1$
+ throw new IllegalArgumentException("The string argument is null");
}
char sign = 0;
@@ -415,7 +404,7 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
nextState = LETTERS;
} else if ('0' <= next && next <= '9') {
nextState = NUMBERS;
- } else if (!Character.isSpace(next) && ",+-:/".indexOf(next) == -1) { //$NON-NLS-1$
+ } else if (!Character.isSpace(next) && ",+-:/".indexOf(next) == -1) {
throw new IllegalArgumentException();
}
@@ -486,13 +475,13 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
if (text.length() == 1) {
throw new IllegalArgumentException();
}
- if (text.equals("AM")) { //$NON-NLS-1$
+ if (text.equals("AM")) {
if (hour == 12) {
hour = 0;
} else if (hour < 1 || hour > 12) {
throw new IllegalArgumentException();
}
- } else if (text.equals("PM")) { //$NON-NLS-1$
+ } else if (text.equals("PM")) {
if (hour == 12) {
hour = 0;
} else if (hour < 1 || hour > 12) {
@@ -505,10 +494,8 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
.getMonths();
int value;
if (parse(text, weekdays) != -1) {/* empty */
- } else if (month == -1
- && (month = parse(text, months)) != -1) {/* empty */
- } else if (text.equals("GMT") || text.equals("UT") //$NON-NLS-1$ //$NON-NLS-2$
- || text.equals("UTC")) { //$NON-NLS-1$
+ } else if (month == -1 && (month = parse(text, months)) != -1) {/* empty */
+ } else if (text.equals("GMT") || text.equals("UT") || text.equals("UTC")) {
zone = true;
zoneOffset = 0;
} else if ((value = zone(text)) != 0) {
@@ -676,10 +663,9 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
@Deprecated
public String toGMTString() {
// TODO: why does this insert the year manually instead of using one SimpleDateFormat?
- SimpleDateFormat format1 = new SimpleDateFormat("d MMM ", Locale.US); //$NON-NLS-1$
- SimpleDateFormat format2 = new SimpleDateFormat(
- " HH:mm:ss 'GMT'", Locale.US); //$NON-NLS-1$
- TimeZone gmtZone = TimeZone.getTimeZone("GMT"); //$NON-NLS-1$
+ SimpleDateFormat format1 = new SimpleDateFormat("d MMM ", Locale.US);
+ SimpleDateFormat format2 = new SimpleDateFormat(" HH:mm:ss 'GMT'", Locale.US);
+ TimeZone gmtZone = TimeZone.getTimeZone("GMT");
format1.setTimeZone(gmtZone);
format2.setTimeZone(gmtZone);
GregorianCalendar gc = new GregorianCalendar(gmtZone);
@@ -719,18 +705,22 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
// return new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(d);
Calendar cal = new GregorianCalendar(milliseconds);
TimeZone tz = cal.getTimeZone();
- return dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1] + " " + monthNames[cal.get(Calendar.MONTH)]//$NON-NLS-1$
- + " " + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)) + " " + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY))//$NON-NLS-1$ //$NON-NLS-2$
- + ":" + toTwoDigits(cal.get(Calendar.MINUTE)) + ":" + toTwoDigits(cal.get(Calendar.SECOND))//$NON-NLS-1$ //$NON-NLS-2$
- + " " + tz.getDisplayName(tz.inDaylightTime(this), TimeZone.SHORT) + " " + cal.get(Calendar.YEAR);//$NON-NLS-1$ //$NON-NLS-2$
+ return dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1] + " " + monthNames[cal.get(Calendar.MONTH)]
+ + " " + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)) + " " + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY))
+ + ":" + toTwoDigits(cal.get(Calendar.MINUTE)) + ":" + toTwoDigits(cal.get(Calendar.SECOND))
+ + " " + tz.getDisplayName(tz.inDaylightTime(this), TimeZone.SHORT) + " " + cal.get(Calendar.YEAR);
// END android-changed
}
+ private static final String[] dayOfWeekNames =
+ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+ private static final String[] monthNames =
+ { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
private String toTwoDigits(int n) {
if (n >= 10) {
- return Integer.toString(n);//$NON-NLS-1$
+ return Integer.toString(n);
} else {
- return "0" + n;//$NON-NLS-1$
+ return "0" + n;
}
}
@@ -760,34 +750,34 @@ public class Date implements Serializable, Cloneable, Comparable<Date> {
public static long UTC(int year, int month, int day, int hour, int minute,
int second) {
GregorianCalendar cal = new GregorianCalendar(false);
- cal.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
+ cal.setTimeZone(TimeZone.getTimeZone("GMT"));
cal.set(1900 + year, month, day, hour, minute, second);
return cal.getTimeInMillis();
}
private static int zone(String text) {
- if (text.equals("EST")) { //$NON-NLS-1$
+ if (text.equals("EST")) {
return -5;
}
- if (text.equals("EDT")) { //$NON-NLS-1$
+ if (text.equals("EDT")) {
return -4;
}
- if (text.equals("CST")) { //$NON-NLS-1$
+ if (text.equals("CST")) {
return -6;
}
- if (text.equals("CDT")) { //$NON-NLS-1$
+ if (text.equals("CDT")) {
return -5;
}
- if (text.equals("MST")) { //$NON-NLS-1$
+ if (text.equals("MST")) {
return -7;
}
- if (text.equals("MDT")) { //$NON-NLS-1$
+ if (text.equals("MDT")) {
return -6;
}
- if (text.equals("PST")) { //$NON-NLS-1$
+ if (text.equals("PST")) {
return -8;
}
- if (text.equals("PDT")) { //$NON-NLS-1$
+ if (text.equals("PDT")) {
return -7;
}
return 0;
diff --git a/luni/src/main/java/java/util/Properties.java b/luni/src/main/java/java/util/Properties.java
index 45bbb6f..f5bd8a7 100644
--- a/luni/src/main/java/java/util/Properties.java
+++ b/luni/src/main/java/java/util/Properties.java
@@ -32,26 +32,21 @@ import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.security.AccessController;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-
+import org.apache.harmony.luni.util.PriviAction;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.apache.harmony.luni.internal.nls.Messages;
-import org.apache.harmony.luni.util.PriviAction;
-
/**
* A {@code Properties} object is a {@code Hashtable} where the keys and values
* must be {@code String}s. Each property can have a default
diff --git a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java
index 4c51bdc..3491ccc 100644
--- a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java
+++ b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java
@@ -24,13 +24,10 @@ import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketException;
-
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
-import org.apache.harmony.luni.internal.nls.Messages;
-
/**
* An <code>HttpConnection</code> represents a persistent http or https connection and contains
* various utility methods to access that connection.
@@ -158,16 +155,15 @@ public class HttpConnection {
}
public SSLSocket getSecureSocket(SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier) throws IOException {
- if(!usingSecureSocket) {
+ if (!usingSecureSocket) {
String hostName = config.getHostName();
int port = config.getHostPort();
// create the wrapper over connected socket
- sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket,
- hostName, port, true);
+ sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket, hostName, port, true);
sslSocket.setUseClientMode(true);
sslSocket.startHandshake();
if (!hostnameVerifier.verify(hostName, sslSocket.getSession())) {
- throw new IOException(Messages.getString("luni.02", hostName)); //$NON-NLS-1$
+ throw new IOException("Hostname '" + hostName + "' was not verified");
}
usingSecureSocket = true;
}
@@ -268,4 +264,4 @@ public class HttpConnection {
}
}
-} \ No newline at end of file
+}
diff --git a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java
index 2ad5b13..401d74d 100644
--- a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java
+++ b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java
@@ -27,13 +27,10 @@ import java.security.Principal;
import java.security.cert.Certificate;
import java.util.List;
import java.util.Map;
-
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocket;
-
import org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl;
-import org.apache.harmony.luni.internal.nls.Messages;
/**
* HttpsURLConnection implementation.
@@ -55,45 +52,40 @@ public class HttpsURLConnectionImpl extends HttpsURLConnection {
super(url);
httpsEngine = new HttpsEngine(url, port, proxy);
}
-
- @Override
- public String getCipherSuite() {
+
+ private void checkConnected() {
if (sslSocket == null) {
- throw new IllegalStateException(Messages.getString("luni.00")); //$NON-NLS-1$
+ throw new IllegalStateException("Connection has not yet been established");
}
+ }
+
+ @Override
+ public String getCipherSuite() {
+ checkConnected();
return sslSocket.getSession().getCipherSuite();
}
@Override
public Certificate[] getLocalCertificates() {
- if (sslSocket == null) {
- throw new IllegalStateException(Messages.getString("luni.00")); //$NON-NLS-1$
- }
+ checkConnected();
return sslSocket.getSession().getLocalCertificates();
}
@Override
- public Certificate[] getServerCertificates()
- throws SSLPeerUnverifiedException {
- if (sslSocket == null) {
- throw new IllegalStateException(Messages.getString("luni.00")); //$NON-NLS-1$
- }
+ public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException {
+ checkConnected();
return sslSocket.getSession().getPeerCertificates();
}
@Override
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
- if (sslSocket == null) {
- throw new IllegalStateException(Messages.getString("luni.00")); //$NON-NLS-1$
- }
+ checkConnected();
return sslSocket.getSession().getPeerPrincipal();
}
@Override
public Principal getLocalPrincipal() {
- if (sslSocket == null) {
- throw new IllegalStateException(Messages.getString("luni.00")); //$NON-NLS-1$
- }
+ checkConnected();
return sslSocket.getSession().getLocalPrincipal();
}
@@ -382,8 +374,8 @@ public class HttpsURLConnectionImpl extends HttpsURLConnection {
method = save_meth;
}
if (!connected) {
- throw new IOException(Messages.getString("luni.01", //$NON-NLS-1$
- responseMessage, responseCode));
+ throw new IOException("Could not make SSL tunnel. " +
+ responseMessage + " (" + responseCode + ")");
}
// if there are some remaining data in the stream - read it out
InputStream is = connection.getInputStream();
diff --git a/luni/src/main/java/org/apache/harmony/luni/internal/nls/Messages.java b/luni/src/main/java/org/apache/harmony/luni/internal/nls/Messages.java
deleted file mode 100644
index f935a75..0000000
--- a/luni/src/main/java/org/apache/harmony/luni/internal/nls/Messages.java
+++ /dev/null
@@ -1,147 +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.luni.internal.nls;
-
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-// BEGIN android-changed
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-changed
-
-/**
- * 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.luni.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.luni.internal.nls.messages"; //$NON-NLS-1$
- // 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/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties b/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties
deleted file mode 100644
index 4b8ce5c..0000000
--- a/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties
+++ /dev/null
@@ -1,23 +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
-luni.00=Connection has not been established yet
-luni.01=Could not make SSL Tunneling. Got response: {0} ({1})
-luni.02=Hostname <{0}> was not verified
-luni.03=The enum constant {0}.{1} is missing
-luni.05=Attempt to insert {0} element into collection with element type {1}
-luni.06=The string argument is null
-luni.07=The stream is corrupted
diff --git a/luni/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties b/luni/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties
deleted file mode 100644
index 3c2e838..0000000
--- a/luni/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties
+++ /dev/null
@@ -1,23 +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
-misc.0=bad elemSize
-misc.1=Non primitive type {0}
-misc.2=array is already locked/pinned
-misc.3=lock failed
-misc.4=not an array Class
-misc.5=User code is not allowed to get accessors, caller class: {0}
-misc.6=Failed to get UTF-16 support, this is a bug
diff --git a/luni/src/test/java/tests/api/java/util/CollectionsTest.java b/luni/src/test/java/tests/api/java/util/CollectionsTest.java
index 7fc60d8..897b355 100644
--- a/luni/src/test/java/tests/api/java/util/CollectionsTest.java
+++ b/luni/src/test/java/tests/api/java/util/CollectionsTest.java
@@ -43,8 +43,6 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Arrays;
-import org.apache.harmony.luni.internal.nls.Messages;
-
import tests.support.Support_CollectionTest;
import tests.support.Support_ListTest;
import tests.support.Support_SetTest;
diff --git a/nio/src/main/java/java/nio/DirectByteBuffer.java b/nio/src/main/java/java/nio/DirectByteBuffer.java
index 9bf6813..3420f1a 100644
--- a/nio/src/main/java/java/nio/DirectByteBuffer.java
+++ b/nio/src/main/java/java/nio/DirectByteBuffer.java
@@ -227,9 +227,7 @@ abstract class DirectByteBuffer extends BaseByteBuffer implements DirectBuffer {
public final void addressValidityCheck() {
if (!isAddressValid()) {
- // nio.08=Cannot use the direct byte buffer after it has been
- // explicitly freed.
- throw new IllegalStateException(Messages.getString("nio.08")); //$NON-NLS-1$
+ throw new IllegalStateException("Cannot use a direct byte buffer after it has been explicitly freed");
}
}
diff --git a/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java b/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
index e44422d..59c2b3d 100644
--- a/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
+++ b/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
@@ -48,8 +48,7 @@ public class FileChannelFactory {
case IFileSystem.O_APPEND:
return new WriteOnlyFileChannel(stream, fd, true);
default:
- // nio.09=Unknown file channel type: {0}
- throw new RuntimeException(Messages.getString("nio.09", mode)); //$NON-NLS-1$
+ throw new RuntimeException("Unknown file channel type " + mode);
}
}
}
diff --git a/nio/src/main/java/org/apache/harmony/nio/Util.java b/nio/src/main/java/org/apache/harmony/nio/Util.java
deleted file mode 100644
index f895a51..0000000
--- a/nio/src/main/java/org/apache/harmony/nio/Util.java
+++ /dev/null
@@ -1,162 +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.
- */
-
-package org.apache.harmony.nio;
-
-import org.apache.harmony.nio.internal.nls.Messages;
-
-/*
- * Static methods. Used by io and nio packages.
- *
- */
-public final class Util {
-
- // -------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------
-
- /*
- * No instance.
- */
- private Util() {
- super();
- }
-
- // -------------------------------------------------------------------
- // Routine methods.
- // -------------------------------------------------------------------
-
- /*
- * Check array bounds method for methods like doSomething(Object[], offset,
- * length). Exception throws order is IndexOutOfBoundsException for negative
- * index, NullPointerException for null array, IndexOutOfBoundsException for
- * offset+length > array.length
- */
- public static void assertArrayIndex(Object[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(boolean[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(byte[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(short[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(int[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(long[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(float[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(double[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- public static void assertArrayIndex(char[] array, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > array.length) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-
- /*
- * Check array bounds method for methods like doSomething(Object[], offset,
- * length). Exception throws order is IndexOutOfBoundsException for negative
- * index, IndexOutOfBoundsException for offset+length > array.length
- */
- public static void assertArrayIndex(int arrayLength, int offset, int length) {
- if (offset < 0 || length < 0) {
- // nio.05=Negative index specified
- throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
- }
- if ((long) offset + (long) length > arrayLength) {
- // nio.04=Size mismatch
- throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
- }
- }
-}
diff --git a/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java b/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
index 9e72082..68b85b2 100644
--- a/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
+++ b/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
@@ -112,12 +112,10 @@ public abstract class FileChannelImpl extends FileChannel {
protected FileLock basicLock(long position, long size, boolean shared,
boolean wait) throws IOException {
- if ((position < 0) || (size < 0)) {
- // nio.0A=Lock position and size must be non-negative.
- throw new IllegalArgumentException(Messages.getString("nio.0A")); //$NON-NLS-1$
+ if (position < 0 || size < 0) {
+ throw new IllegalArgumentException("Lock position and size must be non-negative");
}
- int lockType = shared ? IFileSystem.SHARED_LOCK_TYPE
- : IFileSystem.EXCLUSIVE_LOCK_TYPE;
+ int lockType = shared ? IFileSystem.SHARED_LOCK_TYPE : IFileSystem.EXCLUSIVE_LOCK_TYPE;
FileLock pendingLock = new FileLockImpl(this, position, size, shared);
lockManager.addLock(pendingLock);
@@ -222,8 +220,7 @@ public abstract class FileChannelImpl extends FileChannel {
public FileChannel position(long newPosition) throws IOException {
openCheck();
if (newPosition < 0) {
- // nio.0B=New position must be non-negative.
- throw new IllegalArgumentException(Messages.getString("nio.0B")); //$NON-NLS-1$
+ throw new IllegalArgumentException("New position must be non-negative");
}
synchronized (repositioningLock) {
diff --git a/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java b/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
index 816afcf..8a98928 100644
--- a/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
+++ b/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
@@ -26,9 +26,6 @@ import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
-import org.apache.harmony.nio.Util;
-import org.apache.harmony.nio.internal.nls.Messages;
-
/**
* Static methods for I/O util. Used by io package and nio package.
*/
@@ -59,8 +56,16 @@ public final class IOUtil {
}
return chars.get();
}
- // nio.06=InputStreamReader is closed.
- throw new IOException(Messages.getString("nio.06")); //$NON-NLS-1$
+ throw new IOException("InputStreamReader is closed");
+ }
+ }
+
+ private static void assertArrayIndex(int arrayLength, int offset, int length) {
+ if (offset < 0 || length < 0) {
+ throw new IndexOutOfBoundsException("Negative index specified");
+ }
+ if ((long) offset + (long) length > arrayLength) {
+ throw new IndexOutOfBoundsException("Size mismatch");
}
}
@@ -75,7 +80,7 @@ public final class IOUtil {
if (length == 0) {
return 0;
}
- Util.assertArrayIndex(buf, offset, length);
+ assertArrayIndex(buf.length, offset, length);
// read at least once
if (chars.limit() == chars.position()) {
fillBuf(in, bytes, chars, decoder);
@@ -105,8 +110,7 @@ public final class IOUtil {
chars.position(chars.position() + needChars);
return length;
}
- // nio.06=InputStreamReader is closed.
- throw new IOException(Messages.getString("nio.06")); //$NON-NLS-1$
+ throw new IOException("InputStreamReader is closed");
}
}
@@ -143,11 +147,17 @@ public final class IOUtil {
public static void writeOutputStreamWriter(String str, int offset,
int count, OutputStream out, ByteBuffer bytes,
CharsetEncoder encoder, Object lock) throws IOException {
- Util.assertArrayIndex(str.length(), offset, count);
+ assertArrayIndex(str.length(), offset, count);
CharBuffer chars = CharBuffer.wrap(str, offset, count + offset);
convert(lock, encoder, bytes, chars, out);
}
+ private static void checkEncoder(CharsetEncoder encoder) throws IOException {
+ if (encoder == null) {
+ throw new IOException("Writer is closed");
+ }
+ }
+
/*
* Write method for OutputStreamWriter and Channels.
*/
@@ -155,10 +165,7 @@ public final class IOUtil {
ByteBuffer bytes, CharsetEncoder encoder, Object lock)
throws IOException {
synchronized (lock) {
- if (encoder == null) {
- // nio.07=Writer is closed.
- throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
- }
+ checkEncoder(encoder);
CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar });
convert(lock, encoder, bytes, chars, out);
}
@@ -170,7 +177,7 @@ public final class IOUtil {
public static void writeOutputStreamWriter(char[] buf, int offset,
int count, OutputStream out, ByteBuffer bytes,
CharsetEncoder encoder, Object lock) throws IOException {
- Util.assertArrayIndex(buf, offset, count);
+ assertArrayIndex(buf.length, offset, count);
CharBuffer chars = CharBuffer.wrap(buf, offset, count);
convert(lock, encoder, bytes, chars, out);
}
@@ -182,10 +189,7 @@ public final class IOUtil {
ByteBuffer bytes, CharsetEncoder encoder, Object lock)
throws IOException {
synchronized (lock) {
- if (encoder == null) {
- // nio.07=Writer is closed.
- throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
- }
+ checkEncoder(encoder);
int position;
if ((position = bytes.position()) > 0) {
bytes.flip();
@@ -203,10 +207,7 @@ public final class IOUtil {
ByteBuffer bytes, CharBuffer chars, OutputStream out)
throws IOException {
synchronized (lock) {
- if (encoder == null) {
- // nio.07=Writer is closed.
- throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
- }
+ checkEncoder(encoder);
CoderResult result = encoder.encode(chars, bytes, true);
while (true) {
if (result.isError()) {
diff --git a/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java b/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
index 40915f6..2c575a3 100644
--- a/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
+++ b/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
@@ -868,7 +868,7 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
throws SocketException {
checkOpen();
if (size < 1) {
- throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Msg.getString("K0035"));
}
socketImpl
.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
@@ -885,7 +885,7 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
public synchronized void setSendBufferSize(int size) throws SocketException {
checkOpen();
if (size < 1) {
- throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Msg.getString("K0035"));
}
socketImpl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size));
}
@@ -894,7 +894,7 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
public void setSoLinger(boolean on, int timeout) throws SocketException {
checkOpen();
if (on && timeout < 0) {
- throw new IllegalArgumentException(Msg.getString("K0045")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Msg.getString("K0045"));
}
int val = on ? (65535 < timeout ? 65535 : timeout) : -1;
socketImpl.setOption(SocketOptions.SO_LINGER, Integer.valueOf(val));
@@ -904,7 +904,7 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
public synchronized void setSoTimeout(int timeout) throws SocketException {
checkOpen();
if (timeout < 0) {
- throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$
+ throw new IllegalArgumentException(Msg.getString("K0036"));
}
socketImpl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
}
@@ -929,17 +929,9 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
*/
@Override
public OutputStream getOutputStream() throws IOException {
- if (!channel.isOpen()) {
- // nio.00=Socket is closed
- throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
- }
- if (!channel.isConnected()) {
- // nio.01=Socket is not connected
- throw new SocketException(Messages.getString("nio.01")); //$NON-NLS-1$
- }
+ checkOpenAndConnected();
if (isOutputShutdown()) {
- // nio.02=Socket output is shutdown
- throw new SocketException(Messages.getString("nio.02")); //$NON-NLS-1$
+ throw new SocketException("Socket output is shutdown");
}
return new SocketChannelOutputStream(channel);
}
@@ -949,28 +941,28 @@ class SocketChannelImpl extends SocketChannel implements FileDescriptorHandler {
*/
@Override
public InputStream getInputStream() throws IOException {
+ checkOpenAndConnected();
+ if (isInputShutdown()) {
+ throw new SocketException("Socket input is shutdown");
+ }
+ return new SocketChannelInputStream(channel);
+ }
+
+ private void checkOpenAndConnected() throws SocketException {
if (!channel.isOpen()) {
- // nio.00=Socket is closed
- throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
+ throw new SocketException("Socket is closed");
}
if (!channel.isConnected()) {
- // nio.01=Socket is not connected
- throw new SocketException(Messages.getString("nio.01")); //$NON-NLS-1$
- }
- if (isInputShutdown()) {
- // nio.03=Socket input is shutdown
- throw new SocketException(Messages.getString("nio.03")); //$NON-NLS-1$
+ throw new SocketException("Socket is not connected");
}
- return new SocketChannelInputStream(channel);
}
-
+
/*
* Checks whether the channel is open.
*/
private void checkOpen() throws SocketException {
if (isClosed()) {
- // nio.00=Socket is closed
- throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
+ throw new SocketException("Socket is closed");
}
}
diff --git a/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties b/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties
deleted file mode 100644
index 79d1c84..0000000
--- a/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties
+++ /dev/null
@@ -1,28 +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
-nio.00=Socket is closed
-nio.01=Socket is not connected
-nio.02=Socket output is shutdown
-nio.03=Socket input is shutdown
-nio.04=Size mismatch
-nio.05=Negative index specified
-nio.06=InputStreamReader is closed.
-nio.07=Writer is closed.
-nio.08=Cannot use the direct byte buffer after it has been explicitly freed.
-nio.09=Unknown file channel type: {0}
-nio.0A=Lock position and size must be non-negative.
-nio.0B=New position must be non-negative.
diff --git a/prefs/src/main/java/java/util/prefs/AbstractPreferences.java b/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
index 3264569..17ffbbb 100644
--- a/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
+++ b/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
@@ -31,7 +31,6 @@ import java.util.Map;
import java.util.TreeSet;
import org.apache.harmony.luni.util.Base64;
-import org.apache.harmony.prefs.internal.nls.Messages;
/**
* This abstract class is a partial implementation of the abstract class
@@ -51,7 +50,7 @@ public abstract class AbstractPreferences extends Preferences {
/** the unhandled events collection */
private static final List<EventObject> events = new LinkedList<EventObject>();
/** the event dispatcher thread */
- private static final EventDispatcher dispatcher = new EventDispatcher("Preference Event Dispatcher"); //$NON-NLS-1$
+ private static final EventDispatcher dispatcher = new EventDispatcher("Preference Event Dispatcher");
/*
* -----------------------------------------------------------
@@ -148,7 +147,7 @@ public abstract class AbstractPreferences extends Preferences {
* parent} is not {@code null}.
*/
protected AbstractPreferences(AbstractPreferences parent, String name) {
- if ((null == parent ^ name.length() == 0) || name.indexOf("/") >= 0) { //$NON-NLS-1$
+ if ((null == parent ^ name.length() == 0) || name.indexOf("/") >= 0) {
throw new IllegalArgumentException();
}
root = null == parent ? this : parent.root;
@@ -345,11 +344,11 @@ public abstract class AbstractPreferences extends Preferences {
@Override
public String absolutePath() {
if (parentPref == null) {
- return "/"; //$NON-NLS-1$
+ return "/";
} else if (parentPref == root) {
- return "/" + nodeName; //$NON-NLS-1$
+ return "/" + nodeName;
}
- return parentPref.absolutePath() + "/" + nodeName; //$NON-NLS-1$
+ return parentPref.absolutePath() + "/" + nodeName;
}
@Override
@@ -376,23 +375,18 @@ public abstract class AbstractPreferences extends Preferences {
}
@Override
- public void exportNode(OutputStream ostream) throws IOException,
- BackingStoreException {
- if(ostream == null) {
- // prefs.5=Stream is null
- throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
+ public void exportNode(OutputStream ostream) throws IOException, BackingStoreException {
+ if (ostream == null) {
+ throw new NullPointerException("Stream is null");
}
checkState();
XMLParser.exportPrefs(this, ostream, false);
-
}
@Override
- public void exportSubtree(OutputStream ostream) throws IOException,
- BackingStoreException {
- if(ostream == null) {
- // prefs.5=Stream is null
- throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
+ public void exportSubtree(OutputStream ostream) throws IOException, BackingStoreException {
+ if (ostream == null) {
+ throw new NullPointerException("Stream is null");
}
checkState();
XMLParser.exportPrefs(this, ostream, true);
@@ -433,9 +427,9 @@ public abstract class AbstractPreferences extends Preferences {
if (result == null) {
return deflt;
}
- if ("true".equalsIgnoreCase(result)) { //$NON-NLS-1$
+ if ("true".equalsIgnoreCase(result)) {
return true;
- } else if ("false".equalsIgnoreCase(result)) { //$NON-NLS-1$
+ } else if ("false".equalsIgnoreCase(result)) {
return false;
} else {
return deflt;
@@ -452,7 +446,7 @@ public abstract class AbstractPreferences extends Preferences {
return new byte[0];
}
try {
- byte[] bavalue = svalue.getBytes("US-ASCII"); //$NON-NLS-1$
+ byte[] bavalue = svalue.getBytes("US-ASCII");
if (bavalue.length % 4 != 0) {
return deflt;
}
@@ -538,12 +532,12 @@ public abstract class AbstractPreferences extends Preferences {
synchronized (lock) {
checkState();
validateName(name);
- if ("".equals(name)) { //$NON-NLS-1$
+ if ("".equals(name)) {
return this;
- } else if ("/".equals(name)) { //$NON-NLS-1$
+ } else if ("/".equals(name)) {
return root;
}
- if (name.startsWith("/")) { //$NON-NLS-1$
+ if (name.startsWith("/")) {
startNode = root;
name = name.substring(1);
} else {
@@ -559,13 +553,11 @@ public abstract class AbstractPreferences extends Preferences {
}
private void validateName(String name) {
- if (name.endsWith("/") && name.length() > 1) { //$NON-NLS-1$
- // prefs.6=Name cannot end with '/'\!
- throw new IllegalArgumentException(Messages.getString("prefs.6")); //$NON-NLS-1$
+ if (name.endsWith("/") && name.length() > 1) {
+ throw new IllegalArgumentException("Name cannot end with '/'");
}
- if (name.indexOf("//") >= 0) { //$NON-NLS-1$
- // prefs.7=Name cannot contains consecutive '/'\!
- throw new IllegalArgumentException(Messages.getString("prefs.7")); //$NON-NLS-1$
+ if (name.indexOf("//") >= 0) {
+ throw new IllegalArgumentException("Name cannot contain consecutive '/' characters");
}
}
@@ -593,12 +585,9 @@ public abstract class AbstractPreferences extends Preferences {
}
private AbstractPreferences getNodeFromBackend(boolean createNew,
- AbstractPreferences currentNode, String name)
- throws BackingStoreException {
+ AbstractPreferences currentNode, String name) throws BackingStoreException {
if (name.length() > MAX_NAME_LENGTH) {
- // prefs.8=Name length is too long: {0}
- throw new IllegalArgumentException(Messages.getString("prefs.8", //$NON-NLS-1$
- name));
+ throw new IllegalArgumentException("Name '" + name + "' too long");
}
AbstractPreferences temp;
if (createNew) {
@@ -621,17 +610,16 @@ public abstract class AbstractPreferences extends Preferences {
AbstractPreferences startNode = null;
synchronized (lock) {
if (isRemoved()) {
- if ("".equals(name)) { //$NON-NLS-1$
+ if (name.isEmpty()) {
return false;
}
- // prefs.9=This node has been removed\!
- throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
+ throw new IllegalStateException("This node has been removed");
}
validateName(name);
- if ("".equals(name) || "/".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (name.isEmpty() || "/".equals(name)) {
return true;
}
- if (name.startsWith("/")) { //$NON-NLS-1$
+ if (name.startsWith("/")) {
startNode = root;
name = name.substring(1);
} else {
@@ -654,8 +642,7 @@ public abstract class AbstractPreferences extends Preferences {
private void checkState() {
if (isRemoved()) {
- // prefs.9=This node has been removed\!
- throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
+ throw new IllegalStateException("This node has been removed");
}
}
@@ -683,7 +670,7 @@ public abstract class AbstractPreferences extends Preferences {
@Override
public void putByteArray(String key, byte[] value) {
try {
- put(key, Base64.encode(value, "US-ASCII")); //$NON-NLS-1$
+ put(key, Base64.encode(value, "US-ASCII"));
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e);
}
@@ -725,8 +712,7 @@ public abstract class AbstractPreferences extends Preferences {
@Override
public void removeNode() throws BackingStoreException {
if (root == this) {
- // prefs.A=Cannot remove root node\!
- throw new UnsupportedOperationException(Messages.getString("prefs.A")); //$NON-NLS-1$
+ throw new UnsupportedOperationException("Cannot remove root node");
}
synchronized (parentPref.lock) {
removeNodeImpl();
@@ -810,18 +796,16 @@ public abstract class AbstractPreferences extends Preferences {
checkState();
syncSpi();
}
- AbstractPreferences[] cc = cachedChildren();
- int i;
- for (i = 0; i < cc.length; i++) {
- cc[i].sync();
+ for (AbstractPreferences child : cachedChildren()) {
+ child.sync();
}
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append(isUserNode() ? "User" : "System"); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append(" Preference Node: "); //$NON-NLS-1$
+ sb.append(isUserNode() ? "User" : "System");
+ sb.append(" Preference Node: ");
sb.append(absolutePath());
return sb.toString();
}
@@ -843,8 +827,7 @@ public abstract class AbstractPreferences extends Preferences {
}
private void notifyPreferenceChange(String key, String newValue) {
- PreferenceChangeEvent pce = new PreferenceChangeEvent(this, key,
- newValue);
+ PreferenceChangeEvent pce = new PreferenceChangeEvent(this, key, newValue);
synchronized (events) {
events.add(pce);
events.notifyAll();
diff --git a/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java b/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
index f6e5e8f..1eb11e3 100644
--- a/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
+++ b/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
@@ -25,8 +25,6 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
-import org.apache.harmony.prefs.internal.nls.Messages;
-
/**
* The default implementation of <code>AbstractPreferences</code> for the Linux
* platform, using the file system as its back end.
@@ -44,7 +42,7 @@ class FilePreferencesImpl extends AbstractPreferences {
*/
//prefs file name
- private static final String PREFS_FILE_NAME = "prefs.xml"; //$NON-NLS-1$
+ private static final String PREFS_FILE_NAME = "prefs.xml";
//home directory for user prefs
private static String USER_HOME;
@@ -102,7 +100,7 @@ class FilePreferencesImpl extends AbstractPreferences {
* user root if userNode is true, system root otherwise
*/
FilePreferencesImpl(boolean userNode) {
- super(null, ""); //$NON-NLS-1$
+ super(null, "");
this.userNode = userNode;
path = userNode ? USER_HOME : SYSTEM_HOME;
initPrefs();
@@ -142,9 +140,7 @@ class FilePreferencesImpl extends AbstractPreferences {
}
});
if (null == names) {// file is not a directory, exception case
- // prefs.3=Cannot get children names for {0}!
- throw new BackingStoreException(
- Messages.getString("prefs.3", toString())); //$NON-NLS-1$
+ throw new BackingStoreException("Cannot get child names for " + toString());
}
return names;
}
@@ -218,8 +214,7 @@ class FilePreferencesImpl extends AbstractPreferences {
}
})).booleanValue();
if (!removeSucceed) {
- // prefs.4=Cannot remove {0}!
- throw new BackingStoreException(Messages.getString("prefs.4", toString())); //$NON-NLS-1$
+ throw new BackingStoreException("Cannot remove " + toString());
}
}
diff --git a/prefs/src/main/java/java/util/prefs/Preferences.java b/prefs/src/main/java/java/util/prefs/Preferences.java
index e79d9eb..9a1d9e6 100644
--- a/prefs/src/main/java/java/util/prefs/Preferences.java
+++ b/prefs/src/main/java/java/util/prefs/Preferences.java
@@ -24,7 +24,6 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
import java.util.ServiceLoader;
-import org.apache.harmony.prefs.internal.nls.Messages;
/**
* An instance of the class {@code Preferences} represents one node in a
@@ -75,7 +74,7 @@ import org.apache.harmony.prefs.internal.nls.Messages;
* {@code Preferences} type developed. Every J2SE implementation must provide a
* default implementation for every supported platform, and must also provide a
* means of replacing the default implementation. This implementation uses the
- * system property {@code java.util.prefs.PreferencesFactory} to detemine which
+ * system property {@code java.util.prefs.PreferencesFactory} to determine which
* preferences implementation to use.
* <p>
* The methods of this class are thread-safe. If multiple JVMs are using the
@@ -450,9 +449,8 @@ public abstract class Preferences {
*/
public static void importPreferences (InputStream istream) throws InvalidPreferencesFormatException, IOException {
checkSecurity();
- if(null == istream){
- // prefs.0=Inputstream cannot be null\!
- throw new MalformedURLException(Messages.getString("prefs.0")); //$NON-NLS-1$
+ if (istream == null){
+ throw new MalformedURLException("Inputstream cannot be null");
}
XMLParser.importPrefs(istream);
}
@@ -868,9 +866,9 @@ public abstract class Preferences {
private static String getNodeName(Class<?> c){
Package p = c.getPackage();
if(null == p){
- return "/<unnamed>"; //$NON-NLS-1$
+ return "/<unnamed>";
}
- return "/"+p.getName().replace('.', '/'); //$NON-NLS-1$
+ return "/"+p.getName().replace('.', '/');
}
/**
diff --git a/prefs/src/main/java/java/util/prefs/XMLParser.java b/prefs/src/main/java/java/util/prefs/XMLParser.java
index 09dc7bc..986429d 100644
--- a/prefs/src/main/java/java/util/prefs/XMLParser.java
+++ b/prefs/src/main/java/java/util/prefs/XMLParser.java
@@ -33,23 +33,17 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
import java.util.Properties;
import java.util.StringTokenizer;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
-// BEGIN android-removed
-// import javax.xml.transform.TransformerException;
-// END android-removed
-
-import org.apache.harmony.prefs.internal.nls.Messages;
-// BEGIN android-removed
-// import org.apache.xpath.XPathAPI;
-// END android-removed
import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
@@ -57,12 +51,6 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-// BEGIN android-added
-import java.util.ArrayList;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Node;
-// END android-added
-
/**
* Utility class for the Preferences import/export from XML file.
*/
@@ -71,31 +59,31 @@ class XMLParser {
/*
* Constant - the specified DTD URL
*/
- static final String PREFS_DTD_NAME = "http://java.sun.com/dtd/preferences.dtd"; //$NON-NLS-1$
+ static final String PREFS_DTD_NAME = "http://java.sun.com/dtd/preferences.dtd";
/*
* Constant - the DTD string
*/
- static final String PREFS_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" //$NON-NLS-1$
- + " <!ELEMENT preferences (root)>" //$NON-NLS-1$
- + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >" //$NON-NLS-1$
- + " <!ELEMENT root (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST root type (system|user) #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT node (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST node name CDATA #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT map (entry*) >" //$NON-NLS-1$
- + " <!ELEMENT entry EMPTY >" //$NON-NLS-1$
- + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >"; //$NON-NLS-1$
+ static final String PREFS_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + " <!ELEMENT preferences (root)>"
+ + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >"
+ + " <!ELEMENT root (map, node*) >"
+ + " <!ATTLIST root type (system|user) #REQUIRED >"
+ + " <!ELEMENT node (map, node*) >"
+ + " <!ATTLIST node name CDATA #REQUIRED >"
+ + " <!ELEMENT map (entry*) >"
+ + " <!ELEMENT entry EMPTY >"
+ + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >";
/*
* Constant - the specified header
*/
- static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
+ static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
/*
* Constant - the specified DOCTYPE
*/
- static final String DOCTYPE = "<!DOCTYPE preferences SYSTEM"; //$NON-NLS-1$
+ static final String DOCTYPE = "<!DOCTYPE preferences SYSTEM";
/*
* empty string array constant
@@ -105,7 +93,7 @@ class XMLParser {
/*
* Constant - used by FilePreferencesImpl, which is default implementation of Linux platform
*/
- private static final String FILE_PREFS = "<!DOCTYPE map SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>"; //$NON-NLS-1$
+ private static final String FILE_PREFS = "<!DOCTYPE map SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>";
/*
* Constant - specify the DTD version
@@ -144,9 +132,7 @@ class XMLParser {
result.setSystemId(PREFS_DTD_NAME);
return result;
}
- // prefs.1=Invalid DOCTYPE declaration: {0}
- throw new SAXException(
- Messages.getString("prefs.1", systemId)); //$NON-NLS-1$
+ throw new SAXException("Invalid DOCTYPE declaration " + systemId);
}
});
builder.setErrorHandler(new ErrorHandler() {
@@ -179,37 +165,35 @@ class XMLParser {
out.newLine();
out.write(DOCTYPE);
- out.write(" '"); //$NON-NLS-1$
+ out.write(" '");
out.write(PREFS_DTD_NAME);
- out.write("'>"); //$NON-NLS-1$
+ out.write("'>");
out.newLine();
out.newLine();
- flushStartTag(
- "preferences", new String[] { "EXTERNAL_XML_VERSION" }, new String[] { String.valueOf(XML_VERSION) }, out); //$NON-NLS-1$ //$NON-NLS-2$
- flushStartTag(
- "root", new String[] { "type" }, new String[] { prefs.isUserNode() ? "user" : "system" }, out); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- flushEmptyElement("map", out); //$NON-NLS-1$
+ flushStartTag("preferences", new String[] { "EXTERNAL_XML_VERSION" },
+ new String[] { String.valueOf(XML_VERSION) }, out);
+ flushStartTag("root", new String[] { "type" },
+ new String[] { prefs.isUserNode() ? "user" : "system" }, out);
+ flushEmptyElement("map", out);
- StringTokenizer ancestors = new StringTokenizer(prefs.absolutePath(),
- "/"); //$NON-NLS-1$
+ StringTokenizer ancestors = new StringTokenizer(prefs.absolutePath(), "/");
exportNode(ancestors, prefs, withSubTree, out);
- flushEndTag("root", out); //$NON-NLS-1$
- flushEndTag("preferences", out); //$NON-NLS-1$
+ flushEndTag("root", out);
+ flushEndTag("preferences", out);
out.flush();
out = null;
}
private static void exportNode(StringTokenizer ancestors,
Preferences prefs, boolean withSubTree, BufferedWriter out)
- throws IOException, BackingStoreException {
+ throws IOException, BackingStoreException {
if (ancestors.hasMoreTokens()) {
String name = ancestors.nextToken();
- flushStartTag(
- "node", new String[] { "name" }, new String[] { name }, out); //$NON-NLS-1$ //$NON-NLS-2$
+ flushStartTag("node", new String[] { "name" }, new String[] { name }, out);
if (ancestors.hasMoreTokens()) {
- flushEmptyElement("map", out); //$NON-NLS-1$
+ flushEmptyElement("map", out);
exportNode(ancestors, prefs, withSubTree, out);
} else {
exportEntries(prefs, out);
@@ -217,7 +201,7 @@ class XMLParser {
exportSubTree(prefs, out);
}
}
- flushEndTag("node", out); //$NON-NLS-1$
+ flushEndTag("node", out);
}
}
@@ -227,11 +211,10 @@ class XMLParser {
if (names.length > 0) {
for (int i = 0; i < names.length; i++) {
Preferences child = prefs.node(names[i]);
- flushStartTag(
- "node", new String[] { "name" }, new String[] { names[i] }, out); //$NON-NLS-1$ //$NON-NLS-2$
+ flushStartTag("node", new String[] { "name" }, new String[] { names[i] }, out);
exportEntries(child, out);
exportSubTree(child, out);
- flushEndTag("node", out); //$NON-NLS-1$
+ flushEndTag("node", out);
}
}
}
@@ -249,34 +232,34 @@ class XMLParser {
private static void exportEntries(String[] keys, String[] values,
BufferedWriter out) throws IOException {
if (keys.length == 0) {
- flushEmptyElement("map", out); //$NON-NLS-1$
+ flushEmptyElement("map", out);
return;
}
- flushStartTag("map", out); //$NON-NLS-1$
+ flushStartTag("map", out);
for (int i = 0; i < keys.length; i++) {
if (values[i] != null) {
- flushEmptyElement(
- "entry", new String[] { "key", "value" }, new String[] { keys[i], values[i] }, out); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ flushEmptyElement("entry", new String[] { "key", "value" },
+ new String[] { keys[i], values[i] }, out);
}
}
- flushEndTag("map", out); //$NON-NLS-1$
+ flushEndTag("map", out);
}
private static void flushEndTag(String tagName, BufferedWriter out)
throws IOException {
flushIndent(indent--, out);
- out.write("</"); //$NON-NLS-1$
+ out.write("</");
out.write(tagName);
- out.write(">"); //$NON-NLS-1$
+ out.write(">");
out.newLine();
}
private static void flushEmptyElement(String tagName, BufferedWriter out)
throws IOException {
flushIndent(++indent, out);
- out.write("<"); //$NON-NLS-1$
+ out.write("<");
out.write(tagName);
- out.write(" />"); //$NON-NLS-1$
+ out.write(" />");
out.newLine();
indent--;
}
@@ -284,10 +267,10 @@ class XMLParser {
private static void flushEmptyElement(String tagName, String[] attrKeys,
String[] attrValues, BufferedWriter out) throws IOException {
flushIndent(++indent, out);
- out.write("<"); //$NON-NLS-1$
+ out.write("<");
out.write(tagName);
flushPairs(attrKeys, attrValues, out);
- out.write(" />"); //$NON-NLS-1$
+ out.write(" />");
out.newLine();
indent--;
}
@@ -295,37 +278,37 @@ class XMLParser {
private static void flushPairs(String[] attrKeys, String[] attrValues,
BufferedWriter out) throws IOException {
for (int i = 0; i < attrKeys.length; i++) {
- out.write(" "); //$NON-NLS-1$
+ out.write(" ");
out.write(attrKeys[i]);
- out.write("=\""); //$NON-NLS-1$
+ out.write("=\"");
out.write(htmlEncode(attrValues[i]));
- out.write("\""); //$NON-NLS-1$
+ out.write("\"");
}
}
private static void flushIndent(int ind, BufferedWriter out)
throws IOException {
for (int i = 0; i < ind; i++) {
- out.write(" "); //$NON-NLS-1$
+ out.write(" ");
}
}
private static void flushStartTag(String tagName, String[] attrKeys,
String[] attrValues, BufferedWriter out) throws IOException {
flushIndent(++indent, out);
- out.write("<"); //$NON-NLS-1$
+ out.write("<");
out.write(tagName);
flushPairs(attrKeys, attrValues, out);
- out.write(">"); //$NON-NLS-1$
+ out.write(">");
out.newLine();
}
private static void flushStartTag(String tagName, BufferedWriter out)
throws IOException {
flushIndent(++indent, out);
- out.write("<"); //$NON-NLS-1$
+ out.write("<");
out.write(tagName);
- out.write(">"); //$NON-NLS-1$
+ out.write(">");
out.newLine();
}
@@ -336,19 +319,19 @@ class XMLParser {
c = s.charAt(i);
switch (c) {
case '<':
- sb.append("&lt;"); //$NON-NLS-1$
+ sb.append("&lt;");
break;
case '>':
- sb.append("&gt;"); //$NON-NLS-1$
+ sb.append("&gt;");
break;
case '&':
- sb.append("&amp;"); //$NON-NLS-1$
+ sb.append("&amp;");
break;
case '\\':
- sb.append("&apos;"); //$NON-NLS-1$
+ sb.append("&apos;");
break;
case '"':
- sb.append("&quot;"); //$NON-NLS-1$
+ sb.append("&quot;");
break;
default:
sb.append(c);
@@ -360,8 +343,7 @@ class XMLParser {
/***************************************************************************
* utilities for Preferences import
**************************************************************************/
- static void importPrefs(InputStream in) throws IOException,
- InvalidPreferencesFormatException {
+ static void importPrefs(InputStream in) throws IOException, InvalidPreferencesFormatException {
try {
// load XML document
Document doc = builder.parse(new InputSource(in));
@@ -369,19 +351,18 @@ class XMLParser {
// check preferences' export version
Element preferences;
preferences = doc.getDocumentElement();
- String version = preferences.getAttribute("EXTERNAL_XML_VERSION"); //$NON-NLS-1$
+ String version = preferences.getAttribute("EXTERNAL_XML_VERSION");
if (version != null && Float.parseFloat(version) > XML_VERSION) {
- // prefs.2=This preferences exported version is not supported:{0}
- throw new InvalidPreferencesFormatException(
- Messages.getString("prefs.2", version)); //$NON-NLS-1$
+ throw new InvalidPreferencesFormatException("Preferences version " + version +
+ " is not supported");
}
// check preferences root's type
Element root = (Element) preferences
- .getElementsByTagName("root").item(0); //$NON-NLS-1$
+ .getElementsByTagName("root").item(0);
Preferences prefsRoot = null;
- String type = root.getAttribute("type"); //$NON-NLS-1$
- if (type.equals("user")) { //$NON-NLS-1$
+ String type = root.getAttribute("type");
+ if (type.equals("user")) {
prefsRoot = Preferences.userRoot();
} else {
prefsRoot = Preferences.systemRoot();
@@ -407,8 +388,8 @@ class XMLParser {
// END android-note
// load preferences
// BEGIN android-changed
- NodeList children = selectNodeList(node, "node"); //$NON-NLS-1$
- NodeList entries = selectNodeList(node, "map/entry"); //$NON-NLS-1$
+ NodeList children = selectNodeList(node, "node");
+ NodeList entries = selectNodeList(node, "map/entry");
// END android-changed
int childNumber = children.getLength();
Preferences[] prefChildren = new Preferences[childNumber];
@@ -419,14 +400,14 @@ class XMLParser {
}
for (int i = 0; i < entryNumber; i++) {
Element entry = (Element) entries.item(i);
- String key = entry.getAttribute("key"); //$NON-NLS-1$
- String value = entry.getAttribute("value"); //$NON-NLS-1$
+ String key = entry.getAttribute("key");
+ String value = entry.getAttribute("value");
prefs.put(key, value);
}
// get children preferences node
for (int i = 0; i < childNumber; i++) {
Element child = (Element) children.item(i);
- String name = child.getAttribute("name"); //$NON-NLS-1$
+ String name = child.getAttribute("name");
prefChildren[i] = prefs.node(name);
}
}
@@ -517,25 +498,17 @@ class XMLParser {
FileChannel channel = istream.getChannel();
lock = channel.lock(0L, Long.MAX_VALUE, true);
Document doc = builder.parse(in);
- // BEGIN android-modified
- NodeList entries = selectNodeList(doc
- .getDocumentElement(), "entry"); //$NON-NLS-1$
- // END android-modified
+ NodeList entries = selectNodeList(doc.getDocumentElement(), "entry");
int length = entries.getLength();
for (int i = 0; i < length; i++) {
Element node = (Element) entries.item(i);
- String key = node.getAttribute("key"); //$NON-NLS-1$
- String value = node.getAttribute("value"); //$NON-NLS-1$
+ String key = node.getAttribute("key");
+ String value = node.getAttribute("value");
result.setProperty(key, value);
}
return result;
} catch (IOException e) {
} catch (SAXException e) {
- // BEGIN android-removed
- // } catch (TransformerException e) {
- // // transform shouldn't fail for xpath call
- // throw new AssertionError(e);
- // END android-removed
} finally {
releaseQuietly(lock);
closeQuietly(in);
diff --git a/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java b/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
deleted file mode 100644
index aaf5d8d..0000000
--- a/prefs/src/main/java/org/apache/harmony/prefs/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.prefs.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.prefs.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.prefs.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/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties b/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties
deleted file mode 100644
index 8940685..0000000
--- a/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties
+++ /dev/null
@@ -1,33 +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
-prefs.0=Inputstream cannot be null\!
-prefs.1=Invalid DOCTYPE declaration: {0}
-prefs.10=Cannot initiate PreferencesFactory: {0}. Caused by {1}
-prefs.2=This preferences exported version is not supported:{0}
-prefs.3=Cannot get children names for {0}!
-prefs.4=Cannot remove {0}!
-prefs.5=Stream is null
-prefs.6=Name cannot end with '/'\!
-prefs.7=Name cannot contains consecutive '/'\!
-prefs.8=Name length is too long: {0}
-prefs.9=This node has been removed\!
-prefs.A=Cannot remove root node\!
-prefs.B=Enumerate child nodes error\!
-prefs.C=Flush error\!
-prefs.D=Enumerate keys error\!
-prefs.E=Access denied\!
-prefs.F=Remove node error\!
diff --git a/security/src/main/java/org/bouncycastle/x509/CertPathReviewerMessages_de.properties b/security/src/main/java/org/bouncycastle/x509/CertPathReviewerMessages_de.properties
deleted file mode 100644
index 52b5e5b..0000000
--- a/security/src/main/java/org/bouncycastle/x509/CertPathReviewerMessages_de.properties
+++ /dev/null
@@ -1,563 +0,0 @@
-
-## constructor exceptions
-
-# cert path is empty
-CertPathReviewer.emptyCertPath.title = CertPath is empty
-CertPathReviewer.emptyCertPath.text = PKIXCertPathReviewer: the CertPath is empty.
-CertPathReviewer.emptyCertPath.summary = PKIXCertPathReviewer: the CertPath is empty.
-CertPathReviewer.emptyCertPath.details = PKIXCertPathReviewer: the CertPath is empty.
-
-## name constraints processing errors
-
-# cert DN is not in the permitted tree
-# {0} DN as String
-CertPathReviewer.notPermittedDN.title = Name constraint error: certificate DN is not permitted
-CertPathReviewer.notPermittedDN.text = Name constraint error: the certificate DN {0} is not permitted.
-CertPathReviewer.notPermittedDN.summary = Name constraint error: certificate DN is not permitted.
-CertPathReviewer.notPermittedDN.details = Name constraint checking error. The certificate DN {0} is not in the permitted set of DNs.
-
-# cert DN is in the excluded tree
-# {0} DN as String
-CertPathReviewer.excludedDN.title = Name constraint error: certificate DN is excluded
-CertPathReviewer.excludedDN.text = Name constraint error: The certificate DN {0} is excluded.
-CertPathReviewer.excludedDN.summary = Name constraint error: certificate DN is excluded.
-CertPathReviewer.excludedDN.details = Name constraint checking error. The certificate DN {0} is inside of the excluded set of DNs.
-
-# cert email is not in the permitted tree
-# {0} email address as String
-CertPathReviewer.notPermittedEmail.title = Name constraint error: not permitted email address
-CertPathReviewer.notPermittedEmail.text = Name constraint error: certificate contains the not permitted email address {0}.
-CertPathReviewer.notPermittedEmail.summary = Name constraint error: not permitted email address.
-CertPathReviewer.notPermittedEmail.details = Name constraint checking error. The certificate contains the email address {0} which is not in the permitted set of email addresses.
-
-# cert email is in the excluded tree
-# {0} email as String
-CertPathReviewer.excludedEmail.title = Name constraint error: excluded email address
-CertPathReviewer.excludedEmail.text = Name constraint error: certificate contains the excluded email address {0}.
-CertPathReviewer.excludedEmail.summary = Name constraint error: excluded email address.
-CertPathReviewer.excludedEmail.details = Name constraint checking error. The certificate contains the email address {0} which is in the excluded set of email addresses.
-
-# cert IP is not in the permitted tree
-# {0} ip address as String
-CertPathReviewer.notPermittedIP.title = Name constraint error: not permitted IP address
-CertPathReviewer.notPermittedIP.text = Name constraint error: certificate contains the not permitted IP address {0}.
-CertPathReviewer.notPermittedIP.summary = Name constraint error: not permitted IP address.
-CertPathReviewer.notPermittedIP.details = Name constraint checking error. The certificate contains the IP address {0} which is not in the permitted set of IP addresses.
-
-# cert ip is in the excluded tree
-# {0} ip address as String
-CertPathReviewer.excludedIP.title = Name constraint error: excluded IP address
-CertPathReviewer.excludedIP.text = Name constraint error: certificate contains the excluded IP address {0}.
-CertPathReviewer.excludedIP.summary = Name constraint error: excluded IP address.
-CertPathReviewer.excludedIP.details = Name constraint checking error. The certificate contains the IP address {0} which is in the excluded set of IP addresses.
-
-# error processing the name constraints extension
-CertPathReviewer.ncExtError.title = Name constraint checking failed
-CertPathReviewer.ncExtError.text = Name constraint checking failed: there was an error processing the name constraints extension of the certificate.
-CertPathReviewer.ncExtError.summary = Error processing the name constraints extension.
-CertPathReviewer.ncExtError.details = Name constraint checking failed: there was an error processing the name constraints extension of the certificate.
-
-# error processing the subject alternative name extension
-CertPathReviewer.subjAltNameExtError.title = Name constraint checking failed
-CertPathReviewer.subjAltNameExtError.text = Name constraint checking failed: there was an error processing the subject alernative name extension of the certificate.
-CertPathReviewer.subjAltNameExtError.summary = Error processing the subject alternative name extension.
-CertPathReviewer.subjAltNameExtError.details = Name constraint checking failed: there was an error processing the subject alternative name extension of the certificate.
-
-# exception extracting subject name when checking subtrees
-# {0} subject Principal
-CertPathReviewer.ncSubjectNameError.title = Name constraint checking failed
-CertPathReviewer.ncSubjectNameError.text = Name constraint checking failed: there was an exception extracting the DN from the certificate.
-CertPathReviewer.ncSubjectNameError.summary = Name constraint checking failed: exception extracting the DN.
-CertPathReviewer.ncSubjectNameError.details = Name constraint checking failed: there was an exception extracting the DN from the certificate.
-
-
-## path length errors
-
-# max path length extended
-CertPathReviewer.pathLenghtExtended.title = Maximum path length extended
-CertPathReviewer.pathLenghtExtended.text = Certificate path invalid: Maximum path length extended.
-CertPathReviewer.pathLenghtExtended.summary = Certificate path invalid: Maximum path length extended.
-CertPathReviewer.pathLenghtExtended.details = Certificate path invalid: Maximum path length extended.
-
-# error reading length constraint from basic constraint extension
-CertPathReviewer.processLengthConstError.title = Path length checking failed
-CertPathReviewer.processLengthConstError.text = Path length checking failed: there was an error processing the basic constraint extension of the certificate.
-CertPathReviewer.processLengthConstError.summary = Error processing the subject alternative name extension.
-CertPathReviewer.processLengthConstError.details = Path length checking failed: there was an error processing the basic constraint extension of the certificate.
-
-
-## path length notifications
-
-# total path length as defined in rfc 3280
-# {0} the path length as Integer
-CertPathReviewer.totalPathLength.title = Total path length
-CertPathReviewer.totalPathLength.text = The total path length without self-signed certificates is {0}.
-CertPathReviewer.totalPathLength.summary = The total path length without self-signed certificates is {0}.
-CertPathReviewer.totalPathLength.details = The total path length without self-signed certificates, as defined in RFC 3280, is {0}.
-
-
-## critical extensions errors
-
-# one unknown critical extension
-# {0} extension as String
-CertPathReviewer.unknownCriticalExt.title = Unknown critical extension
-CertPathReviewer.unknownCriticalExt.text = The certificate contains the unknown critical extension {0}.
-CertPathReviewer.unknownCriticalExt.summary = Unknown critical extension: {0}.
-CertPathReviewer.unknownCriticalExt.details = The certificate contains the unknown critical extension with the OID {0}.
-
-# more unknown critical extensions
-# {0} extensions as Set of Strings
-CertPathReviewer.unknownCriticalExts.title = Unknown critical extensions
-CertPathReviewer.unknownCriticalExts.text = The certificate contains two or more unknown critical extensions: {0}.
-CertPathReviewer.unknownCriticalExts.summary = Unknown critical extensions: {0}.
-CertPathReviewer.unknownCriticalExts.details = The certificate contains two or more unknown critical extensions with the OIDs: {0}.
-
-# error processing critical extension
-# {0} the message of the underlying exception
-# {1} the underlying exception
-CertPathReviewer.criticalExtensionError.title = Error processing a critical extension
-CertPathReviewer.criticalExtensionError.text = Error processing a critical extension. Cause: {0}.
-CertPathReviewer.criticalExtensionError.summary = Error processing a critical extension. Cause: {0}.
-CertPathReviewer.criticalExtensionError.details = Error processing a critical extension. Cause: {0}.
-
-# error initializing the certpath checkers
-# {0} the message of the underlying exception
-# {1} the underlying exception
-CertPathReviewer.certPathCheckerError.title = Checking critical extensions failed
-CertPathReviewer.certPathCheckerError.text = Checking critical extensions failed: there was an error initializing a CertPathChecker.
-CertPathReviewer.certPathCheckerError.summary = Checking critical extensions failed: error initializing a CertPathChecker
-CertPathReviewer.certPathCheckerError.details = Checking critical extensions failed: there was an error initializing a CertPathChecker. Cause: {0}
-
-
-## check signature errors
-
-# trustanchor found, but certificate validation failed
-CertPathReviewer.trustButInvalidCert.title = TrustAnchor found, but certificate invalid
-CertPathReviewer.trustButInvalidCert.text = A TrustAnchor was found but the certificate validation failed.
-CertPathReviewer.trustButInvalidCert.summary = TrustAnchor found but certificate validation failed.
-CertPathReviewer.trustButInvalidCert.details = A TrustAnchor was found but the certificate validation failed.
-
-# trustanchor - cannot extract issuer
-CertPathReviewer.trustAnchorIssuerError.title = Finding TrustAnchor failed
-CertPathReviewer.trustAnchorIssuerError.text = Finding TrustAnchor failed: cannot extract issuer from certificate.
-CertPathReviewer.trustAnchorIssuerError.summary = Finding TrustAnchor failed: cannot extract issuer from certificate.
-CertPathReviewer.trustAnchorIssuerError.details = Finding TrustAnchor failed: cannot extract issuer from certificate.
-
-# no trustanchor was found for the certificate path
-# {0} issuer of the root certificate of the path
-# {1} number of trusted root certificates (trustanchors) provided
-CertPathReviewer.noTrustAnchorFound.title = No trusted root certificate found
-CertPathReviewer.noTrustAnchorFound.text = The root certificate of the certificate path was issued by a CA that is not in the the trusted-root-certificate-store used for the path validation. The name of the CA is "{0}".
-CertPathReviewer.noTrustAnchorFound.summary = The root certificate of the certificate path was issued by a CA that is not in the the trusted-root-certificate-store used for the path validation.
-CertPathReviewer.noTrustAnchorFound.details = The root certificate of the certificate path was issued by a CA that is not in the the trusted-root-certificate-store used for the path validation. The name of the CA is "{0}". The trusted-root-certificate store contains {1} CA(s).
-
-# conflicting trust anchors
-# {0} number of trustanchors found (Integer)
-# {1} the ca name
-CertPathReviewer.conflictingTrustAnchors.title = Corrupt trust root store
-CertPathReviewer.conflictingTrustAnchors.text = Warning: corrupt trust root store: There are {0} trusted public keys for the CA "{1}" - please ensure with CA which is the correct key.
-CertPathReviewer.conflictingTrustAnchors.summary = Warning: corrupt trust root store: There are {0} trusted public keys for the CA "{1}" - please ensure with CA which is the correct key.
-CertPathReviewer.conflictingTrustAnchors.details = Warning: corrupt trust root store: There are {0} trusted public keys for the CA "{1}" - please ensure with CA which is the correct key.
-
-# trustanchor DN is invalid
-# {0} DN of the Trustanchor
-CertPathReviewer.trustDNInvalid.title = DN of TrustAnchor is improperly specified
-CertPathReviewer.trustDNInvalid.text = The DN of the TrustAnchor is improperly specified: {0}.
-CertPathReviewer.trustDNInvalid.summary = The DN of the TrustAnchor is improperly specified.
-CertPathReviewer.trustDNInvalid.details = The DN of the TrustAnchor is improperly specified: {0}. It's not a valid X.500 name. See RFC 1779 or RFC 2253.
-
-# trustanchor public key algorithm error
-CertPathReviewer.trustPubKeyError.title = Error processing public key of the trust anchor
-CertPathReviewer.trustPubKeyError.text = Error processing public key of the trust anchor.
-CertPathReviewer.trustPubKeyError.summary = Error processing public key of the trust anchor.
-CertPathReviewer.trustPubKeyError.details = Error processing public key of the trust anchor. Could not extract the AlorithmIdentifier for the key.
-
-# can not verifiy signature: issuer public key unknown
-CertPathReviewer.NoIssuerPublicKey.title = Can not verify the certificate signature
-CertPathReviewer.NoIssuerPublicKey.text = Can not verify the certificate signature: Issuer public key is unknown.
-CertPathReviewer.NoIssuerPublicKey.summary = Can not verify the certificate signature: Issuer public key is unknown.
-CertPathReviewer.NoIssuerPublicKey.details = Can not verify the certificate signature: Issuer public key is unknown.
-
-# signature can not be verified
-# {0} message of the underlying exception (english)
-# {1} the underlying exception
-CertPathReviewer.signatureNotVerified.title = Certificate signature invalid
-CertPathReviewer.signatureNotVerified.text = The certificate signature is invalid.
-CertPathReviewer.signatureNotVerified.summary = The certificate signature is invalid.
-CertPathReviewer.signatureNotVerified.details = The certificate signature is invalid. Cause: {0}
-
-# certificate expired
-# {0} the date the certificate expired
-CertPathReviewer.certificateExpired.title = Certificate is expired
-CertPathReviewer.certificateExpired.text = Could not validate the certificate. Certificate expired on {0,date} {0,time,full}.
-CertPathReviewer.certificateExpired.summary = Certificate expired on {0,date} {0,time,full}.
-CertPathReviewer.certificateExpired.details = Could not validate the certificate. Certificate expired on {0,date} {0,time,full}.
-
-# certificate not yet valid
-# {0} the date from which on the certificate is valid
-CertPathReviewer.certificateNotYetValid.title = Certificate is not yet valid
-CertPathReviewer.certificateNotYetValid.text = Could not validate the certificate. Certificate is not valid untill {0,date} {0,time,full}.
-CertPathReviewer.certificateNotYetValid.summary = Certificate is not valid untill {0,date} {0,time,full}.
-CertPathReviewer.certificateNotYetValid.details = Could not validate the certificate. Certificate is not valid untill {0,date} {0,time,full}.
-
-# certificate invalid issuer DN
-# {0} expected issuer DN as String
-# {1} found issuer DN as String
-CertPathReviewer.certWrongIssuer.title = Issuer of certificate not valid
-CertPathReviewer.certWrongIssuer.text = Issuer of certificate is not valid. Expected {0}, but found {1}.
-CertPathReviewer.certWrongIssuer.summary = Issuer of certificate is not valid.
-CertPathReviewer.certWrongIssuer.details = Issuer of certificate is not valid. Expected {0}, but found {1}.
-
-# intermediate certificate is no ca cert
-CertPathReviewer.noCACert.title = Certificate is no CA certificate
-CertPathReviewer.noCACert.text = Intermediate certificate is no CA certificate.
-CertPathReviewer.noCACert.summary = The certificate is no CA certificate.
-CertPathReviewer.noCACert.details = The certificate is no CA certificate but used as one.
-
-# cert laks basic constraints
-CertPathReviewer.noBasicConstraints.title = Certificate has no basic constraints
-CertPathReviewer.noBasicConstraints.text = Intermediate certificate has no basic constraints.
-CertPathReviewer.noBasicConstraints.summary = Intermediate certificate has no basic constraints.
-CertPathReviewer.noBasicConstraints.details = Intermediate certificate has no basic constraints.
-
-# error processing basic constraints
-CertPathReviewer.errorProcesingBC.title = Error processing the basic constraints extension
-CertPathReviewer.errorProcesingBC.text = There was an error while processing the basic constraints extension of this certificate.
-CertPathReviewer.errorProcesingBC.summary = Error processing the basic constraints extension.
-CertPathReviewer.errorProcesingBC.details = There was an error while processing the basic constraints extension of this certificate.
-
-# certificate not usable for signing certs
-CertPathReviewer.noCertSign.title = Key not usable for signing certificates
-CertPathReviewer.noCertSign.text = The key usage constraint does not allow the use of this certificate key for signing certificates.
-CertPathReviewer.noCertSign.summary = The certificate key can not be used for signing certificates.
-CertPathReviewer.noCertSign.details = The key usage constraint does not allow the use of this certificate key for signing certificates.
-
-# error processing public key
-CertPathReviewer.pubKeyError.title = Error processing public key
-CertPathReviewer.pubKeyError.text = Error processing public key of the certificate.
-CertPathReviewer.pubKeyError.summary = Error processing public key of the certificate.
-CertPathReviewer.pubKeyError.details = Error processing public key of the certificate. Could not extract the AlorithmIdentifier for the key.
-
-
-## check signatures notifications
-
-# certificate path validation date
-# {0} date for which the cert path is validated
-# {1} current date
-CertPathReviewer.certPathValidDate.title = Certificate path validation date
-CertPathReviewer.certPathValidDate.text = Der Zertifikatspfad wurde am {0,date} {0,time,full} angewendet. Er wurde am {1,date} {1,time,full} validiert.
-CertPathReviewer.certPathValidDate.summary = The certificate path was validated for {0,date} {0,time,full}. It was validated at {1,date} {1,time,full}.
-CertPathReviewer.certPathValidDate.details = The certificate path was validated for {0,date} {0,time,full}. It was validated at {1,date} {1,time,full}.
-
-
-## check policy errors
-
-# error processing certificate policy extension
-CertPathReviewer.policyExtError.title = Policy checking failed
-CertPathReviewer.policyExtError.text = Policy checking failed: there was an error processing the certificate policy extension.
-CertPathReviewer.policyExtError.summary = Error processing the certificate policy extension.
-CertPathReviewer.policyExtError.details = Policy checking failed: there was an error processing the certificate policy extension.
-
-# error processing policy constraints extension
-CertPathReviewer.policyConstExtError.title = Policy checking failed
-CertPathReviewer.policyConstExtError.text = Policy checking failed: there was an error processing the policy constraints extension.
-CertPathReviewer.policyConstExtError.summary = Error processing the policy constraints extension.
-CertPathReviewer.policyConstExtError.details = Policy checking failed: there was an error processing the policy constraints extension.
-
-# error processing policy mapping extension
-CertPathReviewer.policyMapExtError.title = Policy checking failed
-CertPathReviewer.policyMapExtError.text = Policy checking failed: there was an error processing the policy mapping extension.
-CertPathReviewer.policyMapExtError.summary = Error processing the policy mapping extension.
-CertPathReviewer.policyMapExtError.details = Policy checking failed: there was an error processing the policy mapping extension.
-
-# error processing inhibit any policy extension
-CertPathReviewer.policyInhibitExtError.title = Policy checking failed
-CertPathReviewer.policyInhibitExtError.text = Policy checking failed: there was an error processing the policy mapping extension.
-CertPathReviewer.policyInhibitExtError.summary = Error processing the inhibit any policy extension.
-CertPathReviewer.policyInhibitExtError.details = Policy checking failed: there was an error processing the policy mapping extension.
-
-# error building qualifier set
-CertPathReviewer.policyQualifierError.title = Policy checking failed
-CertPathReviewer.policyQualifierError.text = Policy checking failed: error building the policy qualifier set.
-CertPathReviewer.policyQualifierError.summary = Policy checking failed: error building the policy qualifier set.
-CertPathReviewer.policyQualifierError.details = Policy checking failed: error building the policy qualifier set.
-
-# no valid policy tree - explicit policy required
-CertPathReviewer.noValidPolicyTree.title = Policy checking failed
-CertPathReviewer.noValidPolicyTree.text = Policy checking failed: no valid policy tree found when one expected.
-CertPathReviewer.noValidPolicyTree.summary = Policy checking failed: no valid policy tree found when one expected.
-CertPathReviewer.noValidPolicyTree.details = Policy checking failed: no valid policy tree found when one expected.
-
-# expicit policy requested, but no policy available
-CertPathReviewer.explicitPolicy.title = Policy checking failed
-CertPathReviewer.explicitPolicy.text = Policy checking failed: explicit policy requested but no policy available.
-CertPathReviewer.explicitPolicy.summary = Policy checking failed: explicit policy requested but no policy available.
-CertPathReviewer.explicitPolicy.details = Policy checking failed: explicit policy requested but no policy available.
-
-# path processing failed on policy
-CertPathReviewer.invalidPolicy.title = Path processing failed on policy
-CertPathReviewer.invalidPolicy.text = Path processing failed on policy.
-CertPathReviewer.invalidPolicy.summary = Path processing failed on policy.
-CertPathReviewer.invalidPolicy.details = Path processing failed on policy.
-
-# invalid policy mapping
-CertPathReviewer.invalidPolicyMapping.title = Invalid policy mapping
-CertPathReviewer.invalidPolicyMapping.text = Certificate contains an invalid policy mapping.
-CertPathReviewer.invalidPolicyMapping.summary = Certificate contains an invalid policy mapping.
-CertPathReviewer.invalidPolicyMapping.details = Certificate contains a policy mapping including the value any policy which is invalid.
-
-## check CRL notifications
-
-# found local valid CRL
-# {0} thisUpdate of the CRL
-# {1} nextUpdate of the CRL
-CertPathReviewer.localValidCRL.title = Found valid local CRL
-CertPathReviewer.localValidCRL.text = Found a valid CRL in local certstore. Issued on {0,date}, next update {1,date}.
-CertPathReviewer.localValidCRL.summary = Found a valid CRL in local certstore. Issued on {0,date}, next update {1,date}.
-CertPathReviewer.localValidCRL.details = Found a valid CRL in local certstore. Issued on {0,date}, next update {1,date}.
-
-
-# found matching CRL, but not valid
-# {0} thisUpdate of the CRL
-# {1} nextUpdate of the CRL
-CertPathReviewer.localInvalidCRL.title = Local CRL outdated
-CertPathReviewer.localInvalidCRL.text = Did not use a matching CRL in a local certstore, because it is outdated. Issued on {0,date}, next update {1,date}.
-CertPathReviewer.localInvalidCRL.summary = Did not use a matching CRL in a local certstore, because it is outdated. Issued on {0,date}, next update {1,date}.
-CertPathReviewer.localInvalidCRL.details = Did not use a matching CRL in a local certstore, because it is outdated. Issued on {0,date}, next update {1,date}.
-
-# found a valid crl at crl distribution point
-# {0} thisUpdate of the CRL
-# {1} nextUpdate of the CRL
-# {2} the url of the distribution point
-CertPathReviewer.onlineValidCRL.title = Found valid CRL at CRL distribution point
-CertPathReviewer.onlineValidCRL.text = Found a valid CRL at: {2}. Issued on {0,date}, next update on {1,date}.
-CertPathReviewer.onlineValidCRL.summary = Found a valid CRL at: {2}. Issued on {0,date}, next update on {1,date}.
-CertPathReviewer.onlineValidCRL.details = Found a valid CRL at: {2}. Issued on {0,date}, next update on {1,date}.
-
-# found an invalid CRL at crl distribution point
-# {0} thisUpdate of the CRL
-# {1} nextUpdate of the CRL
-# {2} the url of the distribution point
-CertPathReviewer.onlineInvalidCRL.title = Outdated CRL at CRL distribution point
-CertPathReviewer.onlineInvalidCRL.text = The CRL loaded from {2} was outdated. Issued on {0,date}, next update on {1,date}.
-CertPathReviewer.onlineInvalidCRL.summary = The CRL loaded from {2} was outdated. Issued on {0,date}, next update on {1,date}.
-CertPathReviewer.onlineInvalidCRL.details = The CRL loaded from {2} was outdated. Issued on {0,date}, next update on {1,date}.
-
-# Certificate not revoked
-CertPathReviewer.notRevoked.title = Certificate not revoked
-CertPathReviewer.notRevoked.text = The certificate was not revoked.
-CertPathReviewer.notRevoked.summary = The certificate was not revoked.
-CertPathReviewer.notRevoked.details = The certificate was not revoked.
-
-# CRL found: certificate was revoked, but after the validationDate
-# {0} the date the certificate was revoked
-# {1} the reason for revoking the certificate
-CertPathReviewer.revokedAfterValidation.title = Certificate was revoked after the validation date
-CertPathReviewer.revokedAfterValidation.text = The certificate was revoked after the validation date at {0,date} {0,time,full}. Reason: {1}.
-CertPathReviewer.revokedAfterValidation.summary = The certificate was revoked after the validation date at {0,date} {0,time,full}.
-CertPathReviewer.revokedAfterValidation.details = The certificate was revoked after the validation date at {0,date} {0,time,full}. Reason: {1}.
-
-# updated crl available
-# {0} date since when the update is available
-CertPathReviewer.crlUpdateAvailable.title = CRL update available
-CertPathReviewer.crlUpdateAvailable.text = An update for the CRL of this certificate is available since {0,date} {0,time,full}.
-CertPathReviewer.crlUpdateAvailable.summary = An update for the CRL of this certificate is available since {0,date} {0,time,full}.
-CertPathReviewer.crlUpdateAvailable.details = An update for the CRL of this certificate is available since {0,date} {0,time,full}.
-
-# crl distribution point url
-# {0} the crl distribution point url as String
-CertPathReviewer.crlDistPoint.title = CRL distribution point
-CertPathReviewer.crlDistPoint.text = A CRL can be obtained from: {0}.
-CertPathReviewer.crlDistPoint.summary = A CRL can be obtained from: {0}.
-CertPathReviewer.crlDistPoint.details = A CRL can be obtained from: {0}.
-
-# ocsp location
-# {0} the url on which the ocsp service can be found
-CertPathReviewer.ocspLocation.title = OCSP responder location
-CertPathReviewer.ocspLocation.text = OCSP responder location: {0}.
-CertPathReviewer.ocspLocation.summary = OCSP responder location: {0}.
-CertPathReviewer.ocspLocation.details = OCSP responder location: {0}.
-
-# unable to get crl from crl distribution point
-# {0} the url of the distribution point
-# {1} the message of the occured exception
-# {2} the occured exception
-CertPathReviewer.loadCrlDistPointError.title = Cannot load CRL from CRL distribution point
-CertPathReviewer.loadCrlDistPointError.text = Unable to load a CRL from: {0}. An Exception occured.
-CertPathReviewer.loadCrlDistPointError.summary = Unable to load a CRL from: {0}. An Exception occured.
-CertPathReviewer.loadCrlDistPointError.details = Unable to load a CRL from: {0}. An Exception occured: Cause: {1}.
-
-# no crl found in certstores
-# {0} the issuers which we searched for
-# {1} list of crl issuer names that are found in the certstores
-# {2} number of crls in the certstores
-CertPathReviewer.noCrlInCertstore.title = No matching CRL found in local certstores
-CertPathReviewer.noCrlInCertstore.text = No matching CRL was found in the provided local certstore.
-CertPathReviewer.noCrlInCertstore.summary = No matching CRL was found in the provided local certstore.
-CertPathReviewer.noCrlInCertstore.details = No matching CRL was found in the provided local certstore. \
-No CRL was found for the selector "{0}". The {2} CRL(s) in the certstores are from "{1}".
-
-
-## check CRL exceptions
-
-# cannot extract issuer from certificate
-CertPathReviewer.crlIssuerException.title = CRL checking failed
-CertPathReviewer.crlIssuerException.text = CRL checking failed: cannot extract issuer from certificate.
-CertPathReviewer.crlIssuerException.summary = CRL checking failed: cannot extract issuer from certificate.
-CertPathReviewer.crlIssuerException.details = CRL checking failed: cannot extract issuer from certificate.
-
-# cannot extract crls
-# {0} message from the underlying exception
-# {1} the underlying exception
-CertPathReviewer.crlExtractionError.title = CRL checking failed
-CertPathReviewer.crlExtractionError.text = CRL checking failed: Cannot extract CRL from CertStore.
-CertPathReviewer.crlExtractionError.summary = CRL checking failed: Cannot extract CRL from CertStore.
-CertPathReviewer.crlExtractionError.details = CRL checking failed: Cannot extract CRL from CertStore. Cause: {0}.
-
-# Issuer certificate key usage extension does not permit crl signing
-CertPathReviewer.noCrlSigningPermited.title = CRL checking failed
-CertPathReviewer.noCrlSigningPermited.text = CRL checking failed: issuer certificate does not permit CRL signing.
-CertPathReviewer.noCrlSigningPermited.summary = CRL checking failed: issuer certificate does not permit CRL signing.
-CertPathReviewer.noCrlSigningPermited.details = CRL checking failed: issuer certificate does not permit CRL signing.
-
-# can not verify crl: issuer public key unknown
-CertPathReviewer.crlNoIssuerPublicKey.title = CRL checking failed
-CertPathReviewer.crlNoIssuerPublicKey.text = CRL checking failed: Can not verify the CRL: Issuer public key is unknown.
-CertPathReviewer.crlNoIssuerPublicKey.summary = CRL checking failed: Can not verify the CRL: Issuer public key is unknown.
-CertPathReviewer.crlNoIssuerPublicKey.details = CRL checking failed: Can not verify the CRL: Issuer public key is unknown.
-
-# crl verification failed
-CertPathReviewer.crlVerifyFailed.title = CRL checking failed
-CertPathReviewer.crlVerifyFailed.text = CRL checking failed: CRL signature is invalid.
-CertPathReviewer.crlVerifyFailed.summary = CRL checking failed: CRL signature is invalid.
-CertPathReviewer.crlVerifyFailed.details = CRL checking failed: CRL signature is invalid.
-
-# no valid CRL found
-CertPathReviewer.noValidCrlFound.title = CRL checking failed
-CertPathReviewer.noValidCrlFound.text = CRL checking failed: no valid CRL found.
-CertPathReviewer.noValidCrlFound.summary = CRL checking failed: no valid CRL found.
-CertPathReviewer.noValidCrlFound.details = CRL checking failed: no valid CRL found.
-
-# No base CRL for delta CRL
-CertPathReviewer.noBaseCRL.title = CRL checking failed
-CertPathReviewer.noBaseCRL.text = CRL checking failed: no base CRL found for delta CRL.
-CertPathReviewer.noBaseCRL.summary = CRL checking failed: no base CRL found for delta CRL.
-CertPathReviewer.noBaseCRL.details = CRL checking failed: no base CRL found for delta CRL.
-
-# certificate revoked
-# {0} the date the certificate was revoked
-# {1} the reason for revoking the certificate
-CertPathReviewer.certRevoked.title = Certificate was revoked
-CertPathReviewer.certRevoked.text = The certificate is invalid, because it was revoked at {0,date} {0,time,full}. Reason: {1}.
-CertPathReviewer.certRevoked.summary = The certificate is invalid, because it was revoked at {0,date} {0,time,full}.
-CertPathReviewer.certRevoked.details = The certificate is invalid, because it was revoked at {0,date} {0,time,full}. Reason: {1}.
-
-# error processing issuing distribution point extension
-CertPathReviewer.distrPtExtError.title = CRL checking failed
-CertPathReviewer.distrPtExtError.text = CRL checking failed: there was an error processing the issuing distribution point extension.
-CertPathReviewer.distrPtExtError.summary = Error processing the issuing distribution point extension.
-CertPathReviewer.distrPtExtError.details = CRL checking failed: there was an error processing the issuing distribution point extension.
-
-# error processing crl distribution points extension
-CertPathReviewer.crlDistPtExtError.title = CRL checking failed
-CertPathReviewer.crlDistPtExtError.text = CRL checking failed: there was an error processing the crl distribution points extension.
-CertPathReviewer.crlDistPtExtError.summary = Error processing the crl distribution points extension.
-CertPathReviewer.crlDistPtExtError.details = CRL checking failed: there was an error processing the crl distribution points extension.
-
-# error processing the authority info access extension
-CertPathReviewer.crlAuthInfoAccError.title = CRL checking failed
-CertPathReviewer.crlAuthInfoAccError.text = CRL checking failed: there was an error processing the authority info access extension.
-CertPathReviewer.crlAuthInfoAccError.summary = Error processing the authority info access extension.
-CertPathReviewer.crlAuthInfoAccError.details = CRL checking failed: there was an error processing the authority info access extension.
-
-# error processing delta crl indicator extension
-CertPathReviewer.deltaCrlExtError.title = CRL checking failed
-CertPathReviewer.deltaCrlExtError.text = CRL checking failed: there was an error processing the delta CRL indicator extension.
-CertPathReviewer.deltaCrlExtError.summary = Error processing the delta CRL indicator extension.
-CertPathReviewer.deltaCrlExtError.details = CRL checking failed: there was an error processing the delta CRL indicator extension.
-
-# error porcessing crl number extension
-CertPathReviewer.crlNbrExtError.title = CRL checking failed
-CertPathReviewer.crlNbrExtError.text = CRL checking failed: there was an error processing the CRL number extension.
-CertPathReviewer.crlNbrExtError.summary = Error processing the CRL number extension.
-CertPathReviewer.crlNbrExtError.details = CRL checking failed: there was an error processing the CRL number extension.
-
-# error processing crl reason code extension
-CertPathReviewer.crlReasonExtError.title = CRL checking failed
-CertPathReviewer.crlReasonExtError.text = CRL checking failed: there was an error processing the CRL reason code extension.
-CertPathReviewer.crlReasonExtError.summary = Error processing the CRL reason code extension.
-CertPathReviewer.crlReasonExtError.details = CRL checking failed: there was an error processing the CRL reason code extension.
-
-# error processing basic constraints extension
-CertPathReviewer.crlBCExtError.title = CRL checking failed
-CertPathReviewer.crlBCExtError.text = CRL checking failed: there was an error processing the basic constraints extension.
-CertPathReviewer.crlBCExtError.summary = Error processing the basic constraints extension.
-CertPathReviewer.crlBCExtError.details = CRL checking failed: there was an error processing the basic constraints extension.
-
-# CA Cert CRL only contains user certificates
-CertPathReviewer.crlOnlyUserCert.title = CRL checking failed
-CertPathReviewer.crlOnlyUserCert.text = CRL checking failed: CRL only contains user certificates.
-CertPathReviewer.crlOnlyUserCert.summary = CRL checking failed: CRL only contains user certificates.
-CertPathReviewer.crlOnlyUserCert.details = CRL checking failed: CRL for CA certificate only contains user certificates.
-
-# End CRL only contains CA certificates
-CertPathReviewer.crlOnlyCaCert.title = CRL checking failed
-CertPathReviewer.crlOnlyCaCert.text = CRL checking failed: CRL only contains CA certificates.
-CertPathReviewer.crlOnlyCaCert.summary = CRL checking failed: CRL only contains CA certificates.
-CertPathReviewer.crlOnlyCaCert.details = CRL checking failed: CRL for end certificate only contains CA certificates.
-
-# onlyContainsAttributeCerts boolean is asserted
-CertPathReviewer.crlOnlyAttrCert.title = CRL checking failed
-CertPathReviewer.crlOnlyAttrCert.text = CRL checking failed: CRL only contains attribute certificates.
-CertPathReviewer.crlOnlyAttrCert.summary = CRL checking failed: CRL only contains attribute certificates.
-CertPathReviewer.crlOnlyAttrCert.details = CRL checking failed: CRL only contains attribute certificates.
-
-
-## QcStatement notifications
-
-# unkown statement
-# {0} statement OID
-# {1} statement as ANS1Sequence
-CertPathReviewer.QcUnknownStatement.title = Unknown statement in QcStatement extension
-CertPathReviewer.QcUnknownStatement.text = Unknown statement in QcStatement extension: OID = {0}
-CertPathReviewer.QcUnknownStatement.summary = Unknown statement in QcStatement extension: OID = {0}
-CertPathReviewer.QcUnknownStatement.details = Unknown statement in QcStatement extension: OID = {0}, statement = {1}
-
-# QcLimitValue Alpha currency code
-# {0} currency code
-# {1} limit value
-# {2} monetary value as MonetaryValue
-CertPathReviewer.QcLimitValueAlpha.title = Transaction Value Limit
-CertPathReviewer.QcLimitValueAlpha.text = This certificate has a limit for the transaction value: {1,number,currency} {0}.
-CertPathReviewer.QcLimitValueAlpha.summary = Transaction value limit: {1,number,currency} {0}.
-CertPathReviewer.QcLimitValueAlpha.details = This certificate has a limitation on the value of transaction for which this certificate can be used to the specified amount, according to the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures, as implemented in the law of the country specified in the issuer field of this certificate. The limit for this certificate is {1,number,currency} {0}.
-
-# QcLimitValue Numeric currency code
-# {0} currency code
-# {1} limit value
-# {2} monetary value as MonetaryValue
-CertPathReviewer.QcLimitValueNum.title = Transaction Value Limit
-CertPathReviewer.QcLimitValueNum.text = This certificate has a limit for the transaction value: {1,number,currency} of currency {0} (See RFC 4217 for currency codes).
-CertPathReviewer.QcLimitValueNum.summary = Transaction value limit: {1,number,currency} of currency {0} (See RFC 4217 for currency codes).
-CertPathReviewer.QcLimitValueNum.details = This certificate has a limitation on the value of transaction for which this certificate can be used to the specified amount, according to the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures, as implemented in the law of the country specified in the issuer field of this certificate. The limit for this certificate is {1,number,currency} of currency {0} (See RFC 4217 for currency codes).
-
-# QcSSCD
-CertPathReviewer.QcSSCD.title = QcSSCD Statement
-CertPathReviewer.QcSSCD.text = The issuer claims that for the certificate where this statement appears that the private key associated with the public key in the certificate is protected according to Annex III of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures.
-CertPathReviewer.QcSSCD.summary = The issuer claims that for the certificate where this statement appears that the private key associated with the public key in the certificate is protected according to Annex III of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures.
-CertPathReviewer.QcSSCD.details = The issuer claims that for the certificate where this statement appears that the private key associated with the public key in the certificate is protected according to Annex III of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures.
-
-# QcEuCompliance
-CertPathReviewer.QcEuCompliance.title = Qualified Certificate
-CertPathReviewer.QcEuCompliance.text = This certificate is issued as a Qualified Certificate according Annex I and II of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures, as implemented in the law of the country specified in the issuer field of this certificate.
-CertPathReviewer.QcEuCompliance.summary = This certificate is issued as a Qualified Certificate according Annex I and II of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures, as implemented in the law of the country specified in the issuer field of this certificate.
-CertPathReviewer.QcEuCompliance.details = This certificate is issued as a Qualified Certificate according Annex I and II of the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures, as implemented in the law of the country specified in the issuer field of this certificate.
-
-## QcStatement errors
-
-# error processing the QcStatement extension
-CertPathReviewer.QcStatementExtError.title = Error processing the qc statements extension
-CertPathReviewer.QcStatementExtError.text = Error processing the qc statements extension.
-CertPathReviewer.QcStatementExtError.summary = Error processing the qc statements extension.
-CertPathReviewer.QcStatementExtError.details = Error processing the qc statements extension.
-
diff --git a/sql/src/main/java/java/sql/DriverManager.java b/sql/src/main/java/java/sql/DriverManager.java
index 1c41a46..8d3adde 100644
--- a/sql/src/main/java/java/sql/DriverManager.java
+++ b/sql/src/main/java/java/sql/DriverManager.java
@@ -17,20 +17,17 @@
package java.sql;
+import dalvik.system.VMStack;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.security.AccessController;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
import java.util.Enumeration;
import java.util.Iterator;
-import java.io.PrintStream;
-import java.io.PrintWriter;
+import java.util.List;
+import java.util.Properties;
import java.util.Vector;
-import java.security.AccessController;
import org.apache.harmony.luni.util.PriviAction;
-import org.apache.harmony.sql.internal.nls.Messages;
-// BEGIN android-changed
-import dalvik.system.VMStack;
-// END android-changed
/**
* Provides facilities for managing JDBC drivers.
@@ -59,8 +56,7 @@ public class DriverManager {
private static final List<Driver> theDrivers = new ArrayList<Driver>(10);
// Permission for setting log
- private static final SQLPermission logPermission = new SQLPermission(
- "setLog"); //$NON-NLS-1$
+ private static final SQLPermission logPermission = new SQLPermission("setLog");
/*
* Load drivers on initialization
@@ -75,7 +71,7 @@ public class DriverManager {
*/
private static void loadInitialDrivers() {
String theDriverList = AccessController
- .doPrivileged(new PriviAction<String>("jdbc.drivers", null)); //$NON-NLS-1$
+ .doPrivileged(new PriviAction<String>("jdbc.drivers", null));
if (theDriverList == null) {
return;
@@ -85,7 +81,7 @@ public class DriverManager {
* Get the names of the drivers as an array of Strings from the system
* property by splitting the property at the separator character ':'
*/
- String[] theDriverNames = theDriverList.split(":"); //$NON-NLS-1$
+ String[] theDriverNames = theDriverList.split(":");
for (String element : theDriverNames) {
try {
@@ -125,15 +121,10 @@ public class DriverManager {
if (driver == null) {
return;
}
- // BEGIN android-changed
ClassLoader callerClassLoader = VMStack.getCallingClassLoader();
- // END android-changed
-
if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) {
- // sql.1=DriverManager: calling class not authorized to deregister
- // JDBC driver
- throw new SecurityException(Messages.getString("sql.1")); //$NON-NLS-1$
- } // end if
+ throw new SecurityException("calling class not authorized to deregister JDBC driver");
+ }
synchronized (theDrivers) {
theDrivers.remove(driver);
}
@@ -172,14 +163,12 @@ public class DriverManager {
* if there is an error while attempting to connect to the
* database identified by the URL.
*/
- public static Connection getConnection(String url, Properties info)
- throws SQLException {
+ public static Connection getConnection(String url, Properties info) throws SQLException {
// 08 - connection exception
// 001 - SQL-client unable to establish SQL-connection
- String sqlState = "08001"; //$NON-NLS-1$
+ String sqlState = "08001";
if (url == null) {
- // sql.5=The url cannot be null
- throw new SQLException(Messages.getString("sql.5"), sqlState); //$NON-NLS-1$
+ throw new SQLException("The url cannot be null", sqlState);
}
synchronized (theDrivers) {
/*
@@ -195,8 +184,7 @@ public class DriverManager {
}
}
// If we get here, none of the drivers are able to resolve the URL
- // sql.6=No suitable driver
- throw new SQLException(Messages.getString("sql.6"), sqlState); //$NON-NLS-1$
+ throw new SQLException("No suitable driver", sqlState);
}
/**
@@ -218,10 +206,10 @@ public class DriverManager {
String password) throws SQLException {
Properties theProperties = new Properties();
if (null != user) {
- theProperties.setProperty("user", user); //$NON-NLS-1$
+ theProperties.setProperty("user", user);
}
if (null != password) {
- theProperties.setProperty("password", password); //$NON-NLS-1$
+ theProperties.setProperty("password", password);
}
return getConnection(url, theProperties);
}
@@ -258,10 +246,9 @@ public class DriverManager {
}
}
// If no drivers understand the URL, throw an SQLException
- // sql.6=No suitable driver
// SQLState: 08 - connection exception
// 001 - SQL-client unable to establish SQL-connection
- throw new SQLException(Messages.getString("sql.6"), "08001"); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new SQLException("No suitable driver", "08001");
}
/**
diff --git a/sql/src/main/java/java/sql/SQLWarning.java b/sql/src/main/java/java/sql/SQLWarning.java
index 3ef67f5..9089984 100644
--- a/sql/src/main/java/java/sql/SQLWarning.java
+++ b/sql/src/main/java/java/sql/SQLWarning.java
@@ -19,8 +19,6 @@ package java.sql;
import java.io.Serializable;
-import org.apache.harmony.sql.internal.nls.Messages;
-
/**
* An exception class that holds information about Database access warnings.
*/
@@ -95,7 +93,7 @@ public class SQLWarning extends SQLException implements Serializable {
if (next instanceof SQLWarning) {
return (SQLWarning) next;
}
- throw new Error(Messages.getString("sql.8")); //$NON-NLS-1$
+ throw new Error("SQLWarning chain holds value that is not a SQLWarning");
}
/**
diff --git a/sql/src/main/java/java/sql/Timestamp.java b/sql/src/main/java/java/sql/Timestamp.java
index f16d93a..9f5ef31 100644
--- a/sql/src/main/java/java/sql/Timestamp.java
+++ b/sql/src/main/java/java/sql/Timestamp.java
@@ -22,8 +22,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
-import org.apache.harmony.sql.internal.nls.Messages;
-
/**
* A Java representation of the SQL {@code TIMESTAMP} type. It provides the
* capability of representing the SQL {@code TIMESTAMP} nanosecond value, in
@@ -51,7 +49,7 @@ public class Timestamp extends Date {
private int nanos;
// The regex pattern of yyyy-mm-dd hh:mm:ss
- private static final String TIME_FORMAT_REGEX = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.*"; //$NON-NLS-1$
+ private static final String TIME_FORMAT_REGEX = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.*";
/**
* Returns a {@code Timestamp} corresponding to the time specified by the
@@ -302,8 +300,7 @@ public class Timestamp extends Date {
*/
public void setNanos(int n) throws IllegalArgumentException {
if ((n < 0) || (n > 999999999)) {
- // sql.0=Value out of range
- throw new IllegalArgumentException(Messages.getString("sql.0")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Value out of range");
}
nanos = n;
}
@@ -379,7 +376,7 @@ public class Timestamp extends Date {
return sb.toString();
}
- private static final String PADDING = "000000000"; //$NON-NLS-1$
+ private static final String PADDING = "000000000";
/*
* Private method to format the time
@@ -407,17 +404,16 @@ public class Timestamp extends Date {
*/
public static Timestamp valueOf(String s) throws IllegalArgumentException {
if (s == null) {
- // sql.3=Argument cannot be null
- throw new IllegalArgumentException(Messages.getString("sql.3")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Argument cannot be null");
}
- // omit trailing whitespaces
+ // omit trailing whitespace
s = s.trim();
if (!Pattern.matches(TIME_FORMAT_REGEX, s)) {
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ throw badTimestampString(s);
}
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pp = new ParsePosition(0);
/*
@@ -431,11 +427,11 @@ public class Timestamp extends Date {
try {
theDate = df.parse(s, pp);
} catch (Exception e) {
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ throw badTimestampString(s);
}
if (theDate == null) {
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ throw badTimestampString(s);
}
/*
@@ -458,23 +454,22 @@ public class Timestamp extends Date {
* Case where fraction of a second is specified: Require 1 character
* plus the "." in the remaining part of the string...
*/
- if ((s.length() - position) < ".n".length()) { //$NON-NLS-1$
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ if ((s.length() - position) < ".n".length()) {
+ throw badTimestampString(s);
}
/*
* If we're strict, we should not allow any EXTRA characters after
* the 9 digits
*/
- if ((s.length() - position) > ".nnnnnnnnn".length()) { //$NON-NLS-1$
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ if ((s.length() - position) > ".nnnnnnnnn".length()) {
+ throw badTimestampString(s);
}
// Require the next character to be a "."
if (s.charAt(position) != '.') {
- // sql.4=Bad input string format: expected '.' not {0}
- throw new NumberFormatException(Messages.getString(
- "sql.4", s.charAt(position))); //$NON-NLS-1$
+ throw new NumberFormatException("Bad input string format: expected '.' not '" +
+ s.charAt(position) + "'");
}
// Get the length of the number string - need to account for the '.'
int nanoLength = s.length() - position - 1;
@@ -486,19 +481,19 @@ public class Timestamp extends Date {
* We must adjust for the cases where the nanos String was not 9
* characters long by padding out with zeros
*/
- theNanoString = theNanoString + "000000000"; //$NON-NLS-1$
+ theNanoString = theNanoString + "000000000";
theNanoString = theNanoString.substring(0, 9);
try {
theNanos = Integer.parseInt(theNanoString);
} catch (Exception e) {
// If we get here, the string was not a number
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ throw badTimestampString(s);
}
}
if (theNanos < 0 || theNanos > 999999999) {
- throw new IllegalArgumentException(Messages.getString("sql.2")); //$NON-NLS-1$
+ throw badTimestampString(s);
}
Timestamp theTimestamp = new Timestamp(theDate.getTime());
@@ -506,4 +501,9 @@ public class Timestamp extends Date {
return theTimestamp;
}
+
+ private static IllegalArgumentException badTimestampString(String s) {
+ throw new IllegalArgumentException("Timestamp format must be " +
+ "yyyy-mm-dd hh:mm:ss.fffffffff; was '" + s + "'");
+ }
}
diff --git a/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java b/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
deleted file mode 100644
index 234bdc9..0000000
--- a/sql/src/main/java/org/apache/harmony/sql/internal/nls/Messages.java
+++ /dev/null
@@ -1,146 +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.sql.internal.nls;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-// BEGIN android-changed
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-changed
-
-/**
- * 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.sql.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.sql.internal.nls.messages"; //$NON-NLS-1$
- // 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/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties b/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
deleted file mode 100644
index 6927cf2..0000000
--- a/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
+++ /dev/null
@@ -1,61 +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
-sql.0=Value out of range
-sql.1=DriverManager: calling class not authorized to deregister JDBC driver
-sql.2=Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
-sql.3=Argument cannot be null
-sql.4=Bad input string format: expected '.' not {0}
-sql.5=The url cannot be null
-sql.6=No suitable driver
-sql.8=SQLWarning chain holds value that is not a SQLWarning
-sql.9=Cannot instantiate a SerialRef object with a null Ref object
-sql.10=Cannot instantiate a SerialRef object that returns a null base type name
-sql.11=SQLException: {0}
-sql.12=Cannot serialize empty URL instance
-sql.13=Cannot instantiate a SerialBlob object with a null Blob object
-sql.14=Invalid starting position or length
-sql.15=Invalid position in BLOB object set
-sql.16=Invalid offset in byte array set
-sql.17=javax.sql.rowset.serial.SerialException: Length more than what can be truncated
-sql.18=Unsupported operation. SerialBlob cannot return a writable binary stream, unless instantiated with a Blob object that provides a setBinaryStream() implementation
-sql.19=Cannot instantiate a SerialClob object with a null Clob object
-sql.20=Invalid Clob object. Calls to getCharacterStream or getAsciiStream return null which cannot be serialized.
-sql.21=Invalid position in CLOB object set
-sql.22=Invalid position and substring length
-sql.23=Buffer is not sufficient to hold the value
-sql.24=Invalid length for truncate
-sql.25=Unsupported operation. SerialClob is not instantiated with a fully implemented Clob object.
-sql.26=Invalid column count. Cannot be less or equal to zero
-sql.27=Invalid column index :{0}
-sql.28=Invalid SQL type for column
-sql.29=Invalid nullable constant set. Must be either columnNoNulls, columnNullable or columnNullableUnknown
-sql.30=Invalid column display size. Cannot be less than zero
-sql.31=Invalid precision value. Cannot be less than zero
-sql.32=Invalid scale size. Cannot be less than zero
-sql.33=Cannot instantiate a SQLOutputImpl instance with null parameters
-sql.34=Cannot instantiate a SQLInputImpl instance with null parameters
-sql.35=SQLInputImpl exception: Invalid read position
-sql.36=No more attributes
-sql.37=Operation not supported
-sql.38=Object is invalid
-sql.39=Cannot instantiate a SerialArray object with a null Array object
-sql.40=ClassNotFoundException: {0}
-sql.41=Invalid JNDI context supplied
-sql.42=Illegal Argument
-sql.43=The object is not serializable
-sql.44=No logger has been set
diff --git a/text/src/main/java/java/text/AttributedCharacterIterator.java b/text/src/main/java/java/text/AttributedCharacterIterator.java
index 4f260ec..968a589 100644
--- a/text/src/main/java/java/text/AttributedCharacterIterator.java
+++ b/text/src/main/java/java/text/AttributedCharacterIterator.java
@@ -22,8 +22,6 @@ import java.io.Serializable;
import java.util.Map;
import java.util.Set;
-import org.apache.harmony.text.internal.nls.Messages;
-
/**
* Extends the
* {@link CharacterIterator} interface, adding support for iterating over
@@ -48,14 +46,13 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* The value objects are of the type {@code Annotation} which contain
* {@code null}.
*/
- public static final Attribute INPUT_METHOD_SEGMENT = new Attribute(
- "input_method_segment"); //$NON-NLS-1$
+ public static final Attribute INPUT_METHOD_SEGMENT = new Attribute("input_method_segment");
/**
* The attribute describing the language of a character. The value
* objects are of type {@code Locale} or a subtype of it.
*/
- public static final Attribute LANGUAGE = new Attribute("language"); //$NON-NLS-1$
+ public static final Attribute LANGUAGE = new Attribute("language");
/**
* For languages that have different reading directions of text (like
@@ -63,7 +60,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
* used. The value objects are of type {@code Annotation} which
* contain a {@code String}.
*/
- public static final Attribute READING = new Attribute("reading"); //$NON-NLS-1$
+ public static final Attribute READING = new Attribute("reading");
private String name;
@@ -123,11 +120,8 @@ public interface AttributedCharacterIterator extends CharacterIterator {
*/
protected Object readResolve() throws InvalidObjectException {
if (this.getClass() != Attribute.class) {
- // text.0C=cannot resolve subclasses
- throw new InvalidObjectException(Messages.getString("text.0C")); //$NON-NLS-1$
+ throw new InvalidObjectException("cannot resolve subclasses");
}
- // BEGIN android-changed
- // call getName() only once
String name = this.getName();
if (name.equals(INPUT_METHOD_SEGMENT.getName())) {
return INPUT_METHOD_SEGMENT;
@@ -138,9 +132,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
if (name.equals(READING.getName())) {
return READING;
}
- // END android-changed
- // text.02=Unknown attribute
- throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
+ throw new InvalidObjectException("Unknown attribute");
}
/**
diff --git a/text/src/main/java/java/text/AttributedString.java b/text/src/main/java/java/text/AttributedString.java
index fe7aa0c..7295198 100644
--- a/text/src/main/java/java/text/AttributedString.java
+++ b/text/src/main/java/java/text/AttributedString.java
@@ -28,8 +28,6 @@ import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
-import org.apache.harmony.text.internal.nls.Messages;
-
/**
* Holds a string with attributes describing the characters of
* this string.
@@ -389,8 +387,7 @@ public class AttributedString {
*/
public AttributedString(AttributedCharacterIterator iterator) {
if (iterator.getBeginIndex() > iterator.getEndIndex()) {
- // text.0A=Invalid substring range
- throw new IllegalArgumentException(Messages.getString("text.0A")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid substring range");
}
StringBuilder buffer = new StringBuilder();
for (int i = iterator.getBeginIndex(); i < iterator.getEndIndex(); i++) {
@@ -554,8 +551,7 @@ public class AttributedString {
throw new NullPointerException();
}
if (value.length() == 0 && !attributes.isEmpty()) {
- // text.0B=Cannot add attributes to empty string
- throw new IllegalArgumentException(Messages.getString("text.0B")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Cannot add attributes to empty string");
}
text = value;
attributeMap = new HashMap<Attribute, List<Range>>(
diff --git a/text/src/main/java/java/text/Bidi.java b/text/src/main/java/java/text/Bidi.java
index 67ebacc..92ca7ac 100644
--- a/text/src/main/java/java/text/Bidi.java
+++ b/text/src/main/java/java/text/Bidi.java
@@ -15,22 +15,14 @@
* limitations under the License.
*/
-// BEGIN android-note
-// changed from icu.text.Bidi to BidiWrapper
-// END android-note
-
package java.text;
-// BEGIN android-added
import java.awt.font.NumericShaper;
import java.awt.font.TextAttribute;
import java.util.Arrays;
import java.util.LinkedList;
-
import org.apache.harmony.text.BidiRun;
import org.apache.harmony.text.BidiWrapper;
-// END android-added
-import org.apache.harmony.text.internal.nls.Messages;
/**
* Provides the Unicode Bidirectional Algorithm. The algorithm is
@@ -110,16 +102,14 @@ public final class Bidi {
* @param paragraph
* the String containing the paragraph text to perform the
* algorithm.
- * @throws IllegalArgumentException
- * if {@code paragraph} is {@code null}.
+ * @throws IllegalArgumentException if {@code paragraph == null}
* @see java.awt.font.TextAttribute#BIDI_EMBEDDING
* @see java.awt.font.TextAttribute#NUMERIC_SHAPING
* @see java.awt.font.TextAttribute#RUN_DIRECTION
*/
public Bidi(AttributedCharacterIterator paragraph) {
if (paragraph == null) {
- // text.14=paragraph is null
- throw new IllegalArgumentException(Messages.getString("text.14")); //$NON-NLS-1$
+ throw new IllegalArgumentException("paragraph is null");
}
// BEGIN android-added
@@ -231,19 +221,13 @@ public final class Bidi {
}
if (textStart < 0) {
- // text.0D=Negative textStart value {0}
- throw new IllegalArgumentException(Messages.getString(
- "text.0D", textStart)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Negative textStart value " + textStart);
}
if (embStart < 0) {
- // text.10=Negative embStart value {0}
- throw new IllegalArgumentException(Messages.getString(
- "text.10", embStart)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Negative embStart value " + embStart);
}
if (paragraphLength < 0) {
- // text.11=Negative paragraph length {0}
- throw new IllegalArgumentException(Messages.getString(
- "text.11", paragraphLength)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Negative paragraph length " + paragraphLength);
}
// BEGIN android-changed
@@ -396,9 +380,8 @@ public final class Bidi {
*/
public Bidi createLineBidi(int lineStart, int lineLimit) {
if (lineStart < 0 || lineLimit < 0 || lineLimit > length || lineStart > lineLimit) {
- // text.12=Invalid ranges (start={0}, limit={1}, length={2})
- throw new IllegalArgumentException(Messages.getString(
- "text.12", new Object[] { lineStart, lineLimit, length })); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid ranges (start=" + lineStart + ", " +
+ "limit=" + lineLimit + ", length=" + length + ")");
}
char[] text = new char[this.length];
@@ -589,11 +572,9 @@ public final class Bidi {
if (count < 0 || levelStart < 0 || objectStart < 0
|| count > levels.length - levelStart
|| count > objects.length - objectStart) {
- // text.13=Invalid ranges (levels={0}, levelStart={1}, objects={2},
- // objectStart={3}, count={4})
- throw new IllegalArgumentException(Messages.getString("text.13", //$NON-NLS-1$
- new Object[] { levels.length, levelStart, objects.length,
- objectStart, count }));
+ throw new IllegalArgumentException("Invalid ranges (levels=" + levels.length +
+ ", levelStart=" + levelStart + ", objects=" + objects.length +
+ ", objectStart=" + objectStart + ", count=" + count + ")");
}
// BEGIN android-changed
diff --git a/text/src/main/java/java/text/BreakIterator.java b/text/src/main/java/java/text/BreakIterator.java
index f14f728..6031046 100644
--- a/text/src/main/java/java/text/BreakIterator.java
+++ b/text/src/main/java/java/text/BreakIterator.java
@@ -20,7 +20,6 @@ package java.text;
import com.ibm.icu4jni.text.NativeBreakIterator;
import com.ibm.icu4jni.util.Resources;
import java.util.Locale;
-import org.apache.harmony.text.internal.nls.Messages;
/**
* Locates boundaries in text. This class defines a protocol for objects that
diff --git a/text/src/main/java/java/text/DateFormat.java b/text/src/main/java/java/text/DateFormat.java
index 0beaac1..84c544e 100644
--- a/text/src/main/java/java/text/DateFormat.java
+++ b/text/src/main/java/java/text/DateFormat.java
@@ -25,7 +25,6 @@ import java.util.Date;
import java.util.Hashtable;
import java.util.Locale;
import java.util.TimeZone;
-import org.apache.harmony.text.internal.nls.Messages;
/**
* An abstract class for date/time formatting subclasses which formats and
@@ -635,9 +634,7 @@ public abstract class DateFormat extends Format {
ParsePosition position = new ParsePosition(0);
Date date = parse(string, position);
if (position.getIndex() == 0) {
- // text.19=Unparseable date: {0}
- throw new ParseException(
- Messages.getString("text.19", string), position.getErrorIndex()); //$NON-NLS-1$
+ throw new ParseException("Unparseable date " + string, position.getErrorIndex());
}
return date;
}
@@ -756,100 +753,95 @@ public abstract class DateFormat extends Format {
/**
* Marks the era part of a date.
*/
- public final static Field ERA = new Field("era", Calendar.ERA); //$NON-NLS-1$
+ public final static Field ERA = new Field("era", Calendar.ERA);
/**
* Marks the year part of a date.
*/
- public final static Field YEAR = new Field("year", Calendar.YEAR); //$NON-NLS-1$
+ public final static Field YEAR = new Field("year", Calendar.YEAR);
/**
* Marks the month part of a date.
*/
- public final static Field MONTH = new Field("month", Calendar.MONTH); //$NON-NLS-1$
+ public final static Field MONTH = new Field("month", Calendar.MONTH);
/**
* Marks the hour of the day part of a date (0-11).
*/
- public final static Field HOUR_OF_DAY0 = new Field("hour of day", //$NON-NLS-1$
- Calendar.HOUR_OF_DAY);
+ public final static Field HOUR_OF_DAY0 = new Field("hour of day", Calendar.HOUR_OF_DAY);
/**
* Marks the hour of the day part of a date (1-12).
*/
- public final static Field HOUR_OF_DAY1 = new Field("hour of day 1", -1); //$NON-NLS-1$
+ public final static Field HOUR_OF_DAY1 = new Field("hour of day 1", -1);
/**
* Marks the minute part of a time.
*/
- public final static Field MINUTE = new Field("minute", Calendar.MINUTE); //$NON-NLS-1$
+ public final static Field MINUTE = new Field("minute", Calendar.MINUTE);
/**
* Marks the second part of a time.
*/
- public final static Field SECOND = new Field("second", Calendar.SECOND); //$NON-NLS-1$
+ public final static Field SECOND = new Field("second", Calendar.SECOND);
/**
* Marks the millisecond part of a time.
*/
- public final static Field MILLISECOND = new Field("millisecond", //$NON-NLS-1$
- Calendar.MILLISECOND);
+ public final static Field MILLISECOND = new Field("millisecond", Calendar.MILLISECOND);
/**
* Marks the day of the week part of a date.
*/
- public final static Field DAY_OF_WEEK = new Field("day of week", //$NON-NLS-1$
- Calendar.DAY_OF_WEEK);
+ public final static Field DAY_OF_WEEK = new Field("day of week", Calendar.DAY_OF_WEEK);
/**
* Marks the day of the month part of a date.
*/
- public final static Field DAY_OF_MONTH = new Field("day of month", //$NON-NLS-1$
- Calendar.DAY_OF_MONTH);
+ public final static Field DAY_OF_MONTH = new Field("day of month", Calendar.DAY_OF_MONTH);
/**
* Marks the day of the year part of a date.
*/
- public final static Field DAY_OF_YEAR = new Field("day of year", //$NON-NLS-1$
- Calendar.DAY_OF_YEAR);
+ public final static Field DAY_OF_YEAR = new Field("day of year", Calendar.DAY_OF_YEAR);
/**
* Marks the day of the week in the month part of a date.
*/
- public final static Field DAY_OF_WEEK_IN_MONTH = new Field(
- "day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH); //$NON-NLS-1$
+ public final static Field DAY_OF_WEEK_IN_MONTH = new Field("day of week in month",
+ Calendar.DAY_OF_WEEK_IN_MONTH);
/**
* Marks the week of the year part of a date.
*/
- public final static Field WEEK_OF_YEAR = new Field("week of year", //$NON-NLS-1$
+ public final static Field WEEK_OF_YEAR = new Field("week of year",
Calendar.WEEK_OF_YEAR);
/**
* Marks the week of the month part of a date.
*/
- public final static Field WEEK_OF_MONTH = new Field("week of month", //$NON-NLS-1$
+ public final static Field WEEK_OF_MONTH = new Field("week of month",
Calendar.WEEK_OF_MONTH);
/**
* Marks the time indicator part of a date.
*/
- public final static Field AM_PM = new Field("am pm", Calendar.AM_PM); //$NON-NLS-1$
+ public final static Field AM_PM = new Field("am pm", Calendar.AM_PM);
/**
* Marks the hour part of a date (0-11).
*/
- public final static Field HOUR0 = new Field("hour", Calendar.HOUR); //$NON-NLS-1$
+ public final static Field HOUR0 = new Field("hour", Calendar.HOUR);
/**
* Marks the hour part of a date (1-12).
*/
- public final static Field HOUR1 = new Field("hour 1", -1); //$NON-NLS-1$
+ public final static Field HOUR1 = new Field("hour 1", -1);
/**
* Marks the time zone part of a date.
*/
- public final static Field TIME_ZONE = new Field("time zone", -1); //$NON-NLS-1$
+ public final static Field TIME_ZONE = new Field("time zone", -1);
/**
* The calendar field that this field represents.
@@ -912,11 +904,9 @@ public abstract class DateFormat extends Format {
*/
@Override
protected Object readResolve() throws InvalidObjectException {
- if (this.getClass() != Field.class) {
- // text.0C=cannot resolve subclasses
- throw new InvalidObjectException(Messages.getString("text.0C")); //$NON-NLS-1$
+ if (this.getClass() != Field.class) {
+ throw new InvalidObjectException("cannot resolve subclasses");
}
-
if (calendarField != -1) {
try {
Field result = ofCalendarField(calendarField);
@@ -925,9 +915,7 @@ public abstract class DateFormat extends Format {
return result;
}
} catch (IllegalArgumentException e) {
- // text.02=Unknown attribute
- throw new InvalidObjectException(Messages
- .getString("text.02")); //$NON-NLS-1$
+ throw new InvalidObjectException("Unknown attribute");
}
} else {
if (this.equals(TIME_ZONE)) {
@@ -940,26 +928,21 @@ public abstract class DateFormat extends Format {
return HOUR_OF_DAY1;
}
}
- // text.02=Unknown attribute
- throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
+ throw new InvalidObjectException("Unknown attribute");
}
}
private static void checkDateStyle(int style) {
if (!(style == SHORT || style == MEDIUM || style == LONG
|| style == FULL || style == DEFAULT)) {
- // text.0E=Illegal date style: {0}
- throw new IllegalArgumentException(Messages.getString(
- "text.0E", style)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Illegal date style " + style);
}
}
private static void checkTimeStyle(int style) {
if (!(style == SHORT || style == MEDIUM || style == LONG
|| style == FULL || style == DEFAULT)) {
- // text.0F=Illegal time style: {0}
- throw new IllegalArgumentException(Messages.getString(
- "text.0F", style)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Illegal time style " + style);
}
}
}
diff --git a/text/src/main/java/java/text/Format.java b/text/src/main/java/java/text/Format.java
index ff62856..0ebaba5 100644
--- a/text/src/main/java/java/text/Format.java
+++ b/text/src/main/java/java/text/Format.java
@@ -20,11 +20,7 @@ package java.text;
import java.io.Serializable;
import java.security.AccessController;
import java.security.PrivilegedAction;
-// BEGIN android-added
import java.util.Locale;
-// END android-added
-
-import org.apache.harmony.text.internal.nls.Messages;
/**
* The base class for all formats.
@@ -103,19 +99,16 @@ public abstract class Format implements Serializable, Cloneable {
}
if (!quote && (index = fromChars.indexOf(next)) != -1) {
output.append(toChars.charAt(index));
- } else if (check
- && !quote
+ } else if (check && !quote
&& ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) {
- // text.05=Invalid pattern char {0} in {1}
- throw new IllegalArgumentException(Messages.getString(
- "text.05", String.valueOf(next), template)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid pattern character '" + next + "' in " +
+ "'" + template + "'");
} else {
output.append(next);
}
}
if (quote) {
- // text.04=Unterminated quote
- throw new IllegalArgumentException(Messages.getString("text.04")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unterminated quote");
}
return output.toString();
}
@@ -189,9 +182,7 @@ public abstract class Format implements Serializable, Cloneable {
ParsePosition position = new ParsePosition(0);
Object result = parseObject(string, position);
if (position.getIndex() == 0) {
- // text.1C=Format.parseObject(String) parse failure
- throw new ParseException(
- Messages.getString("text.1C"), position.getErrorIndex()); //$NON-NLS-1$
+ throw new ParseException("parse failure", position.getErrorIndex());
}
return result;
}
@@ -263,8 +254,7 @@ public abstract class Format implements Serializable, Cloneable {
}
buffer.append(ch);
}
- // text.07=Unmatched braces in the pattern
- throw new IllegalArgumentException(Messages.getString("text.07")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unmatched braces in the pattern");
}
/**
diff --git a/text/src/main/java/java/text/MessageFormat.java b/text/src/main/java/java/text/MessageFormat.java
index 6c0a0cd..d770869 100644
--- a/text/src/main/java/java/text/MessageFormat.java
+++ b/text/src/main/java/java/text/MessageFormat.java
@@ -28,12 +28,9 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Vector;
-import org.apache.harmony.text.internal.nls.Messages;
-
/**
- * Produces concatenated
- * messages in language-neutral way. Use this class to construct messages
- * displayed for end users.
+ * Produces concatenated messages in language-neutral way. New code
+ * should probably use {@link java.util.Formatter} instead.
* <p>
* {@code MessageFormat} takes a set of objects, formats them and then
* inserts the formatted strings into the pattern at the appropriate places.
@@ -328,11 +325,7 @@ import org.apache.harmony.text.internal.nls.Messages;
* format instances for each thread. If multiple threads access a format
* concurrently, it must be synchronized externally.
*
- * @see java.util.Locale
- * @see Format
- * @see NumberFormat
- * @see DecimalFormat
- * @see ChoiceFormat
+ * @see java.util.Formatter
*/
public class MessageFormat extends Format {
@@ -401,25 +394,19 @@ public class MessageFormat extends Format {
int arg = 0;
int offset = position.getIndex();
if (offset >= length) {
- // text.19=Invalid argument number
- throw new IllegalArgumentException(Messages
- .getString("text.19")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid argument number");
}
// Get argument number
char ch;
while ((ch = template.charAt(offset++)) != '}' && ch != ',') {
if (ch < '0' && ch > '9') {
- // text.19=Invalid argument number
- throw new IllegalArgumentException(Messages
- .getString("text.19")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid argument number");
}
arg = arg * 10 + (ch - '0');
if (arg < 0 || offset >= length) {
- // text.19=Invalid argument number
- throw new IllegalArgumentException(Messages
- .getString("text.19")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid argument number");
}
}
offset--;
@@ -852,9 +839,7 @@ public class MessageFormat extends Format {
ParsePosition position = new ParsePosition(0);
Object[] result = parse(string, position);
if (position.getIndex() == 0) {
- // text.1B=MessageFormat.parseObject(String) parse failure
- throw new ParseException(
- Messages.getString("text.1B"), position.getErrorIndex()); //$NON-NLS-1$
+ throw new ParseException("Parse failure", position.getErrorIndex());
}
return result;
}
@@ -986,20 +971,17 @@ public class MessageFormat extends Format {
private Format parseVariable(String string, ParsePosition position) {
int length = string.length(), offset = position.getIndex();
char ch;
- if (offset >= length
- || ((ch = string.charAt(offset++)) != '}' && ch != ',')) {
- // text.15=Missing element format
- throw new IllegalArgumentException(Messages.getString("text.15")); //$NON-NLS-1$
+ if (offset >= length || ((ch = string.charAt(offset++)) != '}' && ch != ',')) {
+ throw new IllegalArgumentException("Missing element format");
}
position.setIndex(offset);
if (ch == '}') {
return null;
}
- int type = match(string, position, false, new String[] { "time", //$NON-NLS-1$
- "date", "number", "choice" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ int type = match(string, position, false,
+ new String[] { "time", "date", "number", "choice" });
if (type == -1) {
- // text.16=Unknown element format
- throw new IllegalArgumentException(Messages.getString("text.16")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown element format");
}
StringBuffer buffer = new StringBuffer();
ch = string.charAt(position.getIndex() - 1);
@@ -1011,8 +993,8 @@ public class MessageFormat extends Format {
DateFormat.DEFAULT, locale) : DateFormat
.getTimeInstance(DateFormat.DEFAULT, locale);
}
- int dateStyle = match(string, position, true, new String[] {
- "full", "long", "medium", "short" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ int dateStyle = match(string, position, true,
+ new String[] { "full", "long", "medium", "short" });
if (dateStyle == -1) {
Format.upToWithQuotes(string, position, buffer, '}', '{');
return new SimpleDateFormat(buffer.toString(), locale);
@@ -1040,8 +1022,8 @@ public class MessageFormat extends Format {
return NumberFormat.getInstance(locale);
// END android-changed
}
- int numberStyle = match(string, position, true, new String[] {
- "currency", "percent", "integer" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ int numberStyle = match(string, position, true,
+ new String[] { "currency", "percent", "integer" });
if (numberStyle == -1) {
Format.upToWithQuotes(string, position, buffer, '}', '{');
return new DecimalFormat(buffer.toString(),
@@ -1136,15 +1118,15 @@ public class MessageFormat extends Format {
}
private String decodeDecimalFormat(StringBuffer buffer, Format format) {
- buffer.append(",number"); //$NON-NLS-1$
+ buffer.append(",number");
if (format.equals(NumberFormat.getNumberInstance(locale))) {
// Empty block
} else if (format.equals(NumberFormat.getIntegerInstance(locale))) {
- buffer.append(",integer"); //$NON-NLS-1$
+ buffer.append(",integer");
} else if (format.equals(NumberFormat.getCurrencyInstance(locale))) {
- buffer.append(",currency"); //$NON-NLS-1$
+ buffer.append(",currency");
} else if (format.equals(NumberFormat.getPercentInstance(locale))) {
- buffer.append(",percent"); //$NON-NLS-1$
+ buffer.append(",percent");
} else {
buffer.append(',');
return ((DecimalFormat) format).toPattern();
@@ -1153,32 +1135,31 @@ public class MessageFormat extends Format {
}
private String decodeSimpleDateFormat(StringBuffer buffer, Format format) {
- if (format.equals(DateFormat
- .getTimeInstance(DateFormat.DEFAULT, locale))) {
- buffer.append(",time"); //$NON-NLS-1$
+ if (format.equals(DateFormat.getTimeInstance(DateFormat.DEFAULT, locale))) {
+ buffer.append(",time");
} else if (format.equals(DateFormat.getDateInstance(DateFormat.DEFAULT,
locale))) {
- buffer.append(",date"); //$NON-NLS-1$
+ buffer.append(",date");
} else if (format.equals(DateFormat.getTimeInstance(DateFormat.SHORT,
locale))) {
- buffer.append(",time,short"); //$NON-NLS-1$
+ buffer.append(",time,short");
} else if (format.equals(DateFormat.getDateInstance(DateFormat.SHORT,
locale))) {
- buffer.append(",date,short"); //$NON-NLS-1$
+ buffer.append(",date,short");
} else if (format.equals(DateFormat.getTimeInstance(DateFormat.LONG,
locale))) {
- buffer.append(",time,long"); //$NON-NLS-1$
+ buffer.append(",time,long");
} else if (format.equals(DateFormat.getDateInstance(DateFormat.LONG,
locale))) {
- buffer.append(",date,long"); //$NON-NLS-1$
+ buffer.append(",date,long");
} else if (format.equals(DateFormat.getTimeInstance(DateFormat.FULL,
locale))) {
- buffer.append(",time,full"); //$NON-NLS-1$
+ buffer.append(",time,full");
} else if (format.equals(DateFormat.getDateInstance(DateFormat.FULL,
locale))) {
- buffer.append(",date,full"); //$NON-NLS-1$
+ buffer.append(",date,full");
} else {
- buffer.append(",date,"); //$NON-NLS-1$
+ buffer.append(",date,");
return ((SimpleDateFormat) format).toPattern();
}
return null;
@@ -1198,16 +1179,14 @@ public class MessageFormat extends Format {
Format format = formats[i];
String pattern = null;
if (format instanceof ChoiceFormat) {
- buffer.append(",choice,"); //$NON-NLS-1$
+ buffer.append(",choice,");
pattern = ((ChoiceFormat) format).toPattern();
} else if (format instanceof DecimalFormat) {
pattern = decodeDecimalFormat(buffer, format);
} else if (format instanceof SimpleDateFormat) {
pattern = decodeSimpleDateFormat(buffer, format);
} else if (format != null) {
- // text.17=Unknown format
- throw new IllegalArgumentException(Messages
- .getString("text.17")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown format");
}
if (pattern != null) {
boolean quote = false;
@@ -1225,7 +1204,7 @@ public class MessageFormat extends Format {
if (count > 0) {
count--;
} else {
- buffer.append("'}"); //$NON-NLS-1$
+ buffer.append("'}");
ch = '\'';
}
}
@@ -1256,20 +1235,20 @@ public class MessageFormat extends Format {
}
private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("argumentNumbers", int[].class), //$NON-NLS-1$
- new ObjectStreamField("formats", Format[].class), //$NON-NLS-1$
- new ObjectStreamField("locale", Locale.class), //$NON-NLS-1$
- new ObjectStreamField("maxOffset", Integer.TYPE), //$NON-NLS-1$
- new ObjectStreamField("offsets", int[].class), //$NON-NLS-1$
- new ObjectStreamField("pattern", String.class), }; //$NON-NLS-1$
+ new ObjectStreamField("argumentNumbers", int[].class),
+ new ObjectStreamField("formats", Format[].class),
+ new ObjectStreamField("locale", Locale.class),
+ new ObjectStreamField("maxOffset", Integer.TYPE),
+ new ObjectStreamField("offsets", int[].class),
+ new ObjectStreamField("pattern", String.class), };
private void writeObject(ObjectOutputStream stream) throws IOException {
ObjectOutputStream.PutField fields = stream.putFields();
- fields.put("argumentNumbers", argumentNumbers); //$NON-NLS-1$
+ fields.put("argumentNumbers", argumentNumbers);
Format[] compatibleFormats = formats;
- fields.put("formats", compatibleFormats); //$NON-NLS-1$
- fields.put("locale", locale); //$NON-NLS-1$
- fields.put("maxOffset", maxOffset); //$NON-NLS-1$
+ fields.put("formats", compatibleFormats);
+ fields.put("locale", locale);
+ fields.put("maxOffset", maxOffset);
int offset = 0;
int offsetsLength = maxOffset + 1;
int[] offsets = new int[offsetsLength];
@@ -1282,20 +1261,20 @@ public class MessageFormat extends Format {
if (maxOffset + 1 < strings.length) {
pattern.append(strings[maxOffset + 1]);
}
- fields.put("offsets", offsets); //$NON-NLS-1$
- fields.put("pattern", pattern.toString()); //$NON-NLS-1$
+ fields.put("offsets", offsets);
+ fields.put("pattern", pattern.toString());
stream.writeFields();
}
private void readObject(ObjectInputStream stream) throws IOException,
ClassNotFoundException {
ObjectInputStream.GetField fields = stream.readFields();
- argumentNumbers = (int[]) fields.get("argumentNumbers", null); //$NON-NLS-1$
- formats = (Format[]) fields.get("formats", null); //$NON-NLS-1$
- locale = (Locale) fields.get("locale", null); //$NON-NLS-1$
- maxOffset = fields.get("maxOffset", 0); //$NON-NLS-1$
- int[] offsets = (int[]) fields.get("offsets", null); //$NON-NLS-1$
- String pattern = (String) fields.get("pattern", null); //$NON-NLS-1$
+ argumentNumbers = (int[]) fields.get("argumentNumbers", null);
+ formats = (Format[]) fields.get("formats", null);
+ locale = (Locale) fields.get("locale", null);
+ maxOffset = fields.get("maxOffset", 0);
+ int[] offsets = (int[]) fields.get("offsets", null);
+ String pattern = (String) fields.get("pattern", null);
int length;
if (maxOffset < 0) {
length = pattern.length() > 0 ? 1 : 0;
@@ -1330,7 +1309,7 @@ public class MessageFormat extends Format {
/**
* This constant stands for the message argument.
*/
- public static final Field ARGUMENT = new Field("message argument field"); //$NON-NLS-1$
+ public static final Field ARGUMENT = new Field("message argument field");
/**
* Constructs a new instance of {@code MessageFormat.Field} with the
@@ -1354,20 +1333,10 @@ public class MessageFormat extends Format {
@Override
protected Object readResolve() throws InvalidObjectException {
String name = this.getName();
- if (name == null) {
- // text.18=Not a valid {0}, subclass should override
- // readResolve()
- throw new InvalidObjectException(Messages.getString(
- "text.18", "MessageFormat.Field")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (name.equals(ARGUMENT.getName())) {
+ if (name != null && name.equals(ARGUMENT.getName())) {
return ARGUMENT;
}
- // text.18=Not a valid {0}, subclass should override readResolve()
- throw new InvalidObjectException(Messages.getString(
- "text.18", "MessageFormat.Field")); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new InvalidObjectException("Not a valid MessageFormat.Field, subclass should override readResolve()");
}
}
-
}
diff --git a/text/src/main/java/java/text/NumberFormat.java b/text/src/main/java/java/text/NumberFormat.java
index 52788bd..ace2697 100644
--- a/text/src/main/java/java/text/NumberFormat.java
+++ b/text/src/main/java/java/text/NumberFormat.java
@@ -28,7 +28,6 @@ import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.Currency;
import java.util.Locale;
-import org.apache.harmony.text.internal.nls.Messages;
/**
* The abstract base class for all number formats. This class provides the
@@ -553,9 +552,7 @@ public abstract class NumberFormat extends Format {
ParsePosition pos = new ParsePosition(0);
Number number = parse(string, pos);
if (pos.getIndex() == 0) {
- // text.1D=Unparseable number: {0}
- throw new ParseException(
- Messages.getString("text.1D", string), pos.getErrorIndex()); //$NON-NLS-1$
+ throw new ParseException("Unparseable number" + string, pos.getErrorIndex());
}
return number;
}
@@ -583,10 +580,8 @@ public abstract class NumberFormat extends Format {
@Override
public final Object parseObject(String string, ParsePosition position) {
if (position == null) {
- // text.1A=position is null
- throw new NullPointerException(Messages.getString("text.1A")); //$NON-NLS-1$
+ throw new NullPointerException("position is null");
}
-
try {
return parse(string, position);
} catch (Exception e) {
@@ -695,75 +690,64 @@ public abstract class NumberFormat extends Format {
}
private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("groupingUsed", Boolean.TYPE), //$NON-NLS-1$
- new ObjectStreamField("maxFractionDigits", Byte.TYPE), //$NON-NLS-1$
- new ObjectStreamField("maximumFractionDigits", Integer.TYPE), //$NON-NLS-1$
- new ObjectStreamField("maximumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
- new ObjectStreamField("maxIntegerDigits", Byte.TYPE), //$NON-NLS-1$
- new ObjectStreamField("minFractionDigits", Byte.TYPE), //$NON-NLS-1$
- new ObjectStreamField("minimumFractionDigits", Integer.TYPE), //$NON-NLS-1$
- new ObjectStreamField("minimumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
- new ObjectStreamField("minIntegerDigits", Byte.TYPE), //$NON-NLS-1$
- new ObjectStreamField("parseIntegerOnly", Boolean.TYPE), //$NON-NLS-1$
- new ObjectStreamField("serialVersionOnStream", Integer.TYPE), }; //$NON-NLS-1$
+ new ObjectStreamField("groupingUsed", Boolean.TYPE),
+ new ObjectStreamField("maxFractionDigits", Byte.TYPE),
+ new ObjectStreamField("maximumFractionDigits", Integer.TYPE),
+ new ObjectStreamField("maximumIntegerDigits", Integer.TYPE),
+ new ObjectStreamField("maxIntegerDigits", Byte.TYPE),
+ new ObjectStreamField("minFractionDigits", Byte.TYPE),
+ new ObjectStreamField("minimumFractionDigits", Integer.TYPE),
+ new ObjectStreamField("minimumIntegerDigits", Integer.TYPE),
+ new ObjectStreamField("minIntegerDigits", Byte.TYPE),
+ new ObjectStreamField("parseIntegerOnly", Boolean.TYPE),
+ new ObjectStreamField("serialVersionOnStream", Integer.TYPE), };
private void writeObject(ObjectOutputStream stream) throws IOException {
ObjectOutputStream.PutField fields = stream.putFields();
- fields.put("groupingUsed", groupingUsed); //$NON-NLS-1$
- fields
- .put(
- "maxFractionDigits", //$NON-NLS-1$
+ fields.put("groupingUsed", groupingUsed);
+ fields.put("maxFractionDigits",
maximumFractionDigits < Byte.MAX_VALUE ? (byte) maximumFractionDigits
: Byte.MAX_VALUE);
- fields.put("maximumFractionDigits", maximumFractionDigits); //$NON-NLS-1$
- fields.put("maximumIntegerDigits", maximumIntegerDigits); //$NON-NLS-1$
- fields
- .put(
- "maxIntegerDigits", //$NON-NLS-1$
+ fields.put("maximumFractionDigits", maximumFractionDigits);
+ fields.put("maximumIntegerDigits", maximumIntegerDigits);
+ fields.put("maxIntegerDigits",
maximumIntegerDigits < Byte.MAX_VALUE ? (byte) maximumIntegerDigits
: Byte.MAX_VALUE);
- fields
- .put(
- "minFractionDigits", //$NON-NLS-1$
+ fields.put("minFractionDigits",
minimumFractionDigits < Byte.MAX_VALUE ? (byte) minimumFractionDigits
: Byte.MAX_VALUE);
- fields.put("minimumFractionDigits", minimumFractionDigits); //$NON-NLS-1$
- fields.put("minimumIntegerDigits", minimumIntegerDigits); //$NON-NLS-1$
- fields
- .put(
- "minIntegerDigits", //$NON-NLS-1$
- minimumIntegerDigits < Byte.MAX_VALUE ? (byte) minimumIntegerDigits
- : Byte.MAX_VALUE);
- fields.put("parseIntegerOnly", parseIntegerOnly); //$NON-NLS-1$
- fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
+ fields.put("minimumFractionDigits", minimumFractionDigits);
+ fields.put("minimumIntegerDigits", minimumIntegerDigits);
+ fields.put("minIntegerDigits",
+ minimumIntegerDigits < Byte.MAX_VALUE ? (byte) minimumIntegerDigits : Byte.MAX_VALUE);
+ fields.put("parseIntegerOnly", parseIntegerOnly);
+ fields.put("serialVersionOnStream", 1);
stream.writeFields();
}
private void readObject(ObjectInputStream stream) throws IOException,
ClassNotFoundException {
ObjectInputStream.GetField fields = stream.readFields();
- groupingUsed = fields.get("groupingUsed", true); //$NON-NLS-1$
- parseIntegerOnly = fields.get("parseIntegerOnly", false); //$NON-NLS-1$
- if (fields.get("serialVersionOnStream", 0) == 0) { //$NON-NLS-1$
- maximumFractionDigits = fields.get("maxFractionDigits", (byte) 3); //$NON-NLS-1$
- maximumIntegerDigits = fields.get("maxIntegerDigits", (byte) 40); //$NON-NLS-1$
- minimumFractionDigits = fields.get("minFractionDigits", (byte) 0); //$NON-NLS-1$
- minimumIntegerDigits = fields.get("minIntegerDigits", (byte) 1); //$NON-NLS-1$
+ groupingUsed = fields.get("groupingUsed", true);
+ parseIntegerOnly = fields.get("parseIntegerOnly", false);
+ if (fields.get("serialVersionOnStream", 0) == 0) {
+ maximumFractionDigits = fields.get("maxFractionDigits", (byte) 3);
+ maximumIntegerDigits = fields.get("maxIntegerDigits", (byte) 40);
+ minimumFractionDigits = fields.get("minFractionDigits", (byte) 0);
+ minimumIntegerDigits = fields.get("minIntegerDigits", (byte) 1);
} else {
- maximumFractionDigits = fields.get("maximumFractionDigits", 3); //$NON-NLS-1$
- maximumIntegerDigits = fields.get("maximumIntegerDigits", 40); //$NON-NLS-1$
- minimumFractionDigits = fields.get("minimumFractionDigits", 0); //$NON-NLS-1$
- minimumIntegerDigits = fields.get("minimumIntegerDigits", 1); //$NON-NLS-1$
+ maximumFractionDigits = fields.get("maximumFractionDigits", 3);
+ maximumIntegerDigits = fields.get("maximumIntegerDigits", 40);
+ minimumFractionDigits = fields.get("minimumFractionDigits", 0);
+ minimumIntegerDigits = fields.get("minimumIntegerDigits", 1);
}
if (minimumIntegerDigits > maximumIntegerDigits
|| minimumFractionDigits > maximumFractionDigits) {
- // text.00=min digits greater than max digits
- throw new InvalidObjectException(Messages.getString("text.00")); //$NON-NLS-1$
+ throw new InvalidObjectException("min digits greater than max digits");
}
if (minimumIntegerDigits < 0 || maximumIntegerDigits < 0
|| minimumFractionDigits < 0 || maximumFractionDigits < 0) {
- // text.01=min or max digits negative
- throw new InvalidObjectException(Messages.getString("text.01")); //$NON-NLS-1$
+ throw new InvalidObjectException("min or max digits negative");
}
}
@@ -783,59 +767,57 @@ public abstract class NumberFormat extends Format {
/**
* This constant stands for the number sign.
*/
- public static final Field SIGN = new Field("sign"); //$NON-NLS-1$
+ public static final Field SIGN = new Field("sign");
/**
* This constant stands for the integer part of the number.
*/
- public static final Field INTEGER = new Field("integer"); //$NON-NLS-1$
+ public static final Field INTEGER = new Field("integer");
/**
* This constant stands for the fraction part of the number.
*/
- public static final Field FRACTION = new Field("fraction"); //$NON-NLS-1$
+ public static final Field FRACTION = new Field("fraction");
/**
* This constant stands for the exponent part of the number.
*/
- public static final Field EXPONENT = new Field("exponent"); //$NON-NLS-1$
+ public static final Field EXPONENT = new Field("exponent");
/**
* This constant stands for the exponent sign symbol.
*/
- public static final Field EXPONENT_SIGN = new Field("exponent sign"); //$NON-NLS-1$
+ public static final Field EXPONENT_SIGN = new Field("exponent sign");
/**
* This constant stands for the exponent symbol.
*/
- public static final Field EXPONENT_SYMBOL = new Field("exponent symbol"); //$NON-NLS-1$
+ public static final Field EXPONENT_SYMBOL = new Field("exponent symbol");
/**
* This constant stands for the decimal separator.
*/
- public static final Field DECIMAL_SEPARATOR = new Field(
- "decimal separator"); //$NON-NLS-1$
+ public static final Field DECIMAL_SEPARATOR = new Field("decimal separator");
/**
* This constant stands for the grouping separator.
*/
- public static final Field GROUPING_SEPARATOR = new Field(
- "grouping separator"); //$NON-NLS-1$
+ public static final Field GROUPING_SEPARATOR = new Field("grouping separator");
/**
* This constant stands for the percent symbol.
*/
- public static final Field PERCENT = new Field("percent"); //$NON-NLS-1$
+ public static final Field PERCENT = new Field("percent");
/**
* This constant stands for the permille symbol.
*/
- public static final Field PERMILLE = new Field("per mille"); //$NON-NLS-1$
+ public static final Field PERMILLE = new Field("per mille");
/**
* This constant stands for the currency symbol.
*/
- public static final Field CURRENCY = new Field("currency"); //$NON-NLS-1$
+ public static final Field CURRENCY = new Field("currency");
/**
* Constructs a new instance of {@code NumberFormat.Field} with the
@@ -891,8 +873,7 @@ public abstract class NumberFormat extends Format {
if (this.equals(SIGN)) {
return SIGN;
}
- // text.02=Unknown attribute
- throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
+ throw new InvalidObjectException("Unknown attribute");
}
}
diff --git a/text/src/main/java/java/text/RuleBasedCollator.java b/text/src/main/java/java/text/RuleBasedCollator.java
index 6954d8c..77492b5 100644
--- a/text/src/main/java/java/text/RuleBasedCollator.java
+++ b/text/src/main/java/java/text/RuleBasedCollator.java
@@ -17,8 +17,6 @@
package java.text;
-import org.apache.harmony.text.internal.nls.Messages;
-
/**
* A concrete implementation class for {@code Collation}.
* <p>
@@ -30,7 +28,7 @@ import org.apache.harmony.text.internal.nls.Messages;
* <li> All non-mentioned Unicode characters are at the end of the collation
* order.</li>
* <li> If a character is not located in the {@code RuleBasedCollator}, the
- * default Unicode Collation Algorithm (UCA) rulebased table is automatically
+ * default Unicode Collation Algorithm (UCA) rule-based table is automatically
* searched as a backup.</li>
* </ol>
* <p>
@@ -288,26 +286,16 @@ public class RuleBasedCollator extends Collator {
if (rules == null) {
throw new NullPointerException();
}
- // BEGIN android-removed
- // if (rules.length() == 0) {
- // // text.06=Build rules empty
- // throw new ParseException(Messages.getString("text.06"), 0); //$NON-NLS-1$
- // }
- // END andriod-removed
-
try {
this.icuColl = new com.ibm.icu4jni.text.RuleBasedCollator(rules);
- // BEGIN android-added
- this.icuColl.setDecomposition(
- com.ibm.icu4jni.text.Collator.CANONICAL_DECOMPOSITION);
- // END android-added
+ this.icuColl.setDecomposition(com.ibm.icu4jni.text.Collator.CANONICAL_DECOMPOSITION);
} catch (Exception e) {
if (e instanceof ParseException) {
throw (ParseException) e;
}
/*
* -1 means it's not a ParseException. Maybe IOException thrown when
- * an error occured while reading internal data.
+ * an error occurred while reading internal data.
*/
throw new ParseException(e.getMessage(), -1);
}
@@ -401,8 +389,7 @@ public class RuleBasedCollator extends Collator {
@Override
public int compare(String source, String target) {
if (source == null || target == null) {
- // text.08=one of arguments is null
- throw new NullPointerException(Messages.getString("text.08")); //$NON-NLS-1$
+ throw new NullPointerException();
}
return this.icuColl.compare(source, target);
}
diff --git a/text/src/main/java/java/text/SimpleDateFormat.java b/text/src/main/java/java/text/SimpleDateFormat.java
index 6057b23..e3669ad 100644
--- a/text/src/main/java/java/text/SimpleDateFormat.java
+++ b/text/src/main/java/java/text/SimpleDateFormat.java
@@ -17,6 +17,8 @@
package java.text;
+import com.ibm.icu4jni.util.LocaleData;
+import com.ibm.icu4jni.util.Resources;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -25,16 +27,10 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
-// BEGIN android-added
import java.util.SimpleTimeZone;
import java.util.TimeZone;
-// END android-added
import java.util.Vector;
-import com.ibm.icu4jni.util.LocaleData;
-import com.ibm.icu4jni.util.Resources;
-import org.apache.harmony.text.internal.nls.Messages;
-
/**
* A concrete class for formatting and parsing dates in a locale-sensitive
* manner. It allows for formatting (date to text), parsing (text to date) and
@@ -363,9 +359,7 @@ public class SimpleDateFormat extends DateFormat {
private void validateFormat(char format) {
int index = patternChars.indexOf(format);
if (index == -1) {
- // text.03=Unknown pattern character - '{0}'
- throw new IllegalArgumentException(Messages.getString(
- "text.03", format)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown pattern character '" + format + "'");
}
}
@@ -424,10 +418,8 @@ public class SimpleDateFormat extends DateFormat {
}
if (quote) {
- // text.04=Unterminated quote {0}
- throw new IllegalArgumentException(Messages.getString("text.04")); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unterminated quote");
}
-
}
/**
@@ -742,9 +734,7 @@ public class SimpleDateFormat extends DateFormat {
int field = -1;
int index = patternChars.indexOf(format);
if (index == -1) {
- // text.03=Unknown pattern character - '{0}'
- throw new IllegalArgumentException(Messages.getString(
- "text.03", format)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown pattern character '" + format + "'");
}
int beginPosition = buffer.length();
@@ -1010,9 +1000,7 @@ public class SimpleDateFormat extends DateFormat {
private int parse(String string, int offset, char format, int count) {
int index = patternChars.indexOf(format);
if (index == -1) {
- // text.03=Unknown pattern character - '{0}'
- throw new IllegalArgumentException(Messages.getString(
- "text.03", format)); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown pattern character '" + format + "'");
}
int field = -1;
int absolute = 0;
@@ -1294,7 +1282,7 @@ public class SimpleDateFormat extends DateFormat {
// BEGIN android-changed
String[][] zones = formatData.internalZoneStrings();
// END android-changed
- boolean foundGMT = string.regionMatches(offset, "GMT", 0, 3); //$NON-NLS-1$
+ boolean foundGMT = string.regionMatches(offset, "GMT", 0, 3);
if (foundGMT) {
offset += 3;
}
@@ -1323,11 +1311,11 @@ public class SimpleDateFormat extends DateFormat {
if (sign == '-') {
raw = -raw;
}
- calendar.setTimeZone(new SimpleTimeZone(raw, "")); //$NON-NLS-1$
+ calendar.setTimeZone(new SimpleTimeZone(raw, ""));
return position.getIndex();
}
if (foundGMT) {
- calendar.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
+ calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
return offset;
}
for (String[] element : zones) {
@@ -1342,7 +1330,7 @@ public class SimpleDateFormat extends DateFormat {
if (j >= 3 && zone.useDaylightTime()) {
raw += 3600000;
}
- calendar.setTimeZone(new SimpleTimeZone(raw, "")); //$NON-NLS-1$
+ calendar.setTimeZone(new SimpleTimeZone(raw, ""));
return offset + element[j].length();
}
}
@@ -1407,32 +1395,32 @@ public class SimpleDateFormat extends DateFormat {
}
private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("defaultCenturyStart", Date.class), //$NON-NLS-1$
- new ObjectStreamField("formatData", DateFormatSymbols.class), //$NON-NLS-1$
- new ObjectStreamField("pattern", String.class), //$NON-NLS-1$
- new ObjectStreamField("serialVersionOnStream", Integer.TYPE), }; //$NON-NLS-1$
+ new ObjectStreamField("defaultCenturyStart", Date.class),
+ new ObjectStreamField("formatData", DateFormatSymbols.class),
+ new ObjectStreamField("pattern", String.class),
+ new ObjectStreamField("serialVersionOnStream", Integer.TYPE), };
private void writeObject(ObjectOutputStream stream) throws IOException {
ObjectOutputStream.PutField fields = stream.putFields();
- fields.put("defaultCenturyStart", defaultCenturyStart); //$NON-NLS-1$
- fields.put("formatData", formatData); //$NON-NLS-1$
- fields.put("pattern", pattern); //$NON-NLS-1$
- fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
+ fields.put("defaultCenturyStart", defaultCenturyStart);
+ fields.put("formatData", formatData);
+ fields.put("pattern", pattern);
+ fields.put("serialVersionOnStream", 1);
stream.writeFields();
}
private void readObject(ObjectInputStream stream) throws IOException,
ClassNotFoundException {
ObjectInputStream.GetField fields = stream.readFields();
- int version = fields.get("serialVersionOnStream", 0); //$NON-NLS-1$
+ int version = fields.get("serialVersionOnStream", 0);
Date date;
if (version > 0) {
- date = (Date) fields.get("defaultCenturyStart", new Date()); //$NON-NLS-1$
+ date = (Date) fields.get("defaultCenturyStart", new Date());
} else {
date = new Date();
}
set2DigitYearStart(date);
- formatData = (DateFormatSymbols) fields.get("formatData", null); //$NON-NLS-1$
- pattern = (String) fields.get("pattern", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ formatData = (DateFormatSymbols) fields.get("formatData", null);
+ pattern = (String) fields.get("pattern", "");
}
}
diff --git a/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java b/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java
deleted file mode 100644
index 95a8ad6..0000000
--- a/text/src/main/java/org/apache/harmony/text/internal/nls/Messages.java
+++ /dev/null
@@ -1,146 +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.text.internal.nls;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-// BEGIN android-changed
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-changed
-
-/**
- * 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.text.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.text.internal.nls.messages"; //$NON-NLS-1$
- // 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/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties b/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
deleted file mode 100644
index b80cde2..0000000
--- a/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
+++ /dev/null
@@ -1,49 +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
-text.00=min digits greater than max digits
-text.01=min or max digits negative
-text.02=Unknown attribute
-text.03=Unknown pattern character - '{0}'
-text.04=Unterminated quote
-text.05=Invalid pattern char {0} in {1}
-text.07=Unmatched braces in the pattern
-text.06=Build rules empty
-text.08=one of arguments is null
-text.09=The deserialized date is invalid
-text.0A=Invalid substring range
-text.0B=Cannot add attributes to empty string
-text.0C=cannot resolve subclasses
-text.0E=Illegal date style: {0}
-text.0F=Illegal time style: {0}
-text.0D=Negative textStart value {0}
-text.10=Negative embStart value {0}
-text.11=Negative paragraph length {0}
-text.12=Invalid ranges (start={0}, limit={1}, length={2})
-text.13=Invalid ranges (levels={0}, levelStart={1}, objects={2}, objectStart={3}, count={4})
-text.14=paragraph is null
-text.19=Invalid argument number
-text.15=Missing element format
-text.16=Unknown element format
-text.17=Unknown format
-text.18=Not a valid {0}, subclass should override readResolve()
-text.19=Unparseable date: {0}
-text.1A=position is null
-text.1B=MessageFormat.parseObject(String) parse failure
-text.1C=Format.parseObject(String) parse failure
-text.1D=Unparseable number: {0}
-text.1E=Offset out of bounds \: {0}
diff --git a/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/Messages.java b/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/Messages.java
deleted file mode 100644
index e9f2b0e..0000000
--- a/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/Messages.java
+++ /dev/null
@@ -1,147 +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.xnet.internal.nls;
-
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-// BEGIN android-changed
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-changed
-
-/**
- * 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.xnet.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.xnet.internal.nls.messages"; //$NON-NLS-1$
- // 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/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/messages.properties b/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/messages.properties
deleted file mode 100644
index 229ca61..0000000
--- a/x-net/src/main/java/org/apache/harmony/xnet/internal/nls/messages.properties
+++ /dev/null
@@ -1,17 +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 \ No newline at end of file