harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r452119 [1/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
Author: tellison
Date: Mon Oct  2 09:58:57 2006
New Revision: 452119

URL: http://svn.apache.org/viewvc?view=rev&rev=452119
Log:
Apply patch HARMONY-1330 ([classlib][internationalization]Internationalization of the jndi module)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompositeName.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/InitialContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/LinkRef.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NameClassPair.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InitialDirContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/InitialLdapContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContextFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSNameParser.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSPseudoURL.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Message.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderConstants.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderMgr.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/QuestionRecord.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResourceRecord.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/TransportMgr.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/dnsURLContextFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/AtomicNameParser.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompositeName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompositeName.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompositeName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompositeName.java Mon Oct  2 09:58:57 2006
@@ -25,6 +25,8 @@
 import java.util.List;
 import java.util.Vector;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A <code>CompositeName</code> represents a name in a naming service which 
  * spans multiple namespaces. For example the name 
@@ -223,7 +225,8 @@
                     status = OUT_OF_QUOTE;
                     continue;
                 }
-                throw new InvalidNameException("End quote is not at the end of element"); //$NON-NLS-1$
+                // jndi.0C=End quote is not at the end of element
+                throw new InvalidNameException(Messages.getString("jndi.0C"));  //$NON-NLS-1$
             }
 
             if (c == '\\') {
@@ -237,7 +240,8 @@
                         buf.append(nc);
                     }
                 } catch (ArrayIndexOutOfBoundsException e) {
-                    throw new InvalidNameException("Escape cannot be at the end of element"); //$NON-NLS-1$
+                    // jndi.0D=Escape cannot be at the end of element
+                    throw new InvalidNameException(Messages.getString("jndi.0D"));  //$NON-NLS-1$
                 }
                 continue;
             }
@@ -267,7 +271,8 @@
 
         // check end status
         if (status != OUT_OF_QUOTE && status != QUOTE_ENDED) {
-            throw new InvalidNameException("Wrong quote usage."); //$NON-NLS-1$
+            // jndi.0E=Wrong quote usage.
+            throw new InvalidNameException(Messages.getString("jndi.0E"));  //$NON-NLS-1$
         }
         return l;
     }
@@ -355,7 +360,8 @@
             throw new NullPointerException();
         }
         if (!(name instanceof CompositeName)) {
-            throw new InvalidNameException("Must be a CompositeName"); //$NON-NLS-1$
+            // jndi.0F=Must be a CompositeName
+            throw new InvalidNameException(Messages.getString("jndi.0F"));  //$NON-NLS-1$
         }
 
         Enumeration<String> enumeration = name.getAll();
