harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r452119 [3/3] - in /incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java: javax/naming/ javax/naming/directory/ javax/naming/ldap/ javax/naming/spi/ org/apache/harmony/jndi/internal/ org/apache/harmony/jndi/internal/nls/ org...
Date Mon, 02 Oct 2006 16:58:59 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResourceRecord.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResourceRecord.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResourceRecord.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResourceRecord.java
Mon Oct  2 09:58:57 2006
@@ -25,6 +25,8 @@
 
 import java.util.StringTokenizer;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * Represents domain protocol Resource Record
  * 
@@ -99,7 +101,8 @@
 
         // basic checking
         if (buffer == null) {
-            throw new DomainProtocolException("buffer is null");
+            // jndi.32=buffer is null
+            throw new DomainProtocolException(Messages.getString("jndi.32")); //$NON-NLS-1$
         }
         // NAME
         idx = ProviderMgr.writeName(name, buffer, idx);
@@ -132,13 +135,13 @@
             }
         }
         else if (rrType == ProviderConstants.SOA_TYPE) {
-            StringTokenizer st = new StringTokenizer((String) rData, " ");
+            StringTokenizer st = new StringTokenizer((String) rData, " "); //$NON-NLS-1$
             String token;
             int idx0 = idx; // saving RDLENGTH position
 
             if (st.countTokens() != 7) {
-                throw new DomainProtocolException(
-                        "Invalid number of fields while parsing SOA record");
+                // jndi.35=Invalid number of fields while parsing SOA record
+                throw new DomainProtocolException(Messages.getString("jndi.35")); //$NON-NLS-1$
             }
             idx += 2; // skip RDLENGTH for now
             // RDATA
@@ -161,20 +164,22 @@
                 }
             }
             catch (NumberFormatException e) {
+                // jndi.36=Error while parsing SOA record
                 throw new DomainProtocolException(
-                        "Error while parsing SOA record", e);
+                        Messages.getString("jndi.36"), e); //$NON-NLS-1$
             }
             // RDLENGTH
             ProviderMgr.write16Int(idx - 2 - idx0, buffer, idx0);
         }
         else if (rrType == ProviderConstants.MX_TYPE) {
-            StringTokenizer st = new StringTokenizer((String) rData, " ");
+            StringTokenizer st = new StringTokenizer((String) rData, " "); //$NON-NLS-1$
             String token;
             int idx0 = idx; // saving RDLENGTH position
 
             if (st.countTokens() != 2) {
+                // jndi.37=Invalid number of fields while parsing MX record
                 throw new DomainProtocolException(
-                        "Invalid number of fields while parsing MX record");
+                        Messages.getString("jndi.37")); //$NON-NLS-1$
             }
             idx += 2; // skip RDLENGTH for now
             // PREFERENCE
@@ -183,8 +188,9 @@
                 ProviderMgr.write16Int(Integer.parseInt(token), buffer, idx);
             }
             catch (NumberFormatException e) {
+                // jndi.38=Error while parsing MX record
                 throw new DomainProtocolException(
-                        "Error while parsing MX record", e);
+                        Messages.getString("jndi.38"), e); //$NON-NLS-1$
             }
             // EXCHANGE
             token = st.nextToken();
@@ -193,13 +199,14 @@
             ProviderMgr.write16Int(idx - 2 - idx0, buffer, idx0);
         }
         else if (rrType == ProviderConstants.HINFO_TYPE) {
-            StringTokenizer st = new StringTokenizer((String) rData, " ");
+            StringTokenizer st = new StringTokenizer((String) rData, " "); //$NON-NLS-1$
             String token;
             int idx0 = idx; // saving RDLENGTH position
 
             if (st.countTokens() != 2) {
+                // jndi.39=Invalid number of fields while parsing HINFO record
                 throw new DomainProtocolException(
-                        "Invalid number of fields while parsing HINFO record");
+                        Messages.getString("jndi.39")); //$NON-NLS-1$
             }
             idx += 2; // skip RDLENGTH for now
             // CPU
