More nls refactoring. git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk@909579 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/modules/luni/src/main/java/java/net/DatagramPacket.java b/modules/luni/src/main/java/java/net/DatagramPacket.java index 25ec85e..2a96454 100644 --- a/modules/luni/src/main/java/java/net/DatagramPacket.java +++ b/modules/luni/src/main/java/java/net/DatagramPacket.java
@@ -17,7 +17,7 @@ package java.net; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class represents a datagram packet which contains data either to be sent @@ -192,7 +192,7 @@ public synchronized void setData(byte[] buf, int anOffset, int aLength) { if (0 > anOffset || anOffset > buf.length || 0 > aLength || aLength > buf.length - anOffset) { - throw new IllegalArgumentException(Msg.getString("K002f")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.13")); //$NON-NLS-1$ } data = buf; offset = anOffset; @@ -232,7 +232,7 @@ */ public synchronized void setLength(int len) { if (0 > len || offset + len > data.length) { - throw new IllegalArgumentException(Msg.getString("K002f")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.13")); //$NON-NLS-1$ } length = len; capacity = len; @@ -246,7 +246,7 @@ */ synchronized void setLengthOnly(int len) { if (0 > len || offset + len > data.length) { - throw new IllegalArgumentException(Msg.getString("K002f")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.13")); //$NON-NLS-1$ } length = len; } @@ -259,7 +259,7 @@ */ public synchronized void setPort(int aPort) { if (aPort < 0 || aPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0325", aPort)); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.56", aPort)); //$NON-NLS-1$ } port = aPort; } @@ -326,12 +326,12 @@ */ public synchronized void setSocketAddress(SocketAddress sockAddr) { if (!(sockAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", sockAddr == null ? null : sockAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", sockAddr == null ? null : sockAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) sockAddr; if(inetAddr.isUnresolved()){ - throw new IllegalArgumentException(Msg.getString("K0353")); + throw new IllegalArgumentException(Messages.getString("luni.57")); } port = inetAddr.getPort(); address = inetAddr.getAddress();
diff --git a/modules/luni/src/main/java/java/net/DatagramSocket.java b/modules/luni/src/main/java/java/net/DatagramSocket.java index 34e458f..1334de4 100644 --- a/modules/luni/src/main/java/java/net/DatagramSocket.java +++ b/modules/luni/src/main/java/java/net/DatagramSocket.java
@@ -22,7 +22,7 @@ import org.apache.harmony.luni.net.PlainDatagramSocketImpl; import org.apache.harmony.luni.platform.Platform; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class implements a UDP socket for sending and receiving {@code @@ -112,7 +112,7 @@ */ void checkListen(int aPort) { if (aPort < 0 || aPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0325", aPort)); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.56", aPort)); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); if (security != null) { @@ -144,7 +144,7 @@ */ public void connect(InetAddress anAddress, int aPort) { if (anAddress == null || aPort < 0 || aPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0032")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.38")); //$NON-NLS-1$ } synchronized (lock) { @@ -433,7 +433,7 @@ if (address != null) { // The socket is connected if (packAddr != null) { if (!address.equals(packAddr) || port != pack.getPort()) { - throw new IllegalArgumentException(Msg.getString("K0034")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.58")); //$NON-NLS-1$ } } else { pack.setAddress(address); @@ -444,7 +444,7 @@ if (packAddr == null) { if (pack.getPort() == -1) { // KA019 Destination address is null - throw new NullPointerException(Msg.getString("KA019")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("luni.59")); //$NON-NLS-1$ } return; } @@ -474,7 +474,7 @@ */ public synchronized void setSendBufferSize(int size) throws SocketException { if (size < 1) { - throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5A")); //$NON-NLS-1$ } checkClosedAndBind(false); impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size)); @@ -494,7 +494,7 @@ public synchronized void setReceiveBufferSize(int size) throws SocketException { if (size < 1) { - throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5A")); //$NON-NLS-1$ } checkClosedAndBind(false); impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size)); @@ -515,7 +515,7 @@ */ public synchronized void setSoTimeout(int timeout) throws SocketException { if (timeout < 0) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } checkClosedAndBind(false); impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout)); @@ -542,7 +542,7 @@ security.checkSetFactory(); } if (factory != null) { - throw new SocketException(Msg.getString("K0044")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.5C")); //$NON-NLS-1$ } factory = fac; } @@ -577,8 +577,8 @@ public DatagramSocket(SocketAddress localAddr) throws SocketException { if (localAddr != null) { if (!(localAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", localAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", localAddr.getClass())); //$NON-NLS-1$ } checkListen(((InetSocketAddress) localAddr).getPort()); } @@ -599,7 +599,7 @@ void checkClosedAndBind(boolean bind) throws SocketException { if (isClosed()) { - throw new SocketException(Msg.getString("K003d")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.0C")); //$NON-NLS-1$ } if (bind && !isBound()) { checkListen(0); @@ -627,14 +627,14 @@ InetAddress addr = InetAddress.ANY; if (localAddr != null) { if (!(localAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", localAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", localAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) localAddr; addr = inetAddr.getAddress(); if (addr == null) { - throw new SocketException(Msg.getString( - "K0317", inetAddr.getHostName())); //$NON-NLS-1$ + throw new SocketException(Messages.getString( + "luni.1A", inetAddr.getHostName())); //$NON-NLS-1$ } localPort = inetAddr.getPort(); checkListen(localPort); @@ -656,18 +656,18 @@ */ public void connect(SocketAddress remoteAddr) throws SocketException { if (remoteAddr == null) { - throw new IllegalArgumentException(Msg.getString("K0318")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5D")); //$NON-NLS-1$ } if (!(remoteAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", remoteAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", remoteAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) remoteAddr; if (inetAddr.getAddress() == null) { - throw new SocketException(Msg.getString( - "K0317", inetAddr.getHostName())); //$NON-NLS-1$ + throw new SocketException(Messages.getString( + "luni.1A", inetAddr.getHostName())); //$NON-NLS-1$ } synchronized (lock) {
diff --git a/modules/luni/src/main/java/java/net/HttpURLConnection.java b/modules/luni/src/main/java/java/net/HttpURLConnection.java index 6be891f..aa19f5d 100644 --- a/modules/luni/src/main/java/java/net/HttpURLConnection.java +++ b/modules/luni/src/main/java/java/net/HttpURLConnection.java
@@ -19,7 +19,7 @@ import java.io.IOException; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This abstract subclass of {@code URLConnection} defines methods for managing @@ -426,7 +426,7 @@ */ public void setRequestMethod(String method) throws ProtocolException { if (connected) { - throw new ProtocolException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new ProtocolException(Messages.getString("luni.5E")); //$NON-NLS-1$ } for (int i = 0; i < methodTokens.length; i++) { if (methodTokens[i].equals(method)) { @@ -502,13 +502,13 @@ */ public void setFixedLengthStreamingMode(int contentLength) { if (super.connected) { - throw new IllegalStateException(Msg.getString("K0079")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5F")); //$NON-NLS-1$ } if (0 < chunkLength) { - throw new IllegalStateException(Msg.getString("KA003")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.60")); //$NON-NLS-1$ } if (0 > contentLength) { - throw new IllegalArgumentException(Msg.getString("K0051")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.61")); //$NON-NLS-1$ } this.fixedContentLength = contentLength; } @@ -527,10 +527,10 @@ */ public void setChunkedStreamingMode(int chunklen) { if (super.connected) { - throw new IllegalStateException(Msg.getString("K0079")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5F")); //$NON-NLS-1$ } if (0 <= fixedContentLength) { - throw new IllegalStateException(Msg.getString("KA003")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.60")); //$NON-NLS-1$ } if (0 >= chunklen) { chunkLength = DEFAULT_CHUNK_LENGTH;
diff --git a/modules/luni/src/main/java/java/net/Inet6Address.java b/modules/luni/src/main/java/java/net/Inet6Address.java index 0569829..c39a587 100644 --- a/modules/luni/src/main/java/java/net/Inet6Address.java +++ b/modules/luni/src/main/java/java/net/Inet6Address.java
@@ -24,7 +24,7 @@ import java.util.Enumeration; import org.apache.harmony.luni.util.Inet6Util; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class represents a 128 bit long IPv6 address. @@ -105,8 +105,8 @@ public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) throws UnknownHostException { if (null == addr || 16 != addr.length) { - // KA020=Illegal IPv6 address - throw new UnknownHostException(Msg.getString("KA020")); //$NON-NLS-1$ + // luni.62=Illegal IPv6 address + throw new UnknownHostException(Messages.getString("luni.62")); //$NON-NLS-1$ } if (scope_id < 0) { scope_id = 0; @@ -163,8 +163,8 @@ // if no address matches the type of addr, throws an // UnknownHostException. if (!address.scope_id_set) { - // KA021=Scope id is not found for the given address - throw new UnknownHostException(Msg.getString("KA021")); //$NON-NLS-1$ + // luni.63=Scope id is not found for the given address + throw new UnknownHostException(Messages.getString("luni.63")); //$NON-NLS-1$ } return address; }
diff --git a/modules/luni/src/main/java/java/net/InetAddress.java b/modules/luni/src/main/java/java/net/InetAddress.java index 47b85ce..e7c22ed 100644 --- a/modules/luni/src/main/java/java/net/InetAddress.java +++ b/modules/luni/src/main/java/java/net/InetAddress.java
@@ -33,7 +33,7 @@ import org.apache.harmony.luni.platform.INetworkSystem; import org.apache.harmony.luni.platform.Platform; import org.apache.harmony.luni.util.Inet6Util; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; /** @@ -813,7 +813,7 @@ public boolean isReachable(NetworkInterface netif, final int ttl, final int timeout) throws IOException { if (0 > ttl || 0 > timeout) { - throw new IllegalArgumentException(Msg.getString("K0051")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.61")); //$NON-NLS-1$ } boolean reachable = false; if (null == netif) { @@ -1038,8 +1038,8 @@ return new Inet6Address(copy_address, scope_id); } - // K0339=Invalid IP Address is neither 4 or 16 bytes - throw new UnknownHostException(Msg.getString("K0339")); //$NON-NLS-1$ + // luni.64=Invalid IP Address is neither 4 or 16 bytes + throw new UnknownHostException(Messages.getString("luni.64")); //$NON-NLS-1$ } private static boolean isIPv4MappedAddress(byte ipAddress[]) { @@ -1137,7 +1137,7 @@ return new Inet6Address(ipAddress, hostName, scope_id); } - throw new UnknownHostException(Msg.getString("K0332", hostName)); //$NON-NLS-1$ + throw new UnknownHostException(Messages.getString("luni.65", hostName)); //$NON-NLS-1$ } /**
diff --git a/modules/luni/src/main/java/java/net/MulticastSocket.java b/modules/luni/src/main/java/java/net/MulticastSocket.java index 26c2760..8be930d 100644 --- a/modules/luni/src/main/java/java/net/MulticastSocket.java +++ b/modules/luni/src/main/java/java/net/MulticastSocket.java
@@ -21,7 +21,7 @@ import java.util.Enumeration; import org.apache.harmony.luni.net.PlainDatagramSocketImpl; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class implements a multicast socket for sending and receiving IP @@ -196,7 +196,7 @@ public void joinGroup(InetAddress groupAddr) throws IOException { checkClosedAndBind(false); if (!groupAddr.isMulticastAddress()) { - throw new IOException(Msg.getString("K0039")); //$NON-NLS-1$ + throw new IOException(Messages.getString("luni.66")); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); if (security != null) { @@ -227,27 +227,27 @@ NetworkInterface netInterface) throws IOException { checkClosedAndBind(false); if (null == groupAddress) { - throw new IllegalArgumentException(Msg.getString("K0318")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5D")); //$NON-NLS-1$ } if ((netInterface != null) && (netInterface.getFirstAddress() == null)) { // this is ok if we could set it at the - throw new SocketException(Msg.getString("K0335")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.67")); //$NON-NLS-1$ } if (!(groupAddress instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", groupAddress.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", groupAddress.getClass())); //$NON-NLS-1$ } InetAddress groupAddr = ((InetSocketAddress) groupAddress).getAddress(); if (groupAddr == null) { - throw new SocketException(Msg.getString("K0331")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.68")); //$NON-NLS-1$ } if (!groupAddr.isMulticastAddress()) { - throw new IOException(Msg.getString("K0039")); //$NON-NLS-1$ + throw new IOException(Messages.getString("luni.66")); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); @@ -272,7 +272,7 @@ public void leaveGroup(InetAddress groupAddr) throws IOException { checkClosedAndBind(false); if (!groupAddr.isMulticastAddress()) { - throw new IOException(Msg.getString("K003a")); //$NON-NLS-1$ + throw new IOException(Messages.getString("luni.69")); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); if (security != null) { @@ -301,27 +301,27 @@ NetworkInterface netInterface) throws IOException { checkClosedAndBind(false); if (null == groupAddress) { - throw new IllegalArgumentException(Msg.getString("K0318")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5D")); //$NON-NLS-1$ } if ((netInterface != null) && (netInterface.getFirstAddress() == null)) { // this is ok if we could set it at the - throw new SocketException(Msg.getString("K0335")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.67")); //$NON-NLS-1$ } if (!(groupAddress instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", groupAddress.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", groupAddress.getClass())); //$NON-NLS-1$ } InetAddress groupAddr = ((InetSocketAddress) groupAddress).getAddress(); if (groupAddr == null) { - throw new SocketException(Msg.getString("K0331")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.68")); //$NON-NLS-1$ } if (!groupAddr.isMulticastAddress()) { - throw new IOException(Msg.getString("K003a")); //$NON-NLS-1$ + throw new IOException(Messages.getString("luni.69")); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); if (security != null) { @@ -415,7 +415,7 @@ // Ignored } } else if (addr instanceof Inet6Address) { - throw new SocketException(Msg.getString("K0338")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.6A")); //$NON-NLS-1$ } } @@ -437,13 +437,13 @@ if (netInterface == null) { // throw a socket exception indicating that we do not support this - throw new SocketException(Msg.getString("K0334")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.6B")); //$NON-NLS-1$ } InetAddress firstAddress = netInterface.getFirstAddress(); if (firstAddress == null) { // this is ok if we could set it at the - throw new SocketException(Msg.getString("K0335")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.67")); //$NON-NLS-1$ } if (netInterface.getIndex() == NetworkInterface.UNSET_INTERFACE_INDEX) { @@ -490,7 +490,7 @@ * interfaces which have no IPV4 address and which does not have * the network interface index not set correctly */ - throw new SocketException(Msg.getString("K0335")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.67")); //$NON-NLS-1$ } } else { // set the address using IP_MULTICAST_IF to make sure this @@ -526,7 +526,7 @@ public void setTimeToLive(int ttl) throws IOException { checkClosedAndBind(false); if (ttl < 0 || ttl > 255) { - throw new IllegalArgumentException(Msg.getString("K003c")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.6C")); //$NON-NLS-1$ } impl.setTimeToLive(ttl); }
diff --git a/modules/luni/src/main/java/java/net/NetworkInterface.java b/modules/luni/src/main/java/java/net/NetworkInterface.java index f921b07..0dcbd84 100644 --- a/modules/luni/src/main/java/java/net/NetworkInterface.java +++ b/modules/luni/src/main/java/java/net/NetworkInterface.java
@@ -21,7 +21,7 @@ import java.util.Enumeration; import java.util.Vector; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class is used to represent a network interface of the local device. An @@ -217,7 +217,7 @@ throws SocketException { if (interfaceName == null) { - throw new NullPointerException(Msg.getString("K0330")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("luni.6D")); //$NON-NLS-1$ } /* @@ -253,7 +253,7 @@ throws SocketException { if (address == null) { - throw new NullPointerException(Msg.getString("K0331")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("luni.68")); //$NON-NLS-1$ } /*
diff --git a/modules/luni/src/main/java/java/net/Proxy.java b/modules/luni/src/main/java/java/net/Proxy.java index 3442339..4ba73f2 100644 --- a/modules/luni/src/main/java/java/net/Proxy.java +++ b/modules/luni/src/main/java/java/net/Proxy.java
@@ -15,7 +15,7 @@ */ package java.net; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class represents proxy server settings. A created instance of {@code @@ -61,8 +61,8 @@ * SocketAddress must NOT be null. */ if (type == Type.DIRECT || null == sa) { - // KA022=Illegal Proxy.Type or SocketAddress argument - throw new IllegalArgumentException(Msg.getString("KA022")); //$NON-NLS-1$ + // luni.6E=Illegal Proxy.Type or SocketAddress argument + throw new IllegalArgumentException(Messages.getString("luni.6E")); //$NON-NLS-1$ } this.type = type; address = sa;
diff --git a/modules/luni/src/main/java/java/net/ProxySelectorImpl.java b/modules/luni/src/main/java/java/net/ProxySelectorImpl.java index 3fdd76e..955f6eb 100644 --- a/modules/luni/src/main/java/java/net/ProxySelectorImpl.java +++ b/modules/luni/src/main/java/java/net/ProxySelectorImpl.java
@@ -25,7 +25,7 @@ import java.util.List; import java.util.Properties; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; /** @@ -75,8 +75,8 @@ @Override public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { if (null == uri || null == sa || null == ioe) { - // "KA001=Argument must not be null" - throw new IllegalArgumentException(Msg.getString("KA001")); //$NON-NLS-1$ + // luni.4D=Argument must not be null" + throw new IllegalArgumentException(Messages.getString("luni.4D")); //$NON-NLS-1$ } } @@ -84,8 +84,8 @@ public List<Proxy> select(URI uri) { // argument check if (null == uri) { - // KA001=Argument must not be null - throw new IllegalArgumentException(Msg.getString("KA001")); //$NON-NLS-1$ + // luni.4D=Argument must not be null + throw new IllegalArgumentException(Messages.getString("luni.4D")); //$NON-NLS-1$ } // check scheme String scheme = uri.getScheme();
diff --git a/modules/luni/src/main/java/java/net/ServerSocket.java b/modules/luni/src/main/java/java/net/ServerSocket.java index 91c369e..c3c919e 100644 --- a/modules/luni/src/main/java/java/net/ServerSocket.java +++ b/modules/luni/src/main/java/java/net/ServerSocket.java
@@ -22,7 +22,7 @@ import org.apache.harmony.luni.net.PlainServerSocketImpl; import org.apache.harmony.luni.platform.Platform; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class represents a server-side socket that waits for incoming client @@ -147,7 +147,7 @@ public Socket accept() throws IOException { checkClosedAndCreate(false); if (!isBound()) { - throw new SocketException(Msg.getString("K031f")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.6F")); //$NON-NLS-1$ } Socket aSocket = new Socket(); @@ -173,7 +173,7 @@ */ void checkListen(int aPort) { if (aPort < 0 || aPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0325", aPort)); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.56", aPort)); //$NON-NLS-1$ } SecurityManager security = System.getSecurityManager(); if (security != null) { @@ -296,7 +296,7 @@ security.checkSetFactory(); } if (factory != null) { - throw new SocketException(Msg.getString("K0042")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.70")); //$NON-NLS-1$ } factory = aFactory; } @@ -314,7 +314,7 @@ public synchronized void setSoTimeout(int timeout) throws SocketException { checkClosedAndCreate(true); if (timeout < 0) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout)); } @@ -380,19 +380,19 @@ public void bind(SocketAddress localAddr, int backlog) throws IOException { checkClosedAndCreate(true); if (isBound()) { - throw new BindException(Msg.getString("K0315")); //$NON-NLS-1$ + throw new BindException(Messages.getString("luni.71")); //$NON-NLS-1$ } int port = 0; InetAddress addr = InetAddress.ANY; if (localAddr != null) { if (!(localAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", localAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", localAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) localAddr; if ((addr = inetAddr.getAddress()) == null) { - throw new SocketException(Msg.getString( - "K0317", inetAddr.getHostName())); //$NON-NLS-1$ + throw new SocketException(Messages.getString( + "luni.1A", inetAddr.getHostName())); //$NON-NLS-1$ } port = inetAddr.getPort(); } @@ -450,7 +450,7 @@ */ private void checkClosedAndCreate(boolean create) throws SocketException { if (isClosed()) { - throw new SocketException(Msg.getString("K003d")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.0C")); //$NON-NLS-1$ } if (!create || isCreated) { @@ -512,7 +512,7 @@ public void setReceiveBufferSize(int size) throws SocketException { checkClosedAndCreate(true); if (size < 1) { - throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5A")); //$NON-NLS-1$ } impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size)); }
diff --git a/modules/luni/src/main/java/java/net/Socket.java b/modules/luni/src/main/java/java/net/Socket.java index cbce205..c168fd1 100644 --- a/modules/luni/src/main/java/java/net/Socket.java +++ b/modules/luni/src/main/java/java/net/Socket.java
@@ -26,7 +26,7 @@ import org.apache.harmony.luni.net.NetUtil; import org.apache.harmony.luni.net.PlainSocketImpl; import org.apache.harmony.luni.platform.Platform; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; /** @@ -106,8 +106,8 @@ */ public Socket(Proxy proxy) { if (null == proxy || Proxy.Type.HTTP == proxy.type()) { - // KA023=Proxy is null or invalid type - throw new IllegalArgumentException(Msg.getString("KA023")); //$NON-NLS-1$ + // luni.73=Proxy is null or invalid type + throw new IllegalArgumentException(Messages.getString("luni.73")); //$NON-NLS-1$ } InetSocketAddress address = (InetSocketAddress) proxy.address(); if (null != address) { @@ -315,7 +315,7 @@ */ void checkDestination(InetAddress destAddr, int dstPort) { if (dstPort < 0 || dstPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0032")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.38")); //$NON-NLS-1$ } checkConnectPermission(destAddr.getHostName(), dstPort); } @@ -371,7 +371,7 @@ public InputStream getInputStream() throws IOException { checkClosedAndCreate(false); if (isInputShutdown()) { - throw new SocketException(Msg.getString("K0321")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.74")); //$NON-NLS-1$ } return impl.getInputStream(); } @@ -429,7 +429,7 @@ public OutputStream getOutputStream() throws IOException { checkClosedAndCreate(false); if (isOutputShutdown()) { - throw new SocketException(Msg.getString("KA00f")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.75")); //$NON-NLS-1$ } return impl.getOutputStream(); } @@ -550,7 +550,7 @@ security.checkSetFactory(); } if (factory != null) { - throw new SocketException(Msg.getString("K0044")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.5C")); //$NON-NLS-1$ } factory = fac; } @@ -569,7 +569,7 @@ public synchronized void setSendBufferSize(int size) throws SocketException { checkClosedAndCreate(true); if (size < 1) { - throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5A")); //$NON-NLS-1$ } impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size)); } @@ -589,7 +589,7 @@ throws SocketException { checkClosedAndCreate(true); if (size < 1) { - throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5A")); //$NON-NLS-1$ } impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size)); } @@ -610,7 +610,7 @@ public void setSoLinger(boolean on, int timeout) throws SocketException { checkClosedAndCreate(true); if (on && timeout < 0) { - throw new IllegalArgumentException(Msg.getString("K0045")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.76")); //$NON-NLS-1$ } int val = on ? (65535 < timeout ? 65535 : timeout) : -1; impl.setOption(SocketOptions.SO_LINGER, Integer.valueOf(val)); @@ -632,7 +632,7 @@ public synchronized void setSoTimeout(int timeout) throws SocketException { checkClosedAndCreate(true); if (timeout < 0) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout)); } @@ -672,7 +672,7 @@ throws IOException { if (localPort < 0 || localPort > 65535) { - throw new IllegalArgumentException(Msg.getString("K0046")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.77")); //$NON-NLS-1$ } InetAddress addr = localAddress == null ? InetAddress.ANY @@ -720,7 +720,7 @@ */ public void shutdownInput() throws IOException { if (isInputShutdown()) { - throw new SocketException(Msg.getString("K0321")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.74")); //$NON-NLS-1$ } checkClosedAndCreate(false); impl.shutdownInput(); @@ -739,7 +739,7 @@ */ public void shutdownOutput() throws IOException { if (isOutputShutdown()) { - throw new SocketException(Msg.getString("KA00f")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.75")); //$NON-NLS-1$ } checkClosedAndCreate(false); impl.shutdownOutput(); @@ -755,11 +755,11 @@ */ private void checkClosedAndCreate(boolean create) throws SocketException { if (isClosed()) { - throw new SocketException(Msg.getString("K003d")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.0C")); //$NON-NLS-1$ } if (!create) { if (!isConnected()) { - throw new SocketException(Msg.getString("K0320")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.78")); //$NON-NLS-1$ // a connected socket must be created } @@ -859,20 +859,20 @@ public void bind(SocketAddress localAddr) throws IOException { checkClosedAndCreate(true); if (isBound()) { - throw new BindException(Msg.getString("K0315")); //$NON-NLS-1$ + throw new BindException(Messages.getString("luni.71")); //$NON-NLS-1$ } int port = 0; InetAddress addr = InetAddress.ANY; if (localAddr != null) { if (!(localAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", localAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", localAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) localAddr; if ((addr = inetAddr.getAddress()) == null) { - throw new SocketException(Msg.getString( - "K0317", inetAddr.getHostName())); //$NON-NLS-1$ + throw new SocketException(Messages.getString( + "luni.1A", inetAddr.getHostName())); //$NON-NLS-1$ } port = inetAddr.getPort(); } @@ -926,23 +926,23 @@ throws IOException { checkClosedAndCreate(true); if (timeout < 0) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } if (isConnected()) { - throw new SocketException(Msg.getString("K0079")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.5F")); //$NON-NLS-1$ } if (remoteAddr == null) { - throw new IllegalArgumentException(Msg.getString("K0318")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5D")); //$NON-NLS-1$ } if (!(remoteAddr instanceof InetSocketAddress)) { - throw new IllegalArgumentException(Msg.getString( - "K0316", remoteAddr.getClass())); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.49", remoteAddr.getClass())); //$NON-NLS-1$ } InetSocketAddress inetAddr = (InetSocketAddress) remoteAddr; InetAddress addr; if ((addr = inetAddr.getAddress()) == null) { - throw new UnknownHostException(Msg.getString("K0317", remoteAddr));//$NON-NLS-1$ + throw new UnknownHostException(Messages.getString("luni.1A", remoteAddr));//$NON-NLS-1$ } int port = inetAddr.getPort(); @@ -1096,7 +1096,7 @@ */ public void sendUrgentData(int value) throws IOException { if (!impl.supportsUrgentData()) { - throw new SocketException(Msg.getString("K0333")); //$NON-NLS-1$ + throw new SocketException(Messages.getString("luni.79")); //$NON-NLS-1$ } impl.sendUrgentData(value); }
diff --git a/modules/luni/src/main/java/java/net/SocketImpl.java b/modules/luni/src/main/java/java/net/SocketImpl.java index 7a2ea8c..7624d6b 100644 --- a/modules/luni/src/main/java/java/net/SocketImpl.java +++ b/modules/luni/src/main/java/java/net/SocketImpl.java
@@ -24,7 +24,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; /** * This class is the base of all streaming socket implementation classes. @@ -294,8 +294,8 @@ * always because this method should be overridden. */ protected void shutdownInput() throws IOException { - // KA025=Method has not been implemented - throw new IOException(Msg.getString("KA025"));//$NON-NLS-1$ + // luni.72=Method has not been implemented + throw new IOException(Messages.getString("luni.72"));//$NON-NLS-1$ } /** @@ -308,8 +308,8 @@ * always because this method should be overridden. */ protected void shutdownOutput() throws IOException { - // KA025=Method has not been implemented - throw new IOException(Msg.getString("KA025"));//$NON-NLS-1$ + // luni.72=Method has not been implemented + throw new IOException(Messages.getString("luni.72"));//$NON-NLS-1$ } /**
diff --git a/modules/luni/src/main/java/java/net/SocketPermission.java b/modules/luni/src/main/java/java/net/SocketPermission.java index 7ffd609..807849b 100644 --- a/modules/luni/src/main/java/java/net/SocketPermission.java +++ b/modules/luni/src/main/java/java/net/SocketPermission.java
@@ -25,7 +25,7 @@ import java.security.PermissionCollection; import org.apache.harmony.luni.util.Inet6Util; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * Regulates the access to network operations available through sockets through @@ -232,7 +232,7 @@ } else if (action.equals(actionNames[SP_RESOLVE])) { // do nothing } else { - throw new IllegalArgumentException(Msg.getString("K0048", //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.7A", //$NON-NLS-1$ action)); } } @@ -338,12 +338,12 @@ portMax = Integer.valueOf(strPortMax).intValue(); if (portMin > portMax) { - // K0049=MinPort is greater than MaxPort\: {0} - throw new IllegalArgumentException(Msg.getString("K0049", port)); //$NON-NLS-1$ + // luni.7B=MinPort is greater than MaxPort\: {0} + throw new IllegalArgumentException(Messages.getString("luni.7B", port)); //$NON-NLS-1$ } } catch (NumberFormatException e) { - // K004a=Invalid port number specified\: {0} - throw new IllegalArgumentException(Msg.getString("K004a", port)); //$NON-NLS-1$ + // luni.7C=Invalid port number specified\: {0} + throw new IllegalArgumentException(Messages.getString("luni.7C", port)); //$NON-NLS-1$ } } @@ -450,22 +450,22 @@ if (Inet6Util.isIP6AddressInFullForm(host)) { return host.toLowerCase(); } - // K004a=Invalid port number specified\: {0} - throw new IllegalArgumentException(Msg.getString("K004a", host)); + // luni.7C=Invalid port number specified\: {0} + throw new IllegalArgumentException(Messages.getString("luni.7C", host)); } // forward bracket found int bbracketIdx = host.indexOf(']'); if (-1 == bbracketIdx) { // no back bracket found, wrong - // K004a=Invalid port number specified\: {0} - throw new IllegalArgumentException(Msg.getString("K004a", host)); + // luni.7C=Invalid port number specified\: {0} + throw new IllegalArgumentException(Messages.getString("luni.7C", host)); } host = host.substring(0, bbracketIdx + 1); if (Inet6Util.isValidIP6Address(host)) { return host.toLowerCase(); } - // K004a=Invalid port number specified\: {0} - throw new IllegalArgumentException(Msg.getString("K004a", host)); + // luni.7C=Invalid port number specified\: {0} + throw new IllegalArgumentException(Messages.getString("luni.7C", host)); } /**
diff --git a/modules/luni/src/main/java/java/net/URI.java b/modules/luni/src/main/java/java/net/URI.java index 85c16eb..faaebb6 100644 --- a/modules/luni/src/main/java/java/net/URI.java +++ b/modules/luni/src/main/java/java/net/URI.java
@@ -24,7 +24,7 @@ import java.io.UnsupportedEncodingException; import java.util.StringTokenizer; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class represents an instance of a URI as defined by RFC 2396. @@ -163,7 +163,7 @@ if (scheme != null && path != null && path.length() > 0 && path.charAt(0) != '/') { - throw new URISyntaxException(path, Msg.getString("K0302")); //$NON-NLS-1$ + throw new URISyntaxException(path, Messages.getString("luni.82")); //$NON-NLS-1$ } StringBuilder uri = new StringBuilder(); @@ -267,7 +267,7 @@ String fragment) throws URISyntaxException { if (scheme != null && path != null && path.length() > 0 && path.charAt(0) != '/') { - throw new URISyntaxException(path, Msg.getString("K0302")); //$NON-NLS-1$ + throw new URISyntaxException(path, Messages.getString("luni.82")); //$NON-NLS-1$ } StringBuilder uri = new StringBuilder(); @@ -332,13 +332,13 @@ absolute = true; scheme = temp.substring(0, index); if (scheme.length() == 0) { - throw new URISyntaxException(uri, Msg.getString("K0342"), //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.83"), //$NON-NLS-1$ index); } validateScheme(uri, scheme, 0); schemespecificpart = temp.substring(index + 1); if (schemespecificpart.length() == 0) { - throw new URISyntaxException(uri, Msg.getString("K0303"), //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.84"), //$NON-NLS-1$ index + 1); } } else { @@ -370,8 +370,8 @@ authority = temp.substring(2); if (authority.length() == 0 && query == null && fragment == null) { - throw new URISyntaxException(uri, Msg - .getString("K0304"), uri.length()); //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages + .getString("luni.9F"), uri.length()); //$NON-NLS-1$ } path = ""; //$NON-NLS-1$ @@ -409,13 +409,13 @@ // first char needs to be an alpha char char ch = scheme.charAt(0); if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))) { - throw new URISyntaxException(uri, Msg.getString("K0305"), 0); //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.85"), 0); //$NON-NLS-1$ } try { URIEncoderDecoder.validateSimple(scheme, "+-."); //$NON-NLS-1$ } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K0305"), index //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.85"), index //$NON-NLS-1$ + e.getIndex()); } } @@ -425,7 +425,7 @@ try { URIEncoderDecoder.validate(ssp, allLegal); } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K0306", e //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.86", e //$NON-NLS-1$ .getReason()), index + e.getIndex()); } } @@ -435,7 +435,7 @@ try { URIEncoderDecoder.validate(authority, "@[]" + someLegal); //$NON-NLS-1$ } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K0307", e //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.87", e //$NON-NLS-1$ .getReason()), index + e.getIndex()); } } @@ -445,7 +445,7 @@ try { URIEncoderDecoder.validate(path, "/@" + someLegal); //$NON-NLS-1$ } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K0308", e //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.88", e //$NON-NLS-1$ .getReason()), index + e.getIndex()); } } @@ -455,7 +455,7 @@ try { URIEncoderDecoder.validate(query, allLegal); } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K0309", e //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.89", e //$NON-NLS-1$ .getReason()), index + e.getIndex()); } @@ -466,7 +466,7 @@ try { URIEncoderDecoder.validate(fragment, allLegal); } catch (URISyntaxException e) { - throw new URISyntaxException(uri, Msg.getString("K030a", e //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.8A", e //$NON-NLS-1$ .getReason()), index + e.getIndex()); } } @@ -517,14 +517,14 @@ if (forceServer) { throw new URISyntaxException( authority, - Msg.getString("K00b1"), hostindex + index + 1); //$NON-NLS-1$ + Messages.getString("luni.8B"), hostindex + index + 1); //$NON-NLS-1$ } return; } } catch (NumberFormatException e) { if (forceServer) { - throw new URISyntaxException(authority, Msg - .getString("K00b1"), hostindex + index + 1); //$NON-NLS-1$ + throw new URISyntaxException(authority, Messages + .getString("luni.8B"), hostindex + index + 1); //$NON-NLS-1$ } return; } @@ -535,8 +535,8 @@ if (tempHost.equals("")) { //$NON-NLS-1$ if (forceServer) { - throw new URISyntaxException(authority, Msg - .getString("K030c"), hostindex); //$NON-NLS-1$ + throw new URISyntaxException(authority, Messages + .getString("luni.A0"), hostindex); //$NON-NLS-1$ } return; } @@ -558,7 +558,7 @@ for (int i = 0; i < userinfo.length(); i++) { char ch = userinfo.charAt(i); if (ch == ']' || ch == '[') { - throw new URISyntaxException(uri, Msg.getString("K030d"), //$NON-NLS-1$ + throw new URISyntaxException(uri, Messages.getString("luni.8C"), //$NON-NLS-1$ index + i); } } @@ -574,10 +574,10 @@ // ipv6 address if (host.charAt(host.length() - 1) != ']') { throw new URISyntaxException(host, - Msg.getString("K030e"), 0); //$NON-NLS-1$ + Messages.getString("luni.8D"), 0); //$NON-NLS-1$ } if (!isValidIP6Address(host)) { - throw new URISyntaxException(host, Msg.getString("K030f")); //$NON-NLS-1$ + throw new URISyntaxException(host, Messages.getString("luni.8E")); //$NON-NLS-1$ } return true; } @@ -585,7 +585,7 @@ // '[' and ']' can only be the first char and last char // of the host name if (host.indexOf('[') != -1 || host.indexOf(']') != -1) { - throw new URISyntaxException(host, Msg.getString("K0310"), 0); //$NON-NLS-1$ + throw new URISyntaxException(host, Messages.getString("luni.8F"), 0); //$NON-NLS-1$ } int index = host.lastIndexOf('.'); @@ -597,7 +597,7 @@ } if (forceServer) { throw new URISyntaxException(host, - Msg.getString("K0310"), 0); //$NON-NLS-1$ + Messages.getString("luni.8F"), 0); //$NON-NLS-1$ } return false; } @@ -607,7 +607,7 @@ return true; } if (forceServer) { - throw new URISyntaxException(host, Msg.getString("K0311"), 0); //$NON-NLS-1$ + throw new URISyntaxException(host, Messages.getString("luni.90"), 0); //$NON-NLS-1$ } return false; } @@ -1721,7 +1721,7 @@ */ public URL toURL() throws MalformedURLException { if (!absolute) { - throw new IllegalArgumentException(Msg.getString("K0312") + ": " //$NON-NLS-1$//$NON-NLS-2$ + throw new IllegalArgumentException(Messages.getString("luni.91") + ": " //$NON-NLS-1$//$NON-NLS-2$ + toString()); } return new URL(toString());
diff --git a/modules/luni/src/main/java/java/net/URIEncoderDecoder.java b/modules/luni/src/main/java/java/net/URIEncoderDecoder.java index d2b0044..2dc1f4e 100644 --- a/modules/luni/src/main/java/java/net/URIEncoderDecoder.java +++ b/modules/luni/src/main/java/java/net/URIEncoderDecoder.java
@@ -20,7 +20,7 @@ import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class is used to encode a string using the format required by {@code @@ -54,13 +54,13 @@ if (ch == '%') { do { if (i + 2 >= s.length()) { - throw new URISyntaxException(s, Msg.getString("K0313"), //$NON-NLS-1$ + throw new URISyntaxException(s, Messages.getString("luni.7D"), //$NON-NLS-1$ i); } int d1 = Character.digit(s.charAt(i + 1), 16); int d2 = Character.digit(s.charAt(i + 2), 16); if (d1 == -1 || d2 == -1) { - throw new URISyntaxException(s, Msg.getString("K0314", //$NON-NLS-1$ + throw new URISyntaxException(s, Messages.getString("luni.7E", //$NON-NLS-1$ s.substring(i, i + 3)), i); } @@ -73,7 +73,7 @@ || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127 && !Character.isSpaceChar(ch) && !Character .isISOControl(ch)))) { - throw new URISyntaxException(s, Msg.getString("K00c1"), i); //$NON-NLS-1$ + throw new URISyntaxException(s, Messages.getString("luni.7F"), i); //$NON-NLS-1$ } i++; } @@ -85,7 +85,7 @@ char ch = s.charAt(i); if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) { - throw new URISyntaxException(s, Msg.getString("K00c1"), i); //$NON-NLS-1$ + throw new URISyntaxException(s, Messages.getString("luni.7F"), i); //$NON-NLS-1$ } i++; } @@ -191,14 +191,14 @@ out.reset(); do { if (i + 2 >= s.length()) { - throw new IllegalArgumentException(Msg.getString( - "K01fe", i)); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.80", i)); //$NON-NLS-1$ } int d1 = Character.digit(s.charAt(i + 1), 16); int d2 = Character.digit(s.charAt(i + 2), 16); if (d1 == -1 || d2 == -1) { - throw new IllegalArgumentException(Msg.getString( - "K01ff", s.substring(i, i + 3), //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "luni.81", s.substring(i, i + 3), //$NON-NLS-1$ String.valueOf(i))); } out.write((byte) ((d1 << 4) + d2));
diff --git a/modules/luni/src/main/java/java/net/URISyntaxException.java b/modules/luni/src/main/java/java/net/URISyntaxException.java index 2daf35f..34266c7 100644 --- a/modules/luni/src/main/java/java/net/URISyntaxException.java +++ b/modules/luni/src/main/java/java/net/URISyntaxException.java
@@ -17,7 +17,7 @@ package java.net; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * A {@code URISyntaxException} will be thrown if some information could not be parsed @@ -127,10 +127,10 @@ String reason = super.getMessage(); if (index != -1) { - return Msg.getString("K0326", //$NON-NLS-1$ + return Messages.getString("luni.92", //$NON-NLS-1$ new String[] { reason, Integer.toString(index), input }); } - return Msg.getString("K0327", //$NON-NLS-1$ + return Messages.getString("luni.93", //$NON-NLS-1$ new String[] { reason, input }); } }
diff --git a/modules/luni/src/main/java/java/net/URL.java b/modules/luni/src/main/java/java/net/URL.java index 979686c..7e83f2a 100644 --- a/modules/luni/src/main/java/java/net/URL.java +++ b/modules/luni/src/main/java/java/net/URL.java
@@ -24,7 +24,7 @@ import java.util.Hashtable; import java.util.StringTokenizer; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; import org.apache.harmony.luni.util.Util; @@ -136,7 +136,7 @@ public static synchronized void setURLStreamHandlerFactory( URLStreamHandlerFactory streamFactory) { if (streamHandlerFactory != null) { - throw new Error(Msg.getString("K004b")); //$NON-NLS-1$ + throw new Error(Messages.getString("luni.9A")); //$NON-NLS-1$ } SecurityManager sm = System.getSecurityManager(); if (sm != null) { @@ -273,8 +273,8 @@ // by the values in the ("relative") spec. if (context == null) { throw new MalformedURLException( - org.apache.harmony.luni.util.Msg.getString( - "K00d8", spec)); //$NON-NLS-1$ + Messages.getString( + "luni.9B", spec)); //$NON-NLS-1$ } set(context.getProtocol(), context.getHost(), context.getPort(), context.getAuthority(), context.getUserInfo(), context @@ -290,8 +290,8 @@ setupStreamHandler(); if (strmHandler == null) { throw new MalformedURLException( - org.apache.harmony.luni.util.Msg.getString( - "K00b3", protocol)); //$NON-NLS-1$ + Messages.getString( + "luni.9C", protocol)); //$NON-NLS-1$ } } @@ -310,8 +310,8 @@ } if (port < -1) { - throw new MalformedURLException(org.apache.harmony.luni.util.Msg - .getString("K0325", port)); //$NON-NLS-1$ + throw new MalformedURLException(Messages + .getString("luni.56", port)); //$NON-NLS-1$ } } @@ -382,7 +382,7 @@ public URL(String protocol, String host, int port, String file, URLStreamHandler handler) throws MalformedURLException { if (port < -1) { - throw new MalformedURLException(Msg.getString("K0325", port)); //$NON-NLS-1$ + throw new MalformedURLException(Messages.getString("luni.56", port)); //$NON-NLS-1$ } if (host != null && host.indexOf(":") != -1 && host.charAt(0) != '[') { //$NON-NLS-1$ @@ -390,7 +390,7 @@ } if (protocol == null) { - throw new NullPointerException(Msg.getString("K00b3", "null")); //$NON-NLS-1$ //$NON-NLS-2$ + throw new NullPointerException(Messages.getString("luni.9C", "null")); //$NON-NLS-1$ //$NON-NLS-2$ } this.protocol = protocol; @@ -416,7 +416,7 @@ setupStreamHandler(); if (strmHandler == null) { throw new MalformedURLException( - Msg.getString("K00b3", protocol)); //$NON-NLS-1$ + Messages.getString("luni.9C", protocol)); //$NON-NLS-1$ } } else { SecurityManager sm = System.getSecurityManager(); @@ -698,8 +698,8 @@ */ public URLConnection openConnection(Proxy proxy) throws IOException { if (proxy == null) { - // K034c=proxy should not be null - throw new IllegalArgumentException(Msg.getString("K034c")); //$NON-NLS-1$ + // luni.9D=proxy should not be null + throw new IllegalArgumentException(Messages.getString("luni.9D")); //$NON-NLS-1$ } SecurityManager sm = System.getSecurityManager(); @@ -769,7 +769,7 @@ } setupStreamHandler(); if (strmHandler == null) { - throw new IOException(Msg.getString("K00b3", protocol)); //$NON-NLS-1$ + throw new IOException(Messages.getString("luni.9C", protocol)); //$NON-NLS-1$ } } catch (ClassNotFoundException e) { throw new IOException(e.toString());
diff --git a/modules/luni/src/main/java/java/net/URLClassLoader.java b/modules/luni/src/main/java/java/net/URLClassLoader.java index fa02117..12b7e43 100644 --- a/modules/luni/src/main/java/java/net/URLClassLoader.java +++ b/modules/luni/src/main/java/java/net/URLClassLoader.java
@@ -46,7 +46,7 @@ import java.util.jar.JarFile; import java.util.jar.Manifest; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class loader is responsible for loading classes and resources from a @@ -255,8 +255,8 @@ null, null, null, null, null); } else { if (packageObj.isSealed()) { - throw new SecurityException(Msg - .getString("K004c")); //$NON-NLS-1$ + throw new SecurityException(Messages + .getString("luni.A1")); //$NON-NLS-1$ } } } @@ -431,8 +431,8 @@ } } if (exception) { - throw new SecurityException(Msg - .getString("K0352", packageName)); //$NON-NLS-1$ + throw new SecurityException(Messages + .getString("luni.A2", packageName)); //$NON-NLS-1$ } } } @@ -1002,8 +1002,8 @@ private synchronized void makeNewHandler() { while (!searchList.isEmpty()) { URL nextCandidate = searchList.remove(0); - if (nextCandidate == null) { // KA024=One of urls is null - throw new NullPointerException(Msg.getString("KA024")); //$NON-NLS-1$ + if (nextCandidate == null) { // luni.94=One of urls is null + throw new NullPointerException(Messages.getString("luni.94")); //$NON-NLS-1$ } if (!handlerMap.containsKey(nextCandidate)) { URLHandler result;
diff --git a/modules/luni/src/main/java/java/net/URLConnection.java b/modules/luni/src/main/java/java/net/URLConnection.java index 894fde5..336c987 100644 --- a/modules/luni/src/main/java/java/net/URLConnection.java +++ b/modules/luni/src/main/java/java/net/URLConnection.java
@@ -30,7 +30,7 @@ import java.util.StringTokenizer; import org.apache.harmony.luni.internal.net.www.MimeTable; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.PriviAction; /** @@ -439,7 +439,7 @@ */ public Map<String, List<String>> getRequestProperties() { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } return Collections.emptyMap(); } @@ -460,10 +460,10 @@ */ public void addRequestProperty(String field, String newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } if (field == null) { - throw new NullPointerException(Msg.getString("KA007")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("luni.95")); //$NON-NLS-1$ } } @@ -559,7 +559,7 @@ * if no InputStream could be created. */ public InputStream getInputStream() throws IOException { - throw new UnknownServiceException(Msg.getString("K004d")); //$NON-NLS-1$ + throw new UnknownServiceException(Messages.getString("luni.96")); //$NON-NLS-1$ } /** @@ -585,7 +585,7 @@ * if no OutputStream could be created. */ public OutputStream getOutputStream() throws IOException { - throw new UnknownServiceException(Msg.getString("K005f")); //$NON-NLS-1$ + throw new UnknownServiceException(Messages.getString("luni.97")); //$NON-NLS-1$ } /** @@ -618,7 +618,7 @@ */ public String getRequestProperty(String field) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } return null; } @@ -782,7 +782,7 @@ */ public void setAllowUserInteraction(boolean newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } this.allowUserInteraction = newValue; } @@ -801,7 +801,7 @@ public static synchronized void setContentHandlerFactory( ContentHandlerFactory contentFactory) { if (contentHandlerFactory != null) { - throw new Error(Msg.getString("K004e")); //$NON-NLS-1$ + throw new Error(Messages.getString("luni.98")); //$NON-NLS-1$ } SecurityManager sManager = System.getSecurityManager(); if (sManager != null) { @@ -851,7 +851,7 @@ */ public void setDefaultUseCaches(boolean newValue) { if (connected) { - throw new IllegalAccessError(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalAccessError(Messages.getString("luni.5E")); //$NON-NLS-1$ } defaultUseCaches = newValue; } @@ -869,7 +869,7 @@ */ public void setDoInput(boolean newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } this.doInput = newValue; } @@ -887,7 +887,7 @@ */ public void setDoOutput(boolean newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } this.doOutput = newValue; } @@ -923,7 +923,7 @@ */ public void setIfModifiedSince(long newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } this.ifModifiedSince = newValue; } @@ -944,10 +944,10 @@ */ public void setRequestProperty(String field, String newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } if (field == null) { - throw new NullPointerException(Msg.getString("KA007")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("luni.95")); //$NON-NLS-1$ } } @@ -965,7 +965,7 @@ */ public void setUseCaches(boolean newValue) { if (connected) { - throw new IllegalStateException(Msg.getString("K0037")); //$NON-NLS-1$ + throw new IllegalStateException(Messages.getString("luni.5E")); //$NON-NLS-1$ } this.useCaches = newValue; } @@ -984,7 +984,7 @@ */ public void setConnectTimeout(int timeout) { if (0 > timeout) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } this.connectTimeout = timeout; } @@ -1012,7 +1012,7 @@ */ public void setReadTimeout(int timeout) { if (0 > timeout) { - throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("luni.5B")); //$NON-NLS-1$ } this.readTimeout = timeout; }
diff --git a/modules/luni/src/main/java/java/net/URLDecoder.java b/modules/luni/src/main/java/java/net/URLDecoder.java index fd2753c..c8cec36 100644 --- a/modules/luni/src/main/java/java/net/URLDecoder.java +++ b/modules/luni/src/main/java/java/net/URLDecoder.java
@@ -24,7 +24,7 @@ import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; /** * This class is used to decode a string which is encoded in the {@code @@ -96,8 +96,8 @@ // If the given encoding is an empty string throw an exception. if (enc.length() == 0) { throw new UnsupportedEncodingException( - // K00a5=Invalid parameter - {0} - Msg.getString("K00a5", "enc")); //$NON-NLS-1$ //$NON-NLS-2$ + // luni.99=Invalid parameter - {0} + Messages.getString("luni.99", "enc")); //$NON-NLS-1$ //$NON-NLS-2$ } if (s.indexOf('%') == -1) { @@ -141,16 +141,16 @@ do { if (i + 2 >= s.length()) { throw new IllegalArgumentException( - // K01fe=Incomplete % sequence at\: {0} - Msg.getString("K01fe", i)); //$NON-NLS-1$ + // luni.80=Incomplete % sequence at\: {0} + Messages.getString("luni.80", i)); //$NON-NLS-1$ } int d1 = Character.digit(s.charAt(i + 1), 16); int d2 = Character.digit(s.charAt(i + 2), 16); if (d1 == -1 || d2 == -1) { throw new IllegalArgumentException( - // K01ff=Invalid % sequence ({0}) at\: {1} - Msg.getString( - "K01ff", //$NON-NLS-1$ + // luni.81=Invalid % sequence ({0}) at\: {1} + Messages.getString( + "luni.81", //$NON-NLS-1$ s.substring(i, i + 3), String.valueOf(i))); }
diff --git a/modules/luni/src/main/java/java/net/URLStreamHandler.java b/modules/luni/src/main/java/java/net/URLStreamHandler.java index 0580d87..c967192 100644 --- a/modules/luni/src/main/java/java/net/URLStreamHandler.java +++ b/modules/luni/src/main/java/java/net/URLStreamHandler.java
@@ -19,7 +19,7 @@ import java.io.IOException; -import org.apache.harmony.luni.util.Msg; +import org.apache.harmony.luni.internal.nls.Messages; import org.apache.harmony.luni.util.URLUtil; /** @@ -61,7 +61,7 @@ */ protected URLConnection openConnection(URL u, Proxy proxy) throws IOException { - throw new UnsupportedOperationException(Msg.getString("K034d")); //$NON-NLS-1$ + throw new UnsupportedOperationException(Messages.getString("luni.9E")); //$NON-NLS-1$ } /**
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 94ff0db..8e51021 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
@@ -100,3 +100,80 @@ luni.53=non-public interfaces must be in the same package luni.54=not a proxy instance luni.55=String index out of range\: {0} +luni.56=Port out of range\: {0} +luni.57=Unresolved address +luni.58=Packet address mismatch with connected address +luni.59=Destination address is null +luni.5A=Zero or negative buffer size +luni.5B=Invalid negative timeout +luni.5C=The factory has already been set +luni.5D=SocketAddress is null +luni.5E=Connection already established +luni.5F=Already connected +luni.60=different mode already set +luni.61=scale value < than zero +luni.62=Illegal IPv6 address +luni.63=Scope id is not found for the given address +luni.64=Invalid IP Address is neither 4 or 16 bytes +luni.65=Invalid IP Address is neither 4 or 16 bytes\: {0} +luni.66=Attempted to join a non-multicast group +luni.67=No addresses associated with Interface +luni.68=address is null +luni.69=Attempted to leave a non-multicast group +luni.6A=Address not associated with an interface - not set +luni.6B=Cannot set network interface with null +luni.6C=TimeToLive out of bounds +luni.6D=interface name is null +luni.6E=Illegal Proxy.Type or SocketAddress argument +luni.6F=Socket is not bound +luni.70=Socket implementation factory already set +luni.71=Socket is already bound +luni.72=Method has not been implemented +luni.73=Proxy is null or invalid type +luni.74=Socket input is shutdown +luni.75=Socket output is shutdown +luni.76=Attempted to set a negative SoLinger +luni.77=Local port declared out of range +luni.78=Socket is not connected +luni.79=Urgent data not supported +luni.7A=Invalid action specified\: {0} +luni.7B=MinPort is greater than MaxPort\: {0} +luni.7C=Invalid port number specified\: {0} +luni.7D=Incomplete % sequence +luni.7E=Invalid % sequence ({0}) +luni.7F=Illegal character +luni.80=Incomplete % sequence at\: {0} +luni.81=Invalid % sequence ({0}) at\: {1} +luni.82=Relative path +luni.83=Scheme expected +luni.84=Scheme-specific part expected +luni.85=Illegal character in scheme +luni.86={0} in schemeSpecificPart +luni.87={0} in authority +luni.88={0} in path +luni.89={0} in query +luni.8A={0} in fragment +luni.8B=Invalid port number +luni.8C=Illegal character in userinfo +luni.8D=Expected a closing square bracket for ipv6 address +luni.8E=Malformed ipv6 address +luni.8F=Illegal character in host name +luni.90=Malformed ipv4 address +luni.91=URI is not absolute +luni.92={0} at index {1}\: {2} +luni.93={0}\: {1} +luni.94=One of urls is null +luni.95=field is null +luni.96=Does not support writing to the input stream +luni.97=Does not support writing to the output stream +luni.98=Duplicate Factory +luni.99=Invalid parameter - {0} +luni.9A=Attempt to set factory more than once. +luni.9B=Protocol not found\: {0} +luni.9C=Unknown protocol\: {0} +luni.9D=proxy should not be null +luni.9E=method has not been implemented yet +luni.9F=Authority expected +luni.A0=Expected host +luni.A1=Package is sealed +luni.A2=package is sealed