Refactor nls messages to use new message mechanism.
git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk@909389 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties b/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties
index 8869880..63a6e28 100644
--- a/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties
+++ b/modules/luni/src/main/java/org/apache/harmony/luni/internal/nls/messages.properties
@@ -26,3 +26,15 @@
luni.09=Invalid Unicode sequence: illegal character
luni.0A=Index: {0}, Size: {1}
luni.0B=Array index out of range: {0}
+luni.0C=Socket is closed
+luni.0D=SOCKS connection failed\: {0}
+luni.0E=Unable to connect to SOCKS server\: {0}
+luni.0F=Invalid SOCKS client.
+luni.10=Malformed reply from SOCKS server
+luni.11=buffer is null
+luni.12=Offset out of bounds \: {0}
+luni.13=Arguments out of bounds
+luni.14=Failure to connect to SOCKS server.
+luni.15=Unable to connect to identd to verify user.
+luni.16=Failure - user ids do not match.
+luni.17=Success
diff --git a/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java b/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
index 6bf6294..e09d52f 100644
--- a/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
+++ b/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
@@ -38,7 +38,7 @@
import org.apache.harmony.luni.platform.INetworkSystem;
import org.apache.harmony.luni.platform.Platform;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.luni.internal.nls.Messages;
/**
* A concrete connected-socket implementation.
@@ -271,7 +271,7 @@
@Override
protected synchronized InputStream getInputStream() throws IOException {
if (!fd.valid()) {
- throw new SocketException(Msg.getString("K003d"));
+ throw new SocketException(Messages.getString("luni.0C"));
}
return new SocketInputStream(this);
@@ -298,7 +298,7 @@
@Override
protected synchronized OutputStream getOutputStream() throws IOException {
if (!fd.valid()) {
- throw new SocketException(Msg.getString("K003d")); //$NON-NLS-1$
+ throw new SocketException(Messages.getString("luni.0C")); //$NON-NLS-1$
}
return new SocketOutputStream(this);
}
@@ -394,7 +394,7 @@
}
} catch (Exception e) {
- throw new SocketException(Msg.getString("K003e", e)); //$NON-NLS-1$
+ throw new SocketException(Messages.getString("luni.0D", e)); //$NON-NLS-1$
}
socksRequestConnection(applicationServerAddress, applicationServerPort);
@@ -454,13 +454,13 @@
netImpl.connect(fd, trafficClass, socksGetServerAddress(),
socksGetServerPort());
} catch (Exception e) {
- throw new IOException(Msg.getString("K003f", e)); //$NON-NLS-1$
+ throw new IOException(Messages.getString("luni.0E", e)); //$NON-NLS-1$
}
// There must be a connection to an application host for the bind to
// work.
if (lastConnectedAddress == null) {
- throw new SocketException(Msg.getString("K0040")); //$NON-NLS-1$
+ throw new SocketException(Messages.getString("luni.0F")); //$NON-NLS-1$
}
// Use the last connected address and port in the bind request.
@@ -517,7 +517,7 @@
bytesRead += count;
}
if (Socks4Message.REPLY_LENGTH != bytesRead) {
- throw new SocketException(Msg.getString("KA011")); //$NON-NLS-1$
+ throw new SocketException(Messages.getString("luni.10")); //$NON-NLS-1$
}
return reply;
}
diff --git a/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketInputStream.java b/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketInputStream.java
index d19206d..e776505 100644
--- a/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketInputStream.java
+++ b/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketInputStream.java
@@ -22,7 +22,7 @@
import java.net.Socket;
import java.net.SocketImpl;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.luni.internal.nls.Messages;
/**
* The SocketInputStream supports the streamed reading of bytes from a socket.
@@ -70,7 +70,7 @@
@Override
public int read(byte[] buffer, int offset, int count) throws IOException {
if (null == buffer) {
- throw new IOException(Msg.getString("K0047"));//$NON-NLS-1$
+ throw new IOException(Messages.getString("luni.11"));//$NON-NLS-1$
}
if (0 == count) {
@@ -79,10 +79,10 @@
if (0 > offset || offset >= buffer.length) {
// K002e=Offset out of bounds \: {0}
- throw new ArrayIndexOutOfBoundsException(Msg.getString("K002e", offset));//$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.12", offset));//$NON-NLS-1$
}
if (0 > count || offset + count > buffer.length) {
- throw new ArrayIndexOutOfBoundsException(Msg.getString("K002f"));//$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.13"));//$NON-NLS-1$
}
return socket.read(buffer, offset, count);
diff --git a/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketOutputStream.java b/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketOutputStream.java
index df21d0f..ede93dc 100644
--- a/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketOutputStream.java
+++ b/modules/luni/src/main/java/org/apache/harmony/luni/net/SocketOutputStream.java
@@ -22,7 +22,7 @@
import java.net.Socket;
import java.net.SocketImpl;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.luni.internal.nls.Messages;
class SocketOutputStream extends OutputStream {
@@ -58,10 +58,10 @@
&& count <= buffer.length - offset) {
socket.write(buffer, offset, count);
} else {
- throw new ArrayIndexOutOfBoundsException(Msg.getString("K002f"));//$NON-NLS-1$
+ throw new ArrayIndexOutOfBoundsException(Messages.getString("luni.13"));//$NON-NLS-1$
}
} else {
- throw new NullPointerException(Msg.getString("K0047"));//$NON-NLS-1$
+ throw new NullPointerException(Messages.getString("luni.11"));//$NON-NLS-1$
}
}
diff --git a/modules/luni/src/main/java/org/apache/harmony/luni/net/Socks4Message.java b/modules/luni/src/main/java/org/apache/harmony/luni/net/Socks4Message.java
index e3975d6..f7a22b7 100644
--- a/modules/luni/src/main/java/org/apache/harmony/luni/net/Socks4Message.java
+++ b/modules/luni/src/main/java/org/apache/harmony/luni/net/Socks4Message.java
@@ -19,7 +19,7 @@
import java.io.UnsupportedEncodingException;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.luni.internal.nls.Messages;
class Socks4Message {
static final int COMMAND_CONNECT = 1;
@@ -162,13 +162,13 @@
public String getErrorString(int error) {
switch (error) {
case RETURN_FAILURE:
- return Msg.getString("K00cd"); //$NON-NLS-1$
+ return Messages.getString("luni.14"); //$NON-NLS-1$
case RETURN_CANNOT_CONNECT_TO_IDENTD:
- return Msg.getString("K00ce"); //$NON-NLS-1$
+ return Messages.getString("luni.15"); //$NON-NLS-1$
case RETURN_DIFFERENT_USER_IDS:
- return Msg.getString("K00cf"); //$NON-NLS-1$
+ return Messages.getString("luni.16"); //$NON-NLS-1$
default:
- return Msg.getString("K00d0"); //$NON-NLS-1$
+ return Messages.getString("luni.17"); //$NON-NLS-1$
}
}