@@ -214,7 +221,7 @@
         else if (rrType == ProviderConstants.TXT_TYPE) {
             // character string with preceding length octet
             int idx0 = idx;
-            StringTokenizer st = new StringTokenizer((String) rData, " ");
+            StringTokenizer st = new StringTokenizer((String) rData, " "); //$NON-NLS-1$
 
             idx += 2;
             // RDATA
@@ -222,27 +229,30 @@
                 String token = st.nextToken();
 
                 if (token.getBytes().length > 255) {
+                    // jndi.3A=The length of character string exceed 255 octets
                     throw new DomainProtocolException(
-                            "The length of character string exceed 255 octets");
+                            Messages.getString("jndi.3A")); //$NON-NLS-1$
                 }
                 idx = ProviderMgr.writeCharString(token, buffer, idx);
             }
             if (idx - 2 - idx0 > 65535) {
+                // jndi.3B=Length of TXT field exceed 65535
                 throw new DomainProtocolException(
-                        "Length of TXT field exceed 65535");
+                        Messages.getString("jndi.3B")); //$NON-NLS-1$
             }
             // RDLENGTH
             ProviderMgr.write16Int(idx - 2 - idx0, buffer, idx0);
         }
         else if (rrType == ProviderConstants.SRV_TYPE) {
-            StringTokenizer st = new StringTokenizer((String) rData, " ");
+            StringTokenizer st = new StringTokenizer((String) rData, " "); //$NON-NLS-1$
             String token;
             int idx0 = idx; // saving RDLENGTH position
 
             idx += 2;
             if (st.countTokens() != 4) {
+                // jndi.3C=Invalid number of fields while parsing SRV record
                 throw new DomainProtocolException(
-                        "Invalid number of fields while parsing SRV record");
+                        Messages.getString("jndi.3C")); //$NON-NLS-1$
             }
             // RDATA
 
@@ -257,8 +267,9 @@
                 }
             }
             catch (NumberFormatException e) {
+                // jndi.3D=Error while parsing SRV record
                 throw new DomainProtocolException(
-                        "Error while parsing SRV record", e);
+                        Messages.getString("jndi.3D"), e); //$NON-NLS-1$
             }
             // TARGET
             token = st.nextToken();
@@ -271,9 +282,9 @@
             byte[] bytes;
             
             if (!(rData instanceof byte[])) {
+                // jndi.3E=RDATA for unknown record type {0} should have value of byte[]
type
                 throw new DomainProtocolException(
-                        "RDATA for unknown record type " + rrType +
-                        " should have value of byte[] type");
+                        Messages.getString("jndi.3E", rrType)); //$NON-NLS-1$
             }
             bytes = (byte[]) rData;
             // RDLENGTH
@@ -307,7 +318,8 @@
         Object rDat = null; 
 
         if (resultRR == null) {
-            throw new NullPointerException("Given resultRR is null");
+            // jndi.3F=Given resultRR is null
+            throw new NullPointerException(Messages.getString("jndi.3F")); //$NON-NLS-1$
         }
         // NAME
         idx = ProviderMgr.parseName(mesBytes, idx, nameSB);
@@ -355,7 +367,7 @@
             preference = ProviderMgr.parse16Int(mesBytes, idx);
             idx += 2;
             idx = ProviderMgr.parseName(mesBytes, idx, name);
-            rDat = "" + preference + " " +
+            rDat = "" + preference + " " + //$NON-NLS-1$ //$NON-NLS-2$
                     ProviderMgr.normalizeName(name.toString());
         }
         else if (rrType == ProviderConstants.SOA_TYPE) {
@@ -379,9 +391,9 @@
             idx += 4;
             minimum = ProviderMgr.parse32Int(mesBytes, idx);
             idx += 4;
-            rDat = ProviderMgr.normalizeName(mName.toString()) + " " +
-                    ProviderMgr.normalizeName(rName.toString()) + " " +
-                    serial + " " + refresh + " " + retry + " " + expire + " " +
+            rDat = ProviderMgr.normalizeName(mName.toString()) + " " + //$NON-NLS-1$
+                    ProviderMgr.normalizeName(rName.toString()) + " " + //$NON-NLS-1$
+                    serial + " " + refresh + " " + retry + " " + expire + " " + //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                     minimum;
         }
         else if (rrType == ProviderConstants.TXT_TYPE) {
@@ -408,7 +420,7 @@
             StringBuffer res = new StringBuffer();
 
             idx = ProviderMgr.parseCharString(mesBytes, idx, res);
-            res.append(" ");
+            res.append(" "); //$NON-NLS-1$
             idx = ProviderMgr.parseCharString(mesBytes, idx, res);
             rDat = res.toString();
         }