@@ -370,7 +376,8 @@
             throw new NullPointerException();
         }
         if (!(name instanceof CompositeName)) {
-            throw new InvalidNameException("Must be a CompositeName"); //$NON-NLS-1$
+            // jndi.0F=Must be a CompositeName
+            throw new InvalidNameException(Messages.getString("jndi.0F"));  //$NON-NLS-1$
         }
 
         if (index < 0 || index > elems.size()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java Mon Oct  2 09:58:57 2006
@@ -24,6 +24,8 @@
 import java.util.Properties;
 import java.util.Vector;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A <code>CompoundName</code> is a series of string elements, and it represents 
  * a name in a naming service within a single namespace. Typically these 
@@ -52,21 +54,21 @@
  * The following properties are all optional:
  * <ul>
  * <li>
- * jndi.syntax.escape -		Escape sequence,The escape sequence is used to escape 
- * 							a quote, separator or escape. When preceded itself by 
- * 							the escape sequence it is treated as ordinary characters.
- * 							When it is followed by chars which are not quote or 
- * 							separator strings then it is treated as ordinary characters</li>
+ * jndi.syntax.escape -     Escape sequence,The escape sequence is used to escape 
+ *                          a quote, separator or escape. When preceded itself by 
+ *                          the escape sequence it is treated as ordinary characters.
+ *                          When it is followed by chars which are not quote or 
+ *                          separator strings then it is treated as ordinary characters</li>
  * <li>
- * jndi.syntax.beginquote -	Used as start of quoted string (Defaults to endquote)</li>
+ * jndi.syntax.beginquote - Used as start of quoted string (Defaults to endquote)</li>
  * <li>
- * jndi.syntax.endquote - 	Used as end of quoted string (Defaults to beginquote)</li>
+ * jndi.syntax.endquote -   Used as end of quoted string (Defaults to beginquote)</li>
  * <li>
- * jndi.syntax.beginquote2 -	Additionally used as start of quoted string 
- * 							(Defaults to endquote2)</li>
+ * jndi.syntax.beginquote2 -    Additionally used as start of quoted string 
+ *                          (Defaults to endquote2)</li>
  * <li>
- * jndi.syntax.endquote2 - 	Additionally used as end of quoted string 
- * 							(Defaults to beginquote2)</li>
+ * jndi.syntax.endquote2 -  Additionally used as end of quoted string 
+ *                          (Defaults to beginquote2)</li>
  * </ul>
  * <p>
  * When a non-escaped quote appears at the start of an element it must be matched at the
@@ -80,11 +82,11 @@
  * <p>
  * <ul>
  * <li>
- * jndi.syntax.ignorecase -	If 'true' then ignore case when name elements are compared.
- *  						If false or not set then case is important.</li>
+ * jndi.syntax.ignorecase - If 'true' then ignore case when name elements are compared.
+ *                          If false or not set then case is important.</li>
  * <li>
- * jndi.syntax.trimblanks -	If 'true' then ignore leading & trailing blanks when name elements are compared.
- * 							If false or not set then blanks are important.</li>
+ * jndi.syntax.trimblanks - If 'true' then ignore leading & trailing blanks when name elements are compared.
+ *                          If false or not set then blanks are important.</li>
  * </ul></p>
  * <p>
  * These 2 properties relate to names where the syntax includes attribute/content 
@@ -307,10 +309,10 @@
      * Constructs a <code>CompoundName</code> with supplied <code>Enumeration</code> 
      * and <code>Properties</code>
      * 
-     * @param elements		an enumeration of name elements, cannot be null
-     * @param props			the properties, cannot be null but may be empty. 
-     * 						If empty, the direction defaults to flat and no 
-     * 						other properties are required.
+     * @param elements      an enumeration of name elements, cannot be null
+     * @param props         the properties, cannot be null but may be empty. 
+     *                      If empty, the direction defaults to flat and no 
+     *                      other properties are required.
      */
     protected CompoundName(Enumeration<String> elements, Properties props) {
         if (null == props || null == elements) {
@@ -328,12 +330,12 @@
      * and <code>Properties</code>,  taking the supplied <code>s</code> and 
      * breaking it down into its elements. 
      *
-     * @param s				a string containing the full compound name
-     * @param props			the properties, cannot be null but may be empty for a flat name
+     * @param s             a string containing the full compound name
+     * @param props         the properties, cannot be null but may be empty for a flat name
      * @throws InvalidNameException 
-     * 						thrown if the supplied <code>String s</code> is invalid
+     *                      thrown if the supplied <code>String s</code> is invalid
      * @throws NullPointerException 
-     * 						thrown if the supplied <code>String s</code> is null
+     *                      thrown if the supplied <code>String s</code> is null
      */
     public CompoundName(String s, Properties props) throws InvalidNameException {
         if (null == s || null == props) {
@@ -359,16 +361,16 @@
         //if direction value must equals to one of FLAT, LEFT_TO_RIGHT and RIGHT_TO_LEFT, exception throwed 
         if (!LEFT_TO_RIGHT.equals(direction)
                 && !RIGHT_TO_LEFT.equals(direction) && !FLAT.equals(direction)) {
-            throw new IllegalArgumentException(
-                    "Illegal direction property value, which must be one of right_to_left, left_to_right or flat"); //$NON-NLS-1$
+            // jndi.04=Illegal direction property value, which must be one of right_to_left, left_to_right or flat
+            throw new IllegalArgumentException(Messages.getString("jndi.04"));  //$NON-NLS-1$
         }
         flat = FLAT.equals(direction);
 
         separatorString = flat ? NULL_STRING : props.getProperty(SEPARATOR);
-        //		if direction is not FLAT, separator must be set
+        //      if direction is not FLAT, separator must be set
         if (null == separatorString && !flat) {
-            throw new IllegalArgumentException(
-                    "jndi.syntax.separator property must be set when jndi.syntax.direction is not flat"); //$NON-NLS-1$
+            // jndi.05=jndi.syntax.separator property must be set when jndi.syntax.direction is not flat
+            throw new IllegalArgumentException(Messages.getString("jndi.05"));  //$NON-NLS-1$
         }
         separatorString2 = (flat || null == (property = props
                 .getProperty(SEPARATOR2))) ? NULL_STRING : property;
@@ -464,8 +466,8 @@
                 pos += escapeString.length();
                 if (pos == s.length()) {
                     //if this escape char is last character, throw exception
-                    throw new InvalidNameException("The " + escapeString //$NON-NLS-1$
-                            + " cannot be at end of the component"); //$NON-NLS-1$
+                    // jndi.06=The {0} cannot be at end of the component
+                    throw new InvalidNameException(Messages.getString("jndi.06", escapeString));  //$NON-NLS-1$
                 }
                 // if one escape char followed by a special char, append the
                 // special char to current element
@@ -489,9 +491,8 @@
                 pos += addBuffer(element, sepAvaString, true);
                 status = INIT_STATUS;
             } else if (status == QUOTEEND_STATUS) {
-                throw new InvalidNameException(
-                        s
-                                + ": close quote must appears at end of component in quoted string"); //$NON-NLS-1$
+                // jndi.07={0}: close quote must appears at end of component in quoted string
+                throw new InvalidNameException(Messages.getString("jndi.07", s));  //$NON-NLS-1$
             } else {
                 status = status == INIT_STATUS ? NORMAL_STATUS : status;
                 element.append(s.charAt(pos++));
@@ -501,8 +502,8 @@
             hasNotNullElement = hasNotNullElement || element.length() > 0;
             addElement(element);
         } else {
-            throw new InvalidNameException(s
-                    + ": close quote is required for quoted string"); //$NON-NLS-1$
+            // jndi.08={0}: close quote is required for quoted string
+            throw new InvalidNameException(Messages.getString("jndi.08", s));  //$NON-NLS-1$
         }
         if (!hasNotNullElement) {
             elem.remove(elem.size() - 1);
@@ -627,8 +628,8 @@
 
     public Name addAll(int index, Name name) throws InvalidNameException {
         if (!(name instanceof CompoundName)) {
-            throw new InvalidNameException(name.toString()
-                    + " is not a compound name."); //$NON-NLS-1$
+            // jndi.09={0} is not a compound name.
+            throw new InvalidNameException(Messages.getString("jndi.09", name.toString()));  //$NON-NLS-1$
         }
         validateIndex(index, true);
         Enumeration<String> enumeration = name.getAll();
@@ -640,7 +641,8 @@
 
     public Name add(String element) throws InvalidNameException {
         if (element == null) {
-            throw new InvalidNameException("A flat name can only have a single component");
+            // jndi.0A=A flat name can only have a single component
+            throw new InvalidNameException(Messages.getString("jndi.0A")); //$NON-NLS-1$
         }
         elem.add(element);
         return this;
@@ -648,19 +650,20 @@
 
     /**
      * Insert an element within this CompoundName at the specified index.
-     * @return 				this <code>CompoundName</code>.
-     * @param element 		the String to insert
-     * @param index			the index of the element to insert - must be greater 
-     * 						than or equal to 0 and less than size().
+     * @return              this <code>CompoundName</code>.
+     * @param element       the String to insert
+     * @param index         the index of the element to insert - must be greater 
+     *                      than or equal to 0 and less than size().
      * @throws ArrayIndexOutOfBoundsException 
-     * 						thrown when the index is invalid.
+     *                      thrown when the index is invalid.
      * @throws InvalidNameException 
-     * 						thrown if the insertion of the element results in 
-     * 						this <code>CompoundName</code> becoming invalid.
+     *                      thrown if the insertion of the element results in 
+     *                      this <code>CompoundName</code> becoming invalid.
      */
     public Name add(int index, String element) throws InvalidNameException {
         if (element == null) {
-            throw new InvalidNameException("A flat name can only zero or one component");
+            // jndi.0B=A flat name can only zero or one component
+            throw new InvalidNameException(Messages.getString("jndi.0B")); //$NON-NLS-1$
         }
         validateIndex(index, true);
         elem.add(index, element);
@@ -670,14 +673,14 @@
     /**
      * Delete an element from this <code>CompoundName</code>.
      * 
-     * @return 				the deleted element
-     * @param index			the index of the element to delete - must be greater 
-     * 						than or equal to 0 and less than size().
+     * @return              the deleted element
+     * @param index         the index of the element to delete - must be greater 
+     *                      than or equal to 0 and less than size().
      * @throws ArrayIndexOutOfBoundsException 
-     * 						thrown when the index is invalid.
+     *                      thrown when the index is invalid.
      * @throws InvalidNameException 
-     * 						thrown if the deletion of the element results in 
-     * 						this <code>CompoundName</code> becoming invalid.
+     *                      thrown if the deletion of the element results in 
+     *                      this <code>CompoundName</code> becoming invalid.
      */
     public Object remove(int index) throws InvalidNameException {
         validateIndex(index, false);
@@ -747,7 +750,7 @@
      * One of them is of a type which is a private class and cannot therefore
      * be specified or implemented and so will be excluded from our deliverable.
      * The one protected field which we can spec and implement is as follows:
-     * 		protected Properties mySyntax - The properties associated with a CompoundName.
+     *      protected Properties mySyntax - The properties associated with a CompoundName.
      
      
      * 
@@ -773,16 +776,16 @@
      * a <code>CompoundName</code>. Other than that the comparison is the same 
      * as that for a <code>CompositeName</code>.</p>
      * 
-     * @return  				a negative number means this is less than the 
-     *						supplied Object <code>o</code>. 
-     *						a positive number means this is greater than the 
-     *						supplied Object <code>o</code>.
-     *         				zero means the two objects are equal. 
-     * @param  o				the object to compare - cannot be null. 
+     * @return                  a negative number means this is less than the 
+     *                      supplied Object <code>o</code>. 
+     *                      a positive number means this is greater than the 
+     *                      supplied Object <code>o</code>.
+     *                      zero means the two objects are equal. 
+     * @param  o                the object to compare - cannot be null. 
      * @throws ClassCastException 
-     *						when <code>o</code> is not a compatible class that 
-     *						can be compared or if the object to compare 
-     *						<code>o</code> is null.
+     *                      when <code>o</code> is not a compatible class that 
+     *                      can be compared or if the object to compare 
+     *                      <code>o</code> is null.
      */
     public int compareTo(Object o) {
         if (!(o instanceof CompoundName)) {
@@ -821,7 +824,7 @@
      * If jndi.syntax.ignorecase is set to true then use the lowercase version 
      * of the element to calculate its hashcode.</p>
      * 
-     * @return 				the hashcode of this object.
+     * @return              the hashcode of this object.
      */
     @Override
     public int hashCode() {
@@ -1001,9 +1004,9 @@
  * field (see above).
  */
 class NameImpl {
-	protected NameImpl() {
-		super();
-	}
+    protected NameImpl() {
+        super();
+    }
 }
 
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/InitialContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/InitialContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/InitialContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/InitialContext.java Mon Oct  2 09:58:57 2006
@@ -22,6 +22,7 @@
 
 import org.apache.harmony.jndi.internal.UrlParser;
 import org.apache.harmony.jndi.internal.EnvironmentReader;
+import org.apache.harmony.jndi.internal.nls.Messages;
 
 /**
  * An <code>InitialContext</code> object is required as the starting context
@@ -175,7 +176,7 @@
      *                          the context 
      * @throws NamingException  If failed to create an InitialContext.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     private void internalInit(Hashtable<?, ?> env) throws NamingException {
 
         // 1. Read the environment parameter used to create this Context
@@ -235,7 +236,7 @@
         if (!this.gotDefault) {
             this.defaultInitCtx = NamingManager.getInitialContext(myProps);
             if (null == this.defaultInitCtx) {
-                throw new NoInitialContextException("Failed to create an initial context."); //$NON-NLS-1$
+                throw new NoInitialContextException("Failed to create an initial context.");  //$NON-NLS-1$
             }
             this.gotDefault = true;
         }
@@ -285,7 +286,7 @@
         if (0 < name.size()) {
             return getURLOrDefaultInitCtx(name.get(0));
         }
-		return getDefaultInitCtx();
+        return getDefaultInitCtx();
     }
 
     /**
@@ -319,7 +320,8 @@
         }
 
         if (null == name) {
-            throw new NullPointerException("null"); //$NON-NLS-1$
+            // jndi.00=name must not be null
+            throw new NullPointerException(Messages.getString("jndi.00"));  //$NON-NLS-1$
         }
 
         // If the name has components
@@ -426,10 +428,11 @@
 
     public Name composeName(Name name, Name prefix) throws NamingException {
         if (null == name) {
-            throw new InvalidNameException("Invalid name."); //$NON-NLS-1$
+            // jndi.02=Invalid name.
+            throw new InvalidNameException(Messages.getString("jndi.02"));  //$NON-NLS-1$
         }
         if (prefix == null) {
-        	prefix = new CompositeName("");
+            prefix = new CompositeName(""); //$NON-NLS-1$
         }
         Name comName = (Name) prefix.clone();
         comName.addAll(name);
@@ -439,10 +442,11 @@
     public String composeName(String name, String prefix)
         throws NamingException {
         if (null == name) {
-            throw new InvalidNameException("Invalid name."); //$NON-NLS-1$
+            // jndi.02=Invalid name.
+            throw new InvalidNameException(Messages.getString("jndi.02"));  //$NON-NLS-1$
         }
         if (prefix == null) {
-        	prefix = "";
+            prefix = ""; //$NON-NLS-1$
         }
         return composeName(new CompositeName(name), new CompositeName(prefix))
             .toString();
@@ -466,7 +470,7 @@
 
     public void close() throws NamingException {
         if (this.gotDefault) {
-        	getDefaultInitCtx().close();
+            getDefaultInitCtx().close();
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/LinkRef.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/LinkRef.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/LinkRef.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/LinkRef.java Mon Oct  2 09:58:57 2006
@@ -18,6 +18,8 @@
 
 package javax.naming;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * This is a type of <code>Reference</code> used to point to an address of type
  * "LinkAddress" where the address given is actually the string representation 
@@ -99,13 +101,15 @@
      */
     public String getLinkName() throws NamingException {
         if (!LinkRef.class.getName().equals(this.getClassName())) {
-            throw new MalformedLinkException("This is an invalid LinkRef object!"); //$NON-NLS-1$
+            // jndi.11=This is an invalid LinkRef object\!
+            throw new MalformedLinkException(Messages.getString("jndi.11"));  //$NON-NLS-1$
         }
         try {
             RefAddr addr = get(ADDR_TYPE);
             if (null == addr) {
+                // jndi.12=There is no address with type: {0}
                 throw new MalformedLinkException(
-                    "There is no address with type: " + ADDR_TYPE); //$NON-NLS-1$
+                        Messages.getString("jndi.12", ADDR_TYPE));  //$NON-NLS-1$
             }
             return (String) addr.getContent();
         } catch (NullPointerException e) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NameClassPair.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NameClassPair.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NameClassPair.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NameClassPair.java Mon Oct  2 09:58:57 2006
@@ -20,6 +20,8 @@
 
 import java.io.Serializable;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * <code>NameClassPair</code> associates a name in a naming service with a 
  * specified class name and also with a relative flag. In JNDI, 
@@ -111,7 +113,8 @@
      */
     public NameClassPair(String name, String className, boolean relative) {
         if (name == null) {
-            throw new IllegalArgumentException("name must not be null");
+            // jndi.00=name must not be null
+            throw new IllegalArgumentException(Messages.getString("jndi.00")); //$NON-NLS-1$
         }
         this.name = name;
         this.className = className;
@@ -168,7 +171,8 @@
      */
     public void setName(String name) {
         if (name == null) {
-            throw new IllegalArgumentException("name must not be null");
+            // jndi.00=name must not be null
+            throw new IllegalArgumentException(Messages.getString("jndi.00")); //$NON-NLS-1$
         }
         this.name = name;
     }
@@ -191,8 +195,8 @@
      */
     public String getNameInNamespace() {
         if (fullName == null) {
-            throw new UnsupportedOperationException(
-                    "full name doesn't apply to this binding");
+            // jndi.01=full name doesn't apply to this binding
+            throw new UnsupportedOperationException(Messages.getString("jndi.01")); //$NON-NLS-1$
         }
         return fullName;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java Mon Oct  2 09:58:57 2006
@@ -21,6 +21,8 @@
 import java.io.PrintStream;
 import java.io.PrintWriter;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A <code>NamingException</code> is the basic exception thrown by the naming
  * classes. There are numerous subclasses of it which are used to further
@@ -138,7 +140,8 @@
                 }
                 remainingName = remainingName.add(s);
             } catch (InvalidNameException e) {
-                throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
+                // jndi.10=Found invalid name, reason: {0}
+                throw new IllegalArgumentException(Messages.getString("jndi.10", e));  //$NON-NLS-1$
             }
         }
     }
@@ -218,7 +221,8 @@
                 }
                 remainingName = remainingName.addAll(n);
             } catch (InvalidNameException e) {
-                throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
+                // jndi.10=Found invalid name, reason: {0}
+                throw new IllegalArgumentException(Messages.getString("jndi.10", e));  //$NON-NLS-1$
             }
         }
     }
@@ -284,7 +288,8 @@
     public void printStackTrace() {
         if (null != rootException) {
             System.err.print(super.toString());
-            System.err.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+            // jndi.err.00=. The stack trace of the root exception is:
+            System.err.print(Messages.getString("jndi.err.00"));  //$NON-NLS-1$
             rootException.printStackTrace();
         } else {
             super.printStackTrace();
@@ -302,7 +307,8 @@
     public void printStackTrace(PrintStream p) {
         if (null != rootException) {
             p.print(super.toString());
-            p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+            // jndi.err.00=. The stack trace of the root exception is:
+            p.print(Messages.getString("jndi.err.00"));  //$NON-NLS-1$
             rootException.printStackTrace(p);
         } else {
             super.printStackTrace(p);
@@ -320,30 +326,31 @@
     public void printStackTrace(PrintWriter p) {
         if (null != rootException) {
             p.print(super.toString());
-            p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+            // jndi.err.00=. The stack trace of the root exception is:
+            p.print(Messages.getString("jndi.err.00"));  //$NON-NLS-1$
             rootException.printStackTrace(p);
         } else {
             super.printStackTrace(p);
         }
     }
-	
+    
     /*
      *  (non-Javadoc)
      * @see java.lang.Throwable#getCause()
      */
-	@Override
+    @Override
     public Throwable getCause() {
-		return super.getCause();
-	}
+        return super.getCause();
+    }
 
     /*
      *  (non-Javadoc)
      * @see java.lang.Throwable#initCause(Throwable)
      */
-	@Override
+    @Override
     public Throwable initCause(Throwable cause) {
-		return super.initCause(cause);
-	}
+        return super.initCause(cause);
+    }
 
     /*
      * -------------------------------------------------------------------

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java Mon Oct  2 09:58:57 2006
@@ -21,6 +21,8 @@
 import java.util.Enumeration;
 import java.util.Vector;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A <code>Reference</code> contains the class of the object which is referenced
  * together with a list of all the addresses at which this object may be found.
@@ -267,7 +269,7 @@
      * 
      * @return              a deep clone of this object
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     @Override
     public Object clone() {
         try {
@@ -275,7 +277,8 @@
             r.addrs = (Vector<RefAddr>) this.addrs.clone();
             return r;
         } catch (CloneNotSupportedException e) {
-            throw new AssertionError("Failed to clone object of Reference class."); //$NON-NLS-1$
+            // jndi.03=Failed to clone object of Reference class.
+            throw new AssertionError(Messages.getString("jndi.03"));  //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttribute.java Mon Oct  2 09:58:57 2006
@@ -30,6 +30,8 @@
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A simple attribute of a directory entry.
  * <p>
@@ -221,14 +223,14 @@
                         // If all elements are equal, they are equal
                         return true;
                     }
-					// Not equal if different length
-					return false;
+                    // Not equal if different length
+                    return false;
                 }
-				// Not equal if this can be inferred from their class names
-				return false;
+                // Not equal if this can be inferred from their class names
+                return false;
             }
-			// If not both of them are array, do a normal "equals"
-			return obj1.equals(obj2);
+            // If not both of them are array, do a normal "equals"
+            return obj1.equals(obj2);
         } else {
             // Not equal if only one of them is null
             return false;
@@ -274,9 +276,10 @@
             values.add(index, val);
         } else {
             if (contains(val)) {
-                throw new IllegalStateException("Value already exists."); //$NON-NLS-1$
+                // jndi.16=Value already exists.
+                throw new IllegalStateException(Messages.getString("jndi.16"));  //$NON-NLS-1$
             }
-			values.add(index, val);
+            values.add(index, val);
         }
     }
 
@@ -284,17 +287,17 @@
         if (ordered) {
             return values.add(val); // always true
         }
-		if (contains(val)) {
-		    return false;
-		}
-		return values.add(val); // always true
+        if (contains(val)) {
+            return false;
+        }
+        return values.add(val); // always true
     }
 
     public void clear() {
         values.clear();
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     @Override
     public Object clone() {
         try {
@@ -302,7 +305,8 @@
             attr.values = (Vector<Object>) this.values.clone();
             return attr;
         } catch (CloneNotSupportedException e) {
-            throw new AssertionError("Failed to clone object of BasicAttribute class."); //$NON-NLS-1$
+            // jndi.17=Failed to clone object of BasicAttribute class.
+            throw new AssertionError(Messages.getString("jndi.17"));  //$NON-NLS-1$
         }
     }
 
@@ -319,9 +323,10 @@
 
     public Object get() throws NamingException {
         if (0 == values.size()) {
-            throw new NoSuchElementException("No values available."); //$NON-NLS-1$
+            // jndi.18=No values available.
+            throw new NoSuchElementException(Messages.getString("jndi.18"));  //$NON-NLS-1$
         }
-		return values.get(0);
+        return values.get(0);
     }
 
     public Object get(int index) throws NamingException {
@@ -333,11 +338,13 @@
     }
 
     public DirContext getAttributeDefinition() throws NamingException {
-        throw new OperationNotSupportedException("BasicAttribute does not support this operation."); //$NON-NLS-1$
+        // jndi.19=BasicAttribute does not support this operation.
+        throw new OperationNotSupportedException(Messages.getString("jndi.19"));  //$NON-NLS-1$
     }
 
     public DirContext getAttributeSyntaxDefinition() throws NamingException {
-        throw new OperationNotSupportedException("BasicAttribute does not support this operation."); //$NON-NLS-1$
+        // jndi.19=BasicAttribute does not support this operation.
+        throw new OperationNotSupportedException(Messages.getString("jndi.19"));  //$NON-NLS-1$
     }
 
     public String getID() {
@@ -366,7 +373,8 @@
 
     public Object set(int index, Object val) {
         if (!ordered && contains(val)) {
-            throw new IllegalStateException("Value already exists."); //$NON-NLS-1$
+            // jndi.16=Value already exists.
+            throw new IllegalStateException(Messages.getString("jndi.16"));  //$NON-NLS-1$
         }
         return values.set(index, val);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/BasicAttributes.java Mon Oct  2 09:58:57 2006
@@ -28,6 +28,8 @@
 import java.util.Enumeration;
 import javax.naming.NamingEnumeration;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * A simple implementation of the <code>Attributes</code> interface.
  * <p>
@@ -167,7 +169,7 @@
 
             return new BasicNamingEnumeration<String>(v.elements());
         }
-		return new BasicNamingEnumeration<String>(this.attrMap.keys());
+        return new BasicNamingEnumeration<String>(this.attrMap.keys());
     }
 
     public boolean isCaseIgnored() {
@@ -237,7 +239,7 @@
      *
      * @return              a deep copy of this attribute collection
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     @Override
     public Object clone() {
         try {
@@ -245,7 +247,8 @@
             c.attrMap = (Hashtable<String,Attribute>) this.attrMap.clone();
             return c;
         } catch (CloneNotSupportedException e) {
-            throw new AssertionError("Failed to clone object of BasicAttributes class."); //$NON-NLS-1$
+            // jndi.15=Failed to clone object of BasicAttributes class.
+            throw new AssertionError(Messages.getString("jndi.15"));  //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InitialDirContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InitialDirContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InitialDirContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InitialDirContext.java Mon Oct  2 09:58:57 2006
@@ -28,6 +28,8 @@
 import javax.naming.NotContextException;
 import javax.naming.directory.SearchResult;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * This is the root context for directory service operations.
  * 
@@ -50,7 +52,7 @@
      * properties.
      * 
      * @throws NamingException
-     * 						If failed to a construct new instance.
+     *                      If failed to a construct new instance.
      */
     public InitialDirContext() throws NamingException {
         super();
@@ -62,33 +64,33 @@
      * to construct a new <code>InitialDirContext</code> instance before all 
      * environment parameters are known. 
      * 
-     * @param flag			If flag is true, the new instance is created but 
-     * 						not initialized. In this case the subclass
-     * 						constructor is expected to call <code>init</code>
+     * @param flag          If flag is true, the new instance is created but 
+     *                      not initialized. In this case the subclass
+     *                      constructor is expected to call <code>init</code>
      *                      after the environment parameters are known. If flag
      *                      is false, a new instance is created and initialized
      *                      with no environment parameters.
      * @throws NamingException
-     * 						If failed to construct new instance.
+     *                      If failed to construct new instance.
      */
     protected InitialDirContext(boolean flag) throws NamingException {
-    	super(flag);
+        super(flag);
     }
 
     /**
      * Constructs a new <code>InitialDirContext</code> instance with 
      * environment properties.
      * 
-     * @param hashtable		Contains the enironment parameters. This constructor 
-     * 						will not change the hashtable or keep a reference to 
-     * 						it. The hashtable parameter may be null.
+     * @param hashtable     Contains the enironment parameters. This constructor 
+     *                      will not change the hashtable or keep a reference to 
+     *                      it. The hashtable parameter may be null.
      * @throws NamingException
-     * 						If failed to construct a new instance.
+     *                      If failed to construct a new instance.
      * @see InitialContext
      */
     public InitialDirContext(Hashtable<?, ?> hashtable)
             throws NamingException {
-    	super(hashtable);
+        super(hashtable);
     }
 
     /*
@@ -110,9 +112,11 @@
         if (ctx instanceof DirContext) {
             return (DirContext) ctx;
         } else if (null == ctx) {
-            throw new NoInitialContextException("Cannot create initial context."); //$NON-NLS-1$
+            // jndi.1A=Cannot create initial context.
+            throw new NoInitialContextException(Messages.getString("jndi.1A"));  //$NON-NLS-1$
         } else {
-            throw new NotContextException("DirContext object is required."); //$NON-NLS-1$
+            // jndi.1B=DirContext object is required.
+            throw new NotContextException(Messages.getString("jndi.1B"));  //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java Mon Oct  2 09:58:57 2006
@@ -19,6 +19,8 @@
 
 import java.io.Serializable;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * This class is a combination of a modification code and attribute.
  * <p>
@@ -73,23 +75,22 @@
     /**
      * Constructs a <code>ModificaitionItem</code> instance with all parameters.
      * 
-     * @param operation		an operation code chosen from <code>DirContext.ADD_ATTRIBUTE</code>,
-     * 						<code>DirContext.REPLACE_ATTRIBUTE</code>, 
+     * @param operation     an operation code chosen from <code>DirContext.ADD_ATTRIBUTE</code>,
+     *                      <code>DirContext.REPLACE_ATTRIBUTE</code>, 
      *                      <code>DirContext.REMOVE_ATTRIBUTE</code>
-     * @param attribute		the <code>Attribute</code> or value that is the 
-     * 						source of the modification
+     * @param attribute     the <code>Attribute</code> or value that is the 
+     *                      source of the modification
      */
     public ModificationItem(int operation, Attribute attribute) {
         if (null == attribute) {
-            throw new IllegalArgumentException("Non-null attribute is required for modification"); //$NON-NLS-1$
+            // jndi.13=Non-null attribute is required for modification
+            throw new IllegalArgumentException(Messages.getString("jndi.13"));  //$NON-NLS-1$
         }
         if (!(DirContext.ADD_ATTRIBUTE == operation
             || DirContext.REPLACE_ATTRIBUTE == operation
             || DirContext.REMOVE_ATTRIBUTE == operation)) {
-            throw new IllegalArgumentException(
-                "Modification code " //$NON-NLS-1$
-                    + operation
-                    + " must be one of DirContext.ADD_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE and DirContext.REMOVE_ATTRIBUTE"); //$NON-NLS-1$
+            // jndi.14=Modification code {0} must be one of DirContext.ADD_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE and DirContext.REMOVE_ATTRIBUTE
+            throw new IllegalArgumentException(Messages.getString("jndi.14", operation));  //$NON-NLS-1$
         }
         this.mod_op = operation;
         this.attr = attribute;
@@ -105,7 +106,7 @@
      * Gets the <code>Attribute</code> or value that is the source of the 
      * modification.
      * 
-     * @return 				the <code>Attribute</code> or value that is the
+     * @return              the <code>Attribute</code> or value that is the
      *                      source of the modification
      */
     public Attribute getAttribute() {
@@ -115,9 +116,9 @@
     /**
      * Gets the operation code.
      * 
-     * @return 				an operation code chosen from <code>
+     * @return              an operation code chosen from <code>
      *                      DirContext.ADD_ATTRIBUTE</code>, <code>
-     * 						DirContext.REPLACE_ATTRIBUTE</code>, <code>
+     *                      DirContext.REPLACE_ATTRIBUTE</code>, <code>
      *                      DirContext.REMOVE_ATTRIBUTE</code>
      */
     public int getModificationOp() {
@@ -134,8 +135,8 @@
      * Returns string representations of this <code>ModificationItem</code> 
      * instance.
      *
-     * @return 				a concatenation of string values for the operation 
-     * 						and the attribute
+     * @return              a concatenation of string values for the operation 
+     *                      and the attribute
      */
     @Override
     public String toString() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java Mon Oct  2 09:58:57 2006
@@ -25,6 +25,7 @@
 import java.security.PrivilegedAction;
 
 import org.apache.harmony.jndi.internal.EnvironmentReader;
+import org.apache.harmony.jndi.internal.nls.Messages;
 
 /**
  * This abstract class is used for factories which create controls as used in 
@@ -40,7 +41,7 @@
      * Constructs a <code>ControlFactory</code> instance with no parameters.
      */
     protected ControlFactory() {
-    	super();
+        super();
     }
 
     /**
@@ -139,8 +140,8 @@
         });
 
         if (cls == null) {
-            throw new ClassNotFoundException(
-                "class " + className + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+            // jndi.1C=class {0} not found
+            throw new ClassNotFoundException(Messages.getString("jndi.1C", className));  //$NON-NLS-1$
         }
 
         return cls;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/InitialLdapContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/InitialLdapContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/InitialLdapContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/InitialLdapContext.java Mon Oct  2 09:58:57 2006
@@ -23,6 +23,8 @@
 import javax.naming.NamingException;
 import javax.naming.NotContextException;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * This is used as the starting context when the LDAPv3 extended functionality
  * provided by the <code>javax.naming.ldap</code> package is required.
@@ -83,7 +85,7 @@
      * @param cs                the connection controls which may be null
      * @throws NamingException  If an error is encountered.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     public InitialLdapContext(Hashtable<?, ?> h, Control[] cs)
         throws NamingException {
         super(true);
@@ -125,7 +127,8 @@
      */
     private LdapContext getDefaultInitLdapContext() throws NamingException {
         if (!(super.defaultInitCtx instanceof LdapContext)) {
-            throw new NotContextException("Expected an LdapContext object."); //$NON-NLS-1$
+            // jndi.1D=Expected an LdapContext object.
+            throw new NotContextException(Messages.getString("jndi.1D"));  //$NON-NLS-1$
         }
         return (LdapContext) super.defaultInitCtx;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java Mon Oct  2 09:58:57 2006
@@ -47,6 +47,7 @@
 
 import org.apache.harmony.jndi.internal.EnvironmentReader;
 import org.apache.harmony.jndi.internal.UrlParser;
+import org.apache.harmony.jndi.internal.nls.Messages;
 
 /**
  * The <code>DirectoryManager</code> class cannot be instantiated. All its
@@ -149,7 +150,7 @@
         if (factory instanceof DirObjectFactory) {
             return ((DirObjectFactory) factory).getObjectInstance(o, n, c, h, a);
         }
-		return factory.getObjectInstance(o, n, c, h);
+        return factory.getObjectInstance(o, n, c, h);
     }
 
     private static Object getObjectInstanceByObjectFactory(Object o, Name n, Context c,
@@ -249,8 +250,9 @@
                 if (e instanceof NamingException) {
                     throw (NamingException) e;
                 }
+                // jndi.21=Failed to create object instance
                 NamingException nex =
-                    new NamingException("Failed to create object instance"); //$NON-NLS-1$
+                    new NamingException(Messages.getString("jndi.21"));  //$NON-NLS-1$
                 nex.setRootCause(e);
                 throw nex;
             }
@@ -268,7 +270,7 @@
             factory =
                 (ObjectFactory) classForName(ref.getFactoryClassName()).newInstance();
         } catch (ClassNotFoundException e) {
-        	// Ignored.
+            // Ignored.
         }
 
         // try load the factory from its class location
@@ -437,7 +439,7 @@
                         true,
                         Thread.currentThread().getContextClassLoader());
                 } catch (ClassNotFoundException e) {
-                	// Could happen.
+                    // Could happen.
                 }
                 // try system class loader second
                 try {
@@ -446,7 +448,7 @@
                         true,
                         ClassLoader.getSystemClassLoader());
                 } catch (ClassNotFoundException e1) {
-                	// Not found here either.
+                    // Not found here either.
                 }
                 // return null, if fail to load class
                 return null;
@@ -454,7 +456,8 @@
         });
 
         if (cls == null) {
-            throw new ClassNotFoundException("class " + className + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+            // jndi.1C=class {0} not found
+            throw new ClassNotFoundException(Messages.getString("jndi.1C", className));  //$NON-NLS-1$
         }
 
         return cls;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java Mon Oct  2 09:58:57 2006
@@ -29,6 +29,7 @@
 import javax.naming.Context;
 import org.apache.harmony.jndi.internal.EnvironmentReader;
 import org.apache.harmony.jndi.internal.UrlParser;
+import org.apache.harmony.jndi.internal.nls.Messages;
 
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -133,8 +134,8 @@
             SecurityException, NamingException {
 
         if (null != NamingManager.icfb) {
-            throw new IllegalStateException(
-                    "InitialContextFactoryBuilder cannot be reset"); //$NON-NLS-1$
+            // jndi.1E=InitialContextFactoryBuilder cannot be reset
+            throw new IllegalStateException(Messages.getString("jndi.1E"));  //$NON-NLS-1$
         }
 
         // check security access
@@ -179,8 +180,8 @@
             SecurityException, NamingException {
 
         if (null != NamingManager.ofb) {
-            throw new IllegalStateException(
-                    "ObjectFactoryBuilder cannot be reset"); //$NON-NLS-1$
+            // jndi.1F=ObjectFactoryBuilder cannot be reset
+            throw new IllegalStateException(Messages.getString("jndi.1F"));  //$NON-NLS-1$
         }
 
         // check security access
@@ -235,9 +236,9 @@
             throw e;
         } catch (Exception e) {
             // failed, throw NoInitialContextException
+            // jndi.20=Failed to create InitialContext using factory specified in hashtable {0}
             NamingException nex = new NoInitialContextException(
-                    "Failed to create InitialContext using factory specified in hashtable " //$NON-NLS-1$
-                            + h);
+                    Messages.getString("jndi.20", h));  //$NON-NLS-1$
             nex.setRootCause(e);
             throw nex;
         }
@@ -449,8 +450,8 @@
                 if (e instanceof NamingException) {
                     throw (NamingException) e;
                 }
-                NamingException nex = new NamingException(
-                        "Failed to create object instance"); //$NON-NLS-1$
+                // jndi.21=Failed to create object instance
+                NamingException nex = new NamingException(Messages.getString("jndi.21"));  //$NON-NLS-1$
                 nex.setRootCause(e);
                 throw nex;
             }
@@ -666,8 +667,9 @@
                 throw e;
             } catch (Exception e) {
                 // other exception, throw as NamingException
+                // jndi.22=other exception happens: {0}
                 NamingException nex = new NamingException(
-                        "other exception happens: " + e.toString()); //$NON-NLS-1$
+                        Messages.getString("jndi.22", e.toString()));  //$NON-NLS-1$
                 nex.setRootCause(e);
                 throw nex;
             }
@@ -714,7 +716,7 @@
      *             if the resolved object is null or if a context cannot be
      *             obtained from it either directly or indirectly.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     public static Context getContinuationContext(CannotProceedException cpe)
             throws NamingException {
 
@@ -785,8 +787,9 @@
                 });
 
         if (cls == null) {
+            // jndi.1C=class {0} not found
             throw new ClassNotFoundException(
-                    "class " + className + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+                    Messages.getString("jndi.1C", className));  //$NON-NLS-1$
         }
 
         return cls;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java Mon Oct  2 09:58:57 2006
@@ -40,6 +40,8 @@
 import javax.naming.NamingException;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 /**
  * This is a utility class that reads environment properties.
  * 
@@ -53,7 +55,7 @@
 
     // Not allowed to create an instance
     private EnvironmentReader() {
-    	super();
+        super();
     }
 
     /*
@@ -217,8 +219,9 @@
             e = cl.getResources(name);
         } catch (IOException ex) {
             // Unexpected ClassLoader exception
+            // jndi.23=Failed to load JNDI resource files.
             ConfigurationException newEx =
-                new ConfigurationException("Failed to load JNDI resource files."); //$NON-NLS-1$
+                new ConfigurationException(Messages.getString("jndi.23"));  //$NON-NLS-1$
             newEx.setRootCause(ex);
             throw newEx;
         }
@@ -237,8 +240,9 @@
                 }
             } catch (IOException ex) {
                 // Can't read this resource file
+                // jndi.24=Failed to read JNDI resource files.
                 ConfigurationException newEx =
-                    new ConfigurationException("Failed to read JNDI resource files."); //$NON-NLS-1$
+                    new ConfigurationException(Messages.getString("jndi.24"));  //$NON-NLS-1$
                 newEx.setRootCause(ex);
                 throw newEx;
             } finally {
@@ -331,8 +335,9 @@
                 mergeEnvironment(p, existingProps, true);
             } catch (PrivilegedActionException e) {
                 // Can't read "java.home"/lib/jndi.properties
+                // jndi.25=Failed to read JNDI resource files in java home library.
                 ConfigurationException newEx =
-                    new ConfigurationException("Failed to read JNDI resource files in java home library."); //$NON-NLS-1$
+                    new ConfigurationException(Messages.getString("jndi.25"));  //$NON-NLS-1$
                 newEx.setRootCause(e.getException());
                 throw newEx;
             } finally {
@@ -464,7 +469,7 @@
     private static class SystemPropertiesSource implements JNDIPropertiesSource {
 
         public SystemPropertiesSource() {
-        	super();
+            super();
         }
 
         public String getProperty(final String propName) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties Mon Oct  2 09:58:57 2006
@@ -15,3 +15,144 @@
 # 
 
 # messages for EN locale
+jndi.00=name must not be null
+jndi.01=full name doesn't apply to this binding
+jndi.02=Invalid name.
+jndi.03=Failed to clone object of Reference class.
+jndi.04=Illegal direction property value, which must be one of right_to_left, left_to_right or flat
+jndi.05=jndi.syntax.separator property must be set when jndi.syntax.direction is not flat
+jndi.06=The {0} cannot be at end of the component
+jndi.07={0}: close quote must appears at end of component in quoted string
+jndi.08={0}: close quote is required for quoted string
+jndi.09={0} is not a compound name.
+jndi.0A=A flat name can only have a single component
+jndi.0B=A flat name can only zero or one component
+jndi.0C=End quote is not at the end of element
+jndi.0D=Escape cannot be at the end of element
+jndi.0E=Wrong quote usage.
+jndi.0F=Must be a CompositeName
+jndi.10=Found invalid name, reason: {0}
+jndi.11=This is an invalid LinkRef object\!
+jndi.12=There is no address with type: {0}
+jndi.13=Non-null attribute is required for modification
+jndi.14=Modification code {0} must be one of DirContext.ADD_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE and DirContext.REMOVE_ATTRIBUTE
+jndi.15=Failed to clone object of BasicAttributes class.
+jndi.16=Value already exists.
+jndi.17=Failed to clone object of BasicAttribute class.
+jndi.18=No values available.
+jndi.19=BasicAttribute does not support this operation.
+jndi.1A=Cannot create initial context.
+jndi.1B=DirContext object is required.
+jndi.1C=class {0} not found
+jndi.1D=Expected an LdapContext object.
+jndi.1E=InitialContextFactoryBuilder cannot be reset
+jndi.1F=ObjectFactoryBuilder cannot be reset
+jndi.20=Failed to create InitialContext using factory specified in hashtable {0}
+jndi.21=Failed to create object instance
+jndi.22=other exception happens: {0}
+jndi.23=Failed to load JNDI resource files.
+jndi.24=Failed to read JNDI resource files.
+jndi.25=Failed to read JNDI resource files in java home library.
+jndi.26=URL context can't accept non-composite name: {0}
+jndi.27=Renaming of names of which one has only one component, and another has more than one component is not supported: {0} -> {1}
+jndi.28=Renaming of names using different URLs as their first components is not supported: {0} -> {1}
+jndi.29=Renaming of names using different URL prefixes is not supported: {0} -> {1}
+jndi.2A=Invalid URL: {0}
+jndi.2B=Invalid URL format: {0}
+jndi.2C=obj is an empty string array
+jndi.2D=obj is neither null, nor a string, nor a string array: {0}
+jndi.2E=The name is null
+jndi.2F=Given name is not an instance of DNSName class
+jndi.30={0} can't be used as a component for DNS name
+jndi.31=Given name is not an instance of DNSName class
+jndi.32=buffer is null
+jndi.33=Given resultQR is null
+jndi.34=hostname is null
+jndi.35=Invalid number of fields while parsing SOA record
+jndi.36=Error while parsing SOA record
+jndi.37=Invalid number of fields while parsing MX record
+jndi.38=Error while parsing MX record
+jndi.39=Invalid number of fields while parsing HINFO record
+jndi.3A=The length of character string exceed 255 octets
+jndi.3B=Length of TXT field exceed 65535
+jndi.3C=Invalid number of fields while parsing SRV record
+jndi.3D=Error while parsing SRV record
+jndi.3E=RDATA for unknown record type {0} should have value of byte[] type
+jndi.3F=Given resultRR is null
+jndi.40=Unable to connect: bad IP address
+jndi.41=Error while querying DNS server
+jndi.42=unknown error
+jndi.43=Output buffer is too small
+jndi.44=Error while receiving message over TCP
+jndi.45=environment is null
+jndi.46=DNS class {0} is not supported
+jndi.47=DNS type {0} is not supported
+jndi.48=conflicting domains: {0} and {1}
+jndi.49=Unable to parse DNS URL {0}. {1}
+jndi.4A=found object is not a DirContext
+jndi.4B=Only instances of CompositeName class or DNSName class are acceptable
+jndi.4C=Unknown record class: {0}
+jndi.4D=Unknown record type: {0}
+jndi.4E=found object is not a Context
+jndi.4F=found object is not a Context or target contexts are not equal
+jndi.50=contentSwt should be equal to 1 or 2
+jndi.51=Given name of prefix is null
+jndi.52=Can't append an absolute DNS name
+jndi.53=Root domain should be the rightmost one
+jndi.54=The length of the name is more than 255 characters
+jndi.55=Null label is not the rightmost one
+jndi.56=DNS name shouldn't start with a dot
+jndi.57=The length of {0} label is more than 63 characters
+jndi.58=The value of parameter mesObj is null
+jndi.59=Domain label is too long.
+jndi.5A=The domain name is more than {0} octets long: {1}
+jndi.5B=Input byte array is null
+jndi.5C=The result string buffer is null
+jndi.5D=Truncated data while parsing the domain name
+jndi.5E=value or buffer is null
+jndi.5F=Character string is too long
+jndi.60=mesBytes or result is null
+jndi.61=Given array is null or has the length less than four
+jndi.62=Given string is not in appropriate format
+jndi.63=Given string representation is null
+jndi.64=The domain label is too long: {0}
+jndi.65=obj should be either null, String or array of String
+jndi.66=Extra characters encountered at the end of the URL
+jndi.67=strForm is null
+jndi.68=Empty URL
+jndi.69=Specified scheme is not dns
+jndi.6A=Bad URL syntax
+jndi.6B=types is null
+jndi.6C=classes is null
+jndi.6D=Name {0} was not found
+jndi.6E=Unable to perform zone transfer
+jndi.6F=Both name and IP are null
+jndi.70=zoneName is null
+jndi.71=no question record
+jndi.72=Request and Answer have different ids
+jndi.73=no question record
+jndi.74=Not an RMI URL, incorrect prefix: {0}
+jndi.75=Invalid port number in URL: {0}
+jndi.76=Object instantiated using the URL specified in environment is not a context: {0}
+jndi.77=Reference is empty
+jndi.78=Reference contains no valid addresses
+jndi.79=RMI Client Socket Factory cannot be instantiated
+jndi.7A=Name is not bound: {0}
+jndi.7B=Cannot bind empty name
+jndi.7C=Name is already bound: {0}
+jndi.7D=Cannot rebind empty name
+jndi.7E=Cannot unbind empty name
+jndi.7F=RMI Registry is a flat context and doesn't support subcontexts
+jndi.80=Name specifies an object that is not a context: {0}
+jndi.81=Cannot create reference for RMI registry that is being accessed using localhost
+jndi.82=Cannot bind to RMI Registry object that is neither Remote nor Reference nor Referenceable
+jndi.83=NamingManager.getObjectInstance() failed
+jndi.84=Cannot install RMISecurityManager
+jndi.85=Error unmarshalling return value
+jndi.86=Undeclared checked exception
+jndi.87=Invalid method hash: {0}
+jndi.88=Interface hash mismatch, expected: {0}, received: {1}
+jndi.89=Error marshalling return
+jndi.8A=Invalid method number: {0}
+
+jndi.err.00=. The stack trace of the root exception is: 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContext.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContext.java Mon Oct  2 09:58:57 2006
@@ -38,6 +38,8 @@
 import javax.naming.spi.NamingManager;
 import javax.naming.spi.ResolveResult;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 
 /**
  * Base class for URL naming context implementations.
@@ -70,7 +72,7 @@
      * @param   environment
      *          Environment to copy.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") //$NON-NLS-1$
     protected GenericURLContext(Hashtable<?, ?> environment) {
         super();
         if (environment == null) {
@@ -85,8 +87,9 @@
      */
     public Object lookup(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -119,8 +122,9 @@
      */
     public Object lookupLink(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -153,8 +157,9 @@
      */
     public void bind(Name name, Object obj) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -189,8 +194,9 @@
      */
     public void rebind(Name name, Object obj) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -225,8 +231,9 @@
      */
     public void unbind(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -261,8 +268,9 @@
      */
     public Context createSubcontext(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -295,8 +303,9 @@
      */
     public void destroySubcontext(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -334,29 +343,31 @@
      */
     public void rename(Name oldName, Name newName) throws NamingException {
         if (!(oldName instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + oldName);
+                    Messages.getString("jndi.26", oldName)); //$NON-NLS-1$
         }
 
         if (!(newName instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + newName);
+                    Messages.getString("jndi.26", newName)); //$NON-NLS-1$
         }
 
         if ((oldName.size() == 1) ^ (newName.size() != 1)) {
-            throw new OperationNotSupportedException("Renaming of names "
-                    + "of which one has only one component, and another "
-                    + "has more than one component is not supported: "
-                    + oldName + " -> " + newName);
+            // jndi.27=Renaming of names of which one has only one component, + 
+            //         and another has more than one component is not supported: {0} -> {1}
+            throw new OperationNotSupportedException(
+                    Messages.getString("jndi.27", oldName, newName)); //$NON-NLS-1$
         }
 
         if (oldName.size() == 1) {
              rename(oldName.get(0), newName.get(0));
         } else {
             if (!urlEquals(oldName.get(0), oldName.get(0))) {
-                throw new OperationNotSupportedException("Renaming of names "
-                        + "using different URLs as their first components "
-                        + "is not supported: " + oldName + " -> " + newName);
+                // jndi.28=Renaming of names using different URLs as their first components is not supported: {0} -> {1}
+                throw new OperationNotSupportedException(
+                        Messages.getString("jndi.28", oldName, newName)); //$NON-NLS-1$
             }
             Context context = getContinuationContext(oldName);
 
@@ -381,9 +392,9 @@
         String newPrefix = getURLPrefix(newName);
 
         if(!urlEquals(oldPrefix, newPrefix)) {
-            throw new OperationNotSupportedException("Renaming of names "
-                    + "using different URL prefixes is not supported: "
-                    + oldName + " -> " + newName);
+            // jndi.29=Renaming of names using different URL prefixes is not supported: {0} -> {1}
+            throw new OperationNotSupportedException(
+                    Messages.getString("jndi.29", oldName, newName)); //$NON-NLS-1$
         }
         ResolveResult result = getRootURLContext(oldName, environment);
         Context context = (Context) result.getResolvedObj();
@@ -401,8 +412,9 @@
      */
     public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -436,8 +448,9 @@
      */
     public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -471,8 +484,9 @@
      */
     public NameParser getNameParser(Name name) throws NamingException {
         if (!(name instanceof CompositeName)) {
+            // jndi.26=URL context can't accept non-composite name: {0}
             throw new InvalidNameException(
-                    "URL context can't accept non-composite name: " + name);
+                    Messages.getString("jndi.26", name)); //$NON-NLS-1$
         }
 
         if (name.size() == 1) {
@@ -520,7 +534,7 @@
      * {@inheritDoc}
      */
     public String getNameInNamespace() {
-        return "";
+        return ""; //$NON-NLS-1$
     }
 
     /**
@@ -673,11 +687,12 @@
     protected String getURLPrefix(String url) throws NamingException {
         int index = url.indexOf(':');
         if (index < 0) {
-            throw new OperationNotSupportedException("Invalid URL: " + url);
+            // jndi.2A=Invalid URL: {0}
+            throw new OperationNotSupportedException(Messages.getString("jndi.2A", url)); //$NON-NLS-1$
         }
         index++;
 
-        if (url.startsWith("//", index)) {
+        if (url.startsWith("//", index)) { //$NON-NLS-1$
             int slashPos = url.indexOf('/', index + 2);
             index = ((slashPos >= 0) ? slashPos : url.length());
         }
@@ -761,7 +776,8 @@
                 int next = i + 2;
 
                 if (next > length) {
-                    new IllegalArgumentException("Invalid URL format: " + str);
+                    //jndi.2B=Invalid URL format: {0}
+                    new IllegalArgumentException(Messages.getString("jndi.2B", str)); //$NON-NLS-1$
                 }
 
                 try {
@@ -769,8 +785,9 @@
                             Integer.parseInt(str.substring(i, next), 16);
                 } catch (NumberFormatException e) {
                     throw (IllegalArgumentException)
+                            //  jndi.2B=Invalid URL format: {0}
                             new IllegalArgumentException(
-                                    "Invalid URL format: " + str).initCause(e);
+                                    Messages.getString("jndi.2B", str)).initCause(e); //$NON-NLS-1$
                 }
 
                 i = next;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContextFactory.java?view=diff&rev=452119&r1=452118&r2=452119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContextFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLContextFactory.java Mon Oct  2 09:58:57 2006
@@ -31,6 +31,8 @@
 
 import javax.naming.spi.ObjectFactory;
 
+import org.apache.harmony.jndi.internal.nls.Messages;
+
 
 /**
  * Base class for URL naming context factory implementations.
@@ -115,8 +117,8 @@
                 String[] strings = (String[]) obj;
 
                 if (strings.length < 1) {
-                    throw new ConfigurationException(
-                            "obj is an empty string array");
+                    // jndi.2C=obj is an empty string array
+                    throw new ConfigurationException(Messages.getString("jndi.2C")); //$NON-NLS-1$
                 }
 
                 NamingException exception = null;
@@ -137,8 +139,8 @@
             }
 
             // Unknown object type.
-            throw new IllegalArgumentException("obj is neither null, "
-                    + "nor a string, nor a string array: " + obj);
+            // jndi.2D=obj is neither null, nor a string, nor a string array: {0}
+            throw new IllegalArgumentException(Messages.getString("jndi.2D", obj)); //$NON-NLS-1$
         } finally {
             context.close();
         }



Mime
View raw message