@@ -425,7 +437,7 @@
             port = ProviderMgr.parse16Int(mesBytes, idx);
             idx += 2;
             idx = ProviderMgr.parseName(mesBytes, idx, name);
-            rDat = "" + priority + " " + weight + " " + port + " " +
+            rDat = "" + priority + " " + weight + " " + port + " " + //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$
                     ProviderMgr.normalizeName(name.toString());
         }
         // TODO add more Resource Record types here
@@ -445,13 +457,13 @@
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append(name);
-        sb.append(" ");
+        sb.append(" "); //$NON-NLS-1$
         sb.append(ProviderConstants.rrTypeNames[rrType]);
-        sb.append(" ");
+        sb.append(" "); //$NON-NLS-1$
         sb.append(rrClass);
-        sb.append(" ");
-        sb.append("TTL=" + ttl);
-        sb.append(" ");
+        sb.append(" "); //$NON-NLS-1$
+        sb.append("TTL=" + ttl); //$NON-NLS-1$
+        sb.append(" "); //$NON-NLS-1$
         sb.append(rData.toString());
         return sb.toString();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
Mon Oct  2 09:58:57 2006
@@ -27,6 +27,8 @@
 import java.util.Hashtable;
 import java.util.Enumeration;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 
 /**
  * Represents DNS resolver's SLIST - the structure to keep the collected
@@ -347,7 +349,8 @@
         Vector<Server> result = new Vector<Server>();
         
         if (name == null) {
-            throw new NullPointerException("hostname is null");
+            // jndi.34=hostname is null
+            throw new NullPointerException(Messages.getString("jndi.34")); //$NON-NLS-1$
         }
         for (int i = 0; i < servers.size(); i++) {
             Server curServ = servers.get(i);
@@ -533,9 +536,9 @@
         @Override
         public String toString() {
             if (this.serverName != null) {
-                return serverName + ":" + serverPort; 
+                return serverName + ":" + serverPort;  //$NON-NLS-1$
             }
-            return serverIP + ":" + serverPort;
+            return serverIP + ":" + serverPort; //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/TransportMgr.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/TransportMgr.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/TransportMgr.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/TransportMgr.java
Mon Oct  2 09:58:57 2006
@@ -33,6 +33,8 @@
 import java.net.SocketTimeoutException;
 import java.net.UnknownHostException;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * Contains service methods that are used for transporting DNS messages from
  * DNS client to DNS server and vice versa.
@@ -80,8 +82,9 @@
         try {
             srvAddrArr = ProviderMgr.parseIpStr(server);
         } catch (IllegalArgumentException e) {
+            // jndi.40=Unable to connect: bad IP address
             throw new DomainProtocolException(
-                    "Unable to connect: bad IP address");
+                    Messages.getString("jndi.40")); //$NON-NLS-1$
         }
         try {
             dSocket = new DatagramSocket();
@@ -94,13 +97,15 @@
             inPacket = new DatagramPacket(inBuf, inBufLen, srvAddr, serverPort);
             dSocket.receive(inPacket);
         } catch (IllegalStateException e) {
+            // jndi.41=Error while querying DNS server
             throw new DomainProtocolException(
-                    "Error while querying DNS server", e);
+                    Messages.getString("jndi.41"), e); //$NON-NLS-1$
         } catch (SocketTimeoutException e) {
             throw (e);
         } catch (IOException e) {
+            // jndi.41=Error while querying DNS server
             throw new DomainProtocolException(
-                    "Error while querying DNS server", e);
+                    Messages.getString("jndi.41"), e); //$NON-NLS-1$
         } finally {
             if (dSocket != null) {
                 dSocket.close();
@@ -109,7 +114,8 @@
         if (inPacket != null) {
             return inPacket.getLength();
         }
-        throw new DomainProtocolException("unknown error");
+        // jndi.42=unknown error
+        throw new DomainProtocolException(Messages.getString("jndi.42")); //$NON-NLS-1$
     }
 
     /**
@@ -155,8 +161,9 @@
         try {
             srvAddrArr = ProviderMgr.parseIpStr(server);
         } catch (IllegalArgumentException e) {
+            // jndi.40=Unable to connect: bad IP address
             throw new DomainProtocolException(
-                    "Unable to connect: bad IP address");
+                    Messages.getString("jndi.40")); //$NON-NLS-1$
         }
         try {
             srvAddr = InetAddress.getByAddress(srvAddrArr);
@@ -171,21 +178,25 @@
             iStream.read(tmpArr, 0, 2);
             inLen = ProviderMgr.parse16Int(tmpArr, 0);
             if (inLen > inBufLen) {
-                throw new DomainProtocolException("Output buffer is too small");
+                // jndi.43=Output buffer is too small
+                throw new DomainProtocolException(Messages.getString("jndi.43")); //$NON-NLS-1$
             }
             actualLen = iStream.read(inBuf, 0, inLen);
             if (actualLen != inLen) {
+                // jndi.44=Error while receiving message over TCP
                 throw new DomainProtocolException(
-                        "Error while receiving message over TCP");
+                        Messages.getString("jndi.44")); //$NON-NLS-1$
             }
         } catch (IllegalStateException e) {
+            // jndi.41=Error while querying DNS server
             throw new DomainProtocolException(
-                    "Error while querying DNS server", e);
+                    Messages.getString("jndi.41"), e); //$NON-NLS-1$
         } catch (SocketTimeoutException e) {
             throw (e);
         } catch (IOException e) {
+            // jndi.41=Error while querying DNS server
             throw new DomainProtocolException(
-                    "Error while querying DNS server", e);
+                    Messages.getString("jndi.41"), e); //$NON-NLS-1$
         } finally {
             if (socket != null && !socket.isClosed()) {
                 try {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContext.java
Mon Oct  2 09:58:57 2006
@@ -32,6 +32,8 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * DNS context that is capable of serving requests with DNS URL's given as
  * names.
@@ -137,7 +139,8 @@
      */
     private void process(String name) throws NamingException {
         if (name == null) {
-            throw new NullPointerException("name is null");
+            // jndi.2E=The name is null
+            throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$
         }
         addToEnvironment(Context.PROVIDER_URL, name);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContextFactory.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContextFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContextFactory.java
Mon Oct  2 09:58:57 2006
@@ -30,6 +30,8 @@
 import javax.naming.NamingException;
 import javax.naming.spi.ObjectFactory;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 
 /**
  * Factory to create DNS URL contexts.
@@ -51,7 +53,7 @@
      * @throws NamingException if such exception was encountered 
      * @see ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
             Hashtable<?, ?> environment) throws NamingException
     {
@@ -76,8 +78,8 @@
             newEnv.put(Context.PROVIDER_URL, sb.toString());
             return new DNSContext(newEnv);
         } else {
-            throw new IllegalArgumentException(
-                    "obj should be either null, String or array of String");
+            // jndi.65=obj should be either null, String or array of String
+            throw new IllegalArgumentException(Messages.getString("jndi.65")); //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/AtomicNameParser.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/AtomicNameParser.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/AtomicNameParser.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/AtomicNameParser.java
Mon Oct  2 09:58:57 2006
@@ -48,7 +48,7 @@
      * Static initializer for {@link #syntax}.
      */
     static {
-        syntax.put("jndi.syntax.direction", "flat");
+        syntax.put("jndi.syntax.direction", "flat"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
Mon Oct  2 09:58:57 2006
@@ -65,6 +65,8 @@
 import javax.naming.StringRefAddr;
 import javax.naming.spi.NamingManager;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 
 /**
  * RMI Registry context implementation.
@@ -79,24 +81,24 @@
      * for specifying that RMI security manager should be installed.
      */
     public static final String SECURITY_MANAGER =
-            "java.naming.rmi.security.manager";
+            "java.naming.rmi.security.manager"; //$NON-NLS-1$
 
     /**
      * Constant that holds the name of the environment property
      * for specifying the name of {@link RMIClientSocketFactory} class.
      */
     public static final String CLIENT_SOCKET_FACTORY =
-            "org.apache.harmony.jndi.provider.rmi.registry.clientSocketFactory";
+            "org.apache.harmony.jndi.provider.rmi.registry.clientSocketFactory"; //$NON-NLS-1$
 
     /**
      * Prefix for RMI URLs.
      */
-    public static final String RMI_URL_PREFIX = "rmi:";
+    public static final String RMI_URL_PREFIX = "rmi:"; //$NON-NLS-1$
 
     /**
      * Address type for RMI context references.
      */
-    public static final String ADDRESS_TYPE = "URL";
+    public static final String ADDRESS_TYPE = "URL"; //$NON-NLS-1$
 
     /**
      * Name parser.
@@ -152,7 +154,7 @@
      * @throws  NamingException
      *          If some naming error occurs.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     public RegistryContext(String host, int port, Hashtable<?, ?> environment)
             throws NamingException {
         this.host = host;
@@ -177,16 +179,19 @@
                         clientSocketFactoryName, true, Thread.currentThread()
                                 .getContextClassLoader()).newInstance();
             } catch (ClassNotFoundException e) {
+                // jndi.79=RMI Client Socket Factory cannot be instantiated
                 throw (ConfigurationException) new ConfigurationException(
-                        "RMI Client Socket Factory cannot be instantiated")
+                        Messages.getString("jndi.79")) //$NON-NLS-1$
                                 .initCause(e);
             } catch (InstantiationException e) {
+                // jndi.79=RMI Client Socket Factory cannot be instantiated
                 throw (ConfigurationException) new ConfigurationException(
-                        "RMI Client Socket Factory cannot be instantiated")
+                        Messages.getString("jndi.79")) //$NON-NLS-1$
                                 .initCause(e);
             } catch (IllegalAccessException e) {
+                // jndi.79=RMI Client Socket Factory cannot be instantiated
                 throw (NoPermissionException) new NoPermissionException(
-                        "RMI Client Socket Factory cannot be instantiated")
+                        Messages.getString("jndi.79")) //$NON-NLS-1$
                                 .initCause(e);
             }
         }
@@ -200,7 +205,7 @@
      * @param   context
      *          Context to copy.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     protected RegistryContext(RegistryContext context) {
         host = context.host;
         port = context.port;
@@ -222,8 +227,9 @@
         try {
             return getObjectInstance(stringName, registry.lookup(stringName));
         } catch (NotBoundException e) {
+            // jndi.7A=Name is not bound: {0}
             throw (NameNotFoundException) new NameNotFoundException(
-                    "Name is not bound: " + stringName).initCause(e);
+                    Messages.getString("jndi.7A", stringName)).initCause(e); //$NON-NLS-1$
         } catch (RemoteException e) {
             throw (NamingException) newNamingException(e).fillInStackTrace();
         }
@@ -255,15 +261,17 @@
      */
     public void bind(Name name, Object obj) throws NamingException {
         if (name.isEmpty()) {
-            throw new InvalidNameException("Cannot bind empty name");
+            // jndi.7B=Cannot bind empty name
+            throw new InvalidNameException(Messages.getString("jndi.7B")); //$NON-NLS-1$
         }
         String stringName = getMyComponents(name);
 
         try {
             registry.bind(stringName, getStateToBind(stringName, obj));
         } catch (AlreadyBoundException e) {
+            // jndi.7C=Name is already bound: {0}
             throw (NameAlreadyBoundException) new NameAlreadyBoundException(
-                    "Name is already bound: " + stringName).initCause(e);
+                    Messages.getString("jndi.7C", stringName)).initCause(e); //$NON-NLS-1$
         } catch (RemoteException e) {
             throw (NamingException) newNamingException(e).fillInStackTrace();
         }
@@ -281,7 +289,8 @@
      */
     public void rebind(Name name, Object obj) throws NamingException {
         if (name.isEmpty()) {
-            throw new InvalidNameException("Cannot rebind empty name");
+            // jndi.7D=Cannot rebind empty name
+            throw new InvalidNameException(Messages.getString("jndi.7D")); //$NON-NLS-1$
         }
         String stringName = getMyComponents(name);
 
@@ -304,7 +313,8 @@
      */
     public void unbind(Name name) throws NamingException {
         if (name.isEmpty()) {
-            throw new InvalidNameException("Cannot unbind empty name");
+            // jndi.7E=Cannot unbind empty name
+            throw new InvalidNameException(Messages.getString("jndi.7E")); //$NON-NLS-1$
         }
         String stringName = getMyComponents(name);
 
@@ -329,8 +339,8 @@
      */
     public Context createSubcontext(Name name)
             throws OperationNotSupportedException {
-        throw new OperationNotSupportedException("RMI Registry "
-                + "is a flat context and doesn't support subcontexts");
+        // jndi.7F=RMI Registry is a flat context and doesn't support subcontexts
+        throw new OperationNotSupportedException(Messages.getString("jndi.7F")); //$NON-NLS-1$
     }
 
     /**
@@ -345,8 +355,8 @@
      */
     public void destroySubcontext(Name name)
             throws OperationNotSupportedException {
-        throw new OperationNotSupportedException("RMI Registry "
-                + "is a flat context and doesn't support subcontexts");
+        // jndi.7F=RMI Registry is a flat context and doesn't support subcontexts
+        throw new OperationNotSupportedException(Messages.getString("jndi.7F")); //$NON-NLS-1$
     }
 
     /**
@@ -387,13 +397,14 @@
 
         if (obj instanceof Context) {
             try {
-                return ((Context) obj).list("");
+                return ((Context) obj).list(""); //$NON-NLS-1$
             } finally {
                 ((Context) obj).close();
             }
         }
+        // jndi.80=Name specifies an object that is not a context: {0}
         throw new NotContextException(
-                "Name specifies an object that is not a context: " + name);
+                Messages.getString("jndi.80", name)); //$NON-NLS-1$
     }
 
     /**
@@ -419,13 +430,14 @@
 
         if (obj instanceof Context) {
             try {
-                return ((Context) obj).listBindings("");
+                return ((Context) obj).listBindings(""); //$NON-NLS-1$
             } finally {
                 ((Context) obj).close();
             }
         }
+        // jndi.80=Name specifies an object that is not a context: {0}
         throw new NotContextException(
-                "Name specifies an object that is not a context: " + name);
+                Messages.getString("jndi.80", name)); //$NON-NLS-1$
     }
 
     /**
@@ -469,7 +481,7 @@
      * {@inheritDoc}
      */
     public String getNameInNamespace() {
-        return "";
+        return ""; //$NON-NLS-1$
     }
 
     /**
@@ -510,15 +522,15 @@
      */
     public Reference getReference() throws NamingException {
         if (reference == null) {
-            if ((host == null) || (host.equals("localhost"))) {
+            if ((host == null) || (host.equals("localhost"))) { //$NON-NLS-1$
+                // jndi.81=Cannot create reference for RMI registry that is being accessed
using localhost
                 throw new ConfigurationException(
-                        "Cannot create reference for RMI registry "
-                        + "that is being accessed using localhost");
+                        Messages.getString("jndi.81")); //$NON-NLS-1$
             }
             reference = new Reference(
                     RegistryContext.class.getName(),
-                    new StringRefAddr(ADDRESS_TYPE, RMI_URL_PREFIX + "//"
-                            + host + ((port > 0) ? (":" + port) : "")),
+                    new StringRefAddr(ADDRESS_TYPE, RMI_URL_PREFIX + "//" //$NON-NLS-1$
+                            + host + ((port > 0) ? (":" + port) : "")), //$NON-NLS-1$
//$NON-NLS-2$
                     RegistryContextFactory.class.getName(), null);
         }
         return (Reference) reference.clone();
@@ -602,9 +614,8 @@
             return new RemoteReferenceWrapper(
                     ((Referenceable) obj).getReference());
         }
-
-        throw new IllegalArgumentException("Cannot bind to RMI Registry object "
-                + "that is neither Remote nor Reference nor Referenceable");
+        // jndi.82=Cannot bind to RMI Registry object that is neither Remote nor Reference
nor Referenceable
+        throw new IllegalArgumentException(Messages.getString("jndi.82")); //$NON-NLS-1$
     }
 
     /**
@@ -642,8 +653,9 @@
         } catch (RemoteException e) {
             throw e;
         } catch (Exception e) {
+            // jndi.83=NamingManager.getObjectInstance() failed
             throw (NamingException) new NamingException(
-                    "NamingManager.getObjectInstance() failed").initCause(e);
+                    Messages.getString("jndi.83")).initCause(e); //$NON-NLS-1$
         }
     }
 
@@ -676,7 +688,7 @@
      *
      * @return  Generated {@link NamingException} exception.
      */
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings("deprecation") //$NON-NLS-1$
     protected NamingException newNamingException(Throwable e) {
         NamingException ret =
                   (e instanceof AccessException)
@@ -717,8 +729,9 @@
             try {
                 System.setSecurityManager(new RMISecurityManager());
             } catch (SecurityException e) {
+                // jndi.84=Cannot install RMISecurityManager
                 throw (NoPermissionException) new NoPermissionException(
-                        "Cannot install RMISecurityManager").initCause(e);
+                        Messages.getString("jndi.84")).initCause(e); //$NON-NLS-1$
             }
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java
Mon Oct  2 09:58:57 2006
@@ -37,6 +37,7 @@
 import javax.naming.spi.InitialContextFactory;
 import javax.naming.spi.ObjectFactory;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
 import org.apache.harmony.jndi.provider.rmi.rmiURLContextFactory;
 
 
@@ -75,8 +76,8 @@
         if (obj instanceof Context) {
             return (Context) obj;
         }
-        throw new NotContextException("Object instantiated using the "
-                + "URL specified in environment is not a context: " + url);
+        // jndi.76=Object instantiated using the URL specified in environment is not a context:
{0}
+        throw new NotContextException(Messages.getString("jndi.76", url)); //$NON-NLS-1$
     }
 
     /**
@@ -96,7 +97,8 @@
         int size = reference.size();
 
         if (size < 1) {
-            throw new ConfigurationException("Reference is empty");
+            // jndi.77=Reference is empty
+            throw new ConfigurationException(Messages.getString("jndi.77")); //$NON-NLS-1$
         }
         Vector<Object> urls = new Vector<Object>(size);
 
@@ -111,8 +113,8 @@
         size = urls.size();
 
         if (size < 1) {
-            throw new ConfigurationException(
-                    "Reference contains no valid addresses");
+            // jndi.78=Reference contains no valid addresses
+            throw new ConfigurationException(Messages.getString("jndi.78")); //$NON-NLS-1$
         }
         Object ret = new rmiURLContextFactory().getObjectInstance(
                 urls.toArray(new String[size]), name, nameCtx, environment);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java
Mon Oct  2 09:58:57 2006
@@ -28,13 +28,15 @@
  */
 package org.apache.harmony.jndi.provider.rmi.registry;
 
-@SuppressWarnings("deprecation")
+import org.apache.harmony.jndi.internal.nls.Messages;
+
+@SuppressWarnings("deprecation") //$NON-NLS-1$
 public final class RemoteReferenceWrapper_Skel implements java.rmi.server.Skeleton {
 
     private static final long interfaceHash = 2534274963554139942L;
 
     private static final java.rmi.server.Operation[] operations = {
-        new java.rmi.server.Operation("javax.naming.Reference getReference()")
+        new java.rmi.server.Operation("javax.naming.Reference getReference()") //$NON-NLS-1$
     };
 
     public java.rmi.server.Operation[] getOperations() {
@@ -46,12 +48,14 @@
             if (hash == 3529874867989176284L) {
                 opnum = 0;
             } else {
-                throw new java.rmi.UnmarshalException("Invalid method hash: " + hash);
+                // jndi.87=Invalid method hash: {0}
+                throw new java.rmi.UnmarshalException(Messages.getString("jndi.87", hash));
//$NON-NLS-1$
             }
         } else {
             if (hash != interfaceHash) {
+                // jndi.88=Interface hash mismatch, expected: {0}, received: {1}
                 throw new java.rmi.server.SkeletonMismatchException(
-                        "Interface hash mismatch, expected: " + interfaceHash + ", received:
" + hash);
+                        Messages.getString("jndi.88", interfaceHash , hash)); //$NON-NLS-1$
             }
         }
 
@@ -69,14 +73,16 @@
                 java.io.ObjectOutput out = call.getResultStream(true);
                 out.writeObject($result);
             } catch (java.io.IOException e) {
-                throw new java.rmi.MarshalException("Error marshalling return", e);
+                // jndi.89=Error marshalling return
+                throw new java.rmi.MarshalException(Messages.getString("jndi.89"), e); //$NON-NLS-1$
             }
 
             break;
         }
 
         default:
-            throw new java.rmi.UnmarshalException("Invalid method number: " + opnum);
+            // jndi.8A=Invalid method number: {0}
+            throw new java.rmi.UnmarshalException(Messages.getString("jndi.8A", opnum));
//$NON-NLS-1$
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java
Mon Oct  2 09:58:57 2006
@@ -28,7 +28,9 @@
  */
 package org.apache.harmony.jndi.provider.rmi.registry;
 
-@SuppressWarnings("deprecation")
+import org.apache.harmony.jndi.internal.nls.Messages;
+
+@SuppressWarnings("deprecation") //$NON-NLS-1$
 public final class RemoteReferenceWrapper_Stub extends java.rmi.server.RemoteStub
         implements org.apache.harmony.jndi.provider.rmi.registry.RemoteReference, java.rmi.Remote
{
 
@@ -39,16 +41,16 @@
     private static boolean useNewInvoke;
 
     private static final java.rmi.server.Operation[] operations = {
-        new java.rmi.server.Operation("javax.naming.Reference getReference()")
+        new java.rmi.server.Operation("javax.naming.Reference getReference()") //$NON-NLS-1$
     };
 
     private static java.lang.reflect.Method $method_getReference_0;
 
     static {
         try {
-            java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] {java.rmi.Remote.class,
java.lang.reflect.Method.class, java.lang.Object[].class, long.class});
+            java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] {java.rmi.Remote.class,
java.lang.reflect.Method.class, java.lang.Object[].class, long.class}); //$NON-NLS-1$
 
-            $method_getReference_0 = org.apache.harmony.jndi.provider.rmi.registry.RemoteReference.class.getMethod("getReference",
new java.lang.Class[] {});
+            $method_getReference_0 = org.apache.harmony.jndi.provider.rmi.registry.RemoteReference.class.getMethod("getReference",
new java.lang.Class[] {}); //$NON-NLS-1$
 
             useNewInvoke = true;
         } catch (java.lang.NoSuchMethodException e) {
@@ -82,9 +84,11 @@
                 java.io.ObjectInput in = call.getInputStream();
                 $result = (javax.naming.Reference) in.readObject();
             } catch (java.io.IOException e) {
-                throw new java.rmi.UnmarshalException("Error unmarshalling return value",
e);
+                // jndi.85=Error unmarshalling return value
+                throw new java.rmi.UnmarshalException(Messages.getString("jndi.85"), e);
//$NON-NLS-1$
             } catch (java.lang.ClassNotFoundException e) {
-                throw new java.rmi.UnmarshalException("Error unmarshalling return value",
e);
+                // jndi.85=Error unmarshalling return value
+                throw new java.rmi.UnmarshalException(Messages.getString("jndi.85"), e);
//$NON-NLS-1$
             } finally {
                 ref.done(call);
             }
@@ -97,7 +101,8 @@
         } catch (javax.naming.NamingException e) {
             throw e;
         } catch (java.lang.Exception e) {
-            throw new java.rmi.UnexpectedException("Undeclared checked exception", e);
+            // jndi.86=Undeclared checked exception
+            throw new java.rmi.UnexpectedException(Messages.getString("jndi.86"), e); //$NON-NLS-1$
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java
Mon Oct  2 09:58:57 2006
@@ -29,6 +29,7 @@
 
 import javax.naming.spi.ResolveResult;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
 import org.apache.harmony.jndi.provider.GenericURLContext;
 
 import org.apache.harmony.jndi.provider.rmi.registry.RegistryContext;
@@ -80,8 +81,9 @@
     protected ResolveResult getRootURLContext(
             String url, Hashtable<?, ?> environment) throws NamingException {
         if (!url.startsWith(RegistryContext.RMI_URL_PREFIX)) {
+            // jndi.74=Not an RMI URL, incorrect prefix: {0}
             throw new IllegalArgumentException(
-                    "Not an RMI URL, incorrect prefix: " + url);
+                    Messages.getString("jndi.74", url)); //$NON-NLS-1$
         }
         int length = url.length();
         int start = RegistryContext.RMI_URL_PREFIX.length();
@@ -117,9 +119,10 @@
                     try {
                         port = Integer.parseInt(url.substring(portStart, end));
                     } catch (NumberFormatException e) {
+                        // jndi.75=Invalid port number in URL: {0}
                         throw (IllegalArgumentException)
-                                new IllegalArgumentException("Invalid port "
-                                    + "number in URL: " + url).initCause(e);
+                                new IllegalArgumentException(Messages.getString("jndi.75",
//$NON-NLS-1$
+                                    url)).initCause(e);
                     }
                 }
 



Mime
View raw message