Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 61855 invoked from network); 2 Oct 2006 16:59:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Oct 2006 16:59:10 -0000 Received: (qmail 51236 invoked by uid 500); 2 Oct 2006 16:59:09 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 51210 invoked by uid 500); 2 Oct 2006 16:59:09 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 51199 invoked by uid 99); 2 Oct 2006 16:59:09 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Oct 2006 09:59:09 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received: from [140.211.166.113] ([140.211.166.113:59641] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id F9/81-24395-75541254 for ; Mon, 02 Oct 2006 09:59:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 363A41A981D; Mon, 2 Oct 2006 09:59:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r452119 [2/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 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061002165901.363A41A981D@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java?view=diff&rev=452119&r1=452118&r2=452119 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java Mon Oct 2 09:58:57 2006 @@ -40,6 +40,8 @@ import javax.naming.spi.DirectoryManager; import javax.naming.spi.ResolveResult; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * Base class for URL directory context implementations. @@ -78,8 +80,9 @@ public void bind(Name name, Object obj, Attributes attrs) 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) { @@ -116,8 +119,9 @@ public void rebind(Name name, Object obj, Attributes attrs) 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) { @@ -154,8 +158,9 @@ public DirContext createSubcontext(Name name, Attributes attrs) 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 Attributes getAttributes(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) { @@ -224,8 +230,9 @@ public Attributes getAttributes(Name name, String[] attrIds) 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) { @@ -260,8 +267,9 @@ public void modifyAttributes(Name name, int mod_op, Attributes attrs) 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) { @@ -298,8 +306,9 @@ public void modifyAttributes(Name name, ModificationItem[] mods) 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) { @@ -335,8 +344,9 @@ */ public DirContext getSchema(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) { @@ -370,8 +380,9 @@ public DirContext getSchemaClassDefinition(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) { @@ -406,8 +417,9 @@ public NamingEnumeration search(Name name, Attributes matchingAttributes) 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) { @@ -444,8 +456,9 @@ public NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) 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) { @@ -483,8 +496,9 @@ public NamingEnumeration search(Name name, String filter, SearchControls cons) 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) { @@ -519,8 +533,9 @@ public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) 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) { Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.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/DNSContext.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java Mon Oct 2 09:58:57 2006 @@ -56,6 +56,8 @@ import javax.naming.spi.DirectoryManager; import javax.naming.spi.NamingManager; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * This class represents DNS context. This is the main class and the main entry * point to DNS service provider for JNDI. @@ -70,15 +72,15 @@ // some environment property names public static final String LOOKUP_ATTR = - "org.apache.harmony.jndi.provider.dns.lookup.attr"; + "org.apache.harmony.jndi.provider.dns.lookup.attr"; //$NON-NLS-1$ public static final String RECURSION = - "org.apache.harmony.jndi.provider.dns.recursion"; + "org.apache.harmony.jndi.provider.dns.recursion"; //$NON-NLS-1$ public static final String TIMEOUT_INITIAL = - "org.apache.harmony.jndi.provider.dns.timeout.initial"; + "org.apache.harmony.jndi.provider.dns.timeout.initial"; //$NON-NLS-1$ public static final String TIMEOUT_RETRIES = - "org.apache.harmony.jndi.provider.dns.timeout.retries"; + "org.apache.harmony.jndi.provider.dns.timeout.retries"; //$NON-NLS-1$ public static final String THREADS_MAX = - "org.apache.harmony.jndi.provider.dns.threads.max"; + "org.apache.harmony.jndi.provider.dns.threads.max"; //$NON-NLS-1$ // used in internal methods private static final int NAME_CLASS_SWT = 1; @@ -113,12 +115,13 @@ * @throws NullPointerException if the environment is null * */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") //$NON-NLS-1$ DNSContext(Hashtable env) throws NamingException { nameParser = new DNSNameParser(); if (env == null) { - throw new NullPointerException("environment is null"); + // jndi.45=environment is null + throw new NullPointerException(Messages.getString("jndi.45")); //$NON-NLS-1$ } this.environment = (Hashtable) env.clone(); parseBoolProp(Context.AUTHORITATIVE); @@ -177,7 +180,7 @@ boolean val = false; if (tmp != null) { - if (tmp instanceof String && tmp.equals("true")) { + if (tmp instanceof String && tmp.equals("true")) { //$NON-NLS-1$ val = true; } if (paramName.equals(Context.AUTHORITATIVE)) { @@ -205,15 +208,15 @@ tmp = environment.get(LOOKUP_ATTR); if (tmp instanceof String) { lookupAttr = (String) tmp; - k = lookupAttr.indexOf(" "); + k = lookupAttr.indexOf(" "); //$NON-NLS-1$ if (k > -1) { recClassName = lookupAttr.substring(0, k); lookupAttrClass = ProviderMgr.getRecordClassNumber( recClassName); if (lookupAttrClass == -1) { - throw new ConfigurationException("DNS class " + - recClassName + " is not supported"); + // jndi.46=DNS class {0} is not supported + throw new ConfigurationException(Messages.getString("jndi.46", recClassName));//$NON-NLS-1$ } recTypeName = lookupAttr.substring(k).trim(); } @@ -224,8 +227,9 @@ } lookupAttrType = ProviderMgr.getRecordTypeNumber(recTypeName); if (lookupAttrType == -1) { - throw new ConfigurationException("DNS type " + - recTypeName + " is not supported"); + // jndi.47=DNS type {0} is not supported + throw new ConfigurationException( + Messages.getString("jndi.47", recTypeName)); //$NON-NLS-1$ } } } @@ -242,7 +246,7 @@ if (environment.containsKey(Context.PROVIDER_URL)) { tmp = environment.get(Context.PROVIDER_URL); if (tmp instanceof String) { - StringTokenizer st = new StringTokenizer((String) tmp, " "); + StringTokenizer st = new StringTokenizer((String) tmp, " "); //$NON-NLS-1$ while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -267,16 +271,15 @@ nameParser.parse(dnsURL.getDomain()); if (name2.compareTo(contextName) != 0) { + // jndi.48=conflicting domains: {0} and {1} throw new ConfigurationException( - "conflicting domains: " + - contextName + " and " + - name2); + Messages.getString("jndi.48", contextName, name2)); //$NON-NLS-1$ } } } catch (IllegalArgumentException e) { + // jndi.49=Unable to parse DNS URL {0}. {1} throw new ConfigurationException( - "Unable to parse DNS URL " + - token + ". " + e.getMessage()); + Messages.getString("jndi.49", token, e.getMessage())); //$NON-NLS-1$ } } } @@ -293,7 +296,7 @@ * @param ancestorCtx an ancestor context to read all internal properties from * @param name name of newly created context in the ancestor context */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") //$NON-NLS-1$ DNSContext(DNSContext ancestorCtx, DNSName name) { this.contextName = (DNSName) name.clone(); this.nameParser = ancestorCtx.nameParser; @@ -334,9 +337,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - ((DirContext) obj).modifyAttributes("", arg1, arg2); + ((DirContext) obj).modifyAttributes("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -366,9 +370,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - ((DirContext) obj).modifyAttributes("", arg1, arg2); + ((DirContext) obj).modifyAttributes("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -382,9 +387,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).getSchema(""); + return ((DirContext) obj).getSchema(""); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -400,9 +406,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).getSchemaClassDefinition(""); + return ((DirContext) obj).getSchemaClassDefinition(""); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -416,9 +423,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).getSchema(""); + return ((DirContext) obj).getSchema(""); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -434,9 +442,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).getSchemaClassDefinition(""); + return ((DirContext) obj).getSchemaClassDefinition(""); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -452,9 +461,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - ((DirContext) obj).modifyAttributes("", arg1); + ((DirContext) obj).modifyAttributes("", arg1); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -469,9 +479,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - ((DirContext) obj).modifyAttributes("", arg1); + ((DirContext) obj).modifyAttributes("", arg1); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -487,9 +498,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1); + return ((DirContext) obj).search("", arg1); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -505,9 +517,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1); + return ((DirContext) obj).search("", arg1); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -548,7 +561,8 @@ if (pair.context instanceof DirContext) { ((DirContext) pair.context).bind(pair.name, arg1, arg2); } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -569,7 +583,8 @@ if (pair.context instanceof DirContext) { ((DirContext) pair.context).rebind(pair.name, arg1, arg2); } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -632,7 +647,8 @@ // analyze given name object if (name == null) { - throw new NullPointerException("The name is null"); + // jndi.2E=The name is null + throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$ } else if (name.size() == 0) { // attributes of the current context are requested @@ -661,8 +677,8 @@ //} } else { - throw new InvalidNameException("Only instances of CompositeName " + - "class or DNSName class are acceptable"); + // jndi.4B=Only instances of CompositeName class or DNSName class are acceptable + throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$ } // we should have correct nameToLookFor at this point @@ -700,8 +716,9 @@ classInt = ProviderMgr.getRecordClassNumber(classStr); if (classInt == -1) { + // jndi.4C=Unknown record class: {0} throw new InvalidAttributeIdentifierException( - "Unknown record class: " + classStr); + Messages.getString("jndi.4C", classStr)); //$NON-NLS-1$ } classesSet.add(new Integer(classInt)); typeStr = element.substring(k, element.length()) @@ -714,8 +731,9 @@ } typesInt = ProviderMgr.getRecordTypeNumber(typeStr); if (typesInt == -1) { + // jndi.4D=Unknown record type: {0} throw new InvalidAttributeIdentifierException( - "Unknown record type: " + typeStr); + Messages.getString("jndi.4D", typeStr)); //$NON-NLS-1$ } typesSet.add(new Integer(typesInt)); } @@ -790,7 +808,8 @@ if (pair.context instanceof DirContext) { return ((DirContext) pair.context).createSubcontext(pair.name, arg1); } - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } /** @@ -805,9 +824,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2); + return ((DirContext) obj).search("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -823,9 +843,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2); + return ((DirContext) obj).search("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -841,9 +862,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2); + return ((DirContext) obj).search("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -859,9 +881,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2); + return ((DirContext) obj).search("", arg1, arg2); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -877,9 +900,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2, arg3); + return ((DirContext) obj).search("", arg1, arg2, arg3); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -895,9 +919,10 @@ if (obj instanceof DNSContext) { throw new OperationNotSupportedException(); } else if (obj instanceof DirContext) { - return ((DirContext) obj).search("", arg1, arg2, arg3); + return ((DirContext) obj).search("", arg1, arg2, arg3); //$NON-NLS-1$ } else { - throw new NotContextException("found object is not a DirContext"); + // jndi.4A=found object is not a DirContext + throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$ } } @@ -957,7 +982,8 @@ if (pair.context instanceof Context) { ((Context) pair.context).destroySubcontext(pair.name); } else { - throw new NotContextException("found object is not a Context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } } @@ -976,7 +1002,8 @@ if (pair.context instanceof Context) { ((Context) pair.context).unbind(pair.name); } else { - throw new NotContextException("found object is not a Context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } } @@ -1021,7 +1048,8 @@ Name nameObj = null; if (nameStr == null) { - throw new NullPointerException("The name is null"); + // jndi.2E=The name is null + throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$ } nameObj = new CompositeName(nameStr); if (nameObj.size() == 1) { @@ -1101,7 +1129,8 @@ // analyze given name object if (name == null) { - throw new NullPointerException("The name is null"); + // jndi.2E=The name is null + throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$ } else if (name.size() == 0) { // attributes of the current context are requested @@ -1130,8 +1159,8 @@ //} } else { - throw new InvalidNameException("Only instances of CompositeName " + - "class or DNSName class are acceptable"); + // jndi.4B=Only instances of CompositeName class or DNSName class are acceptable + throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$ } // we should have correct nameToLookFor at this point types[0] = lookupAttrType; @@ -1188,7 +1217,7 @@ DNSName nameToLookFor = (DNSName) composeName(name, contextName); final DNSContext resolvedCtx = new DNSContext(this, nameToLookFor); // namespace border violation, need to ask NNS - RefAddr refAddr = new RefAddr("nns") { + RefAddr refAddr = new RefAddr("nns") { //$NON-NLS-1$ private static final long serialVersionUID = 8654740210501193418L; DNSContext context = (DNSContext) resolvedCtx.clone(); @@ -1211,7 +1240,7 @@ // (the sign of the next naming system) if (resolvedName != null && resolvedName.get(resolvedName.size() - 1) - .equals("")) + .equals("")) //$NON-NLS-1$ { resolvedName.remove(resolvedName.size() - 1); } @@ -1228,7 +1257,7 @@ } resolvedName.add(nameToLookFor.toString()); // the sign of the next naming system - resolvedName.add(""); + resolvedName.add(""); //$NON-NLS-1$ cpe.setResolvedName(resolvedName); cpe.setResolvedObj(ref); return cpe; @@ -1254,7 +1283,7 @@ else { clssTypeStr = ProviderConstants.rrClassNames[curRec.getRRClass()] + - " " + + " " + //$NON-NLS-1$ ProviderConstants.rrTypeNames[curRec.getRRType()]; } oldAttr = attrs.get(clssTypeStr); @@ -1299,7 +1328,8 @@ if (pair.context instanceof Context) { ((Context) pair.context).bind(pair.name, arg1); } else { - throw new NotContextException("found object is not a Context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } } @@ -1318,7 +1348,8 @@ if (pair.context instanceof Context) { ((Context) pair.context).rebind(pair.name, arg1); } else { - throw new NotContextException("found object is not a Context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } } @@ -1354,7 +1385,8 @@ if (pair.context instanceof Context) { return ((Context) pair.context).createSubcontext(pair.name); } - throw new NotContextException("found object is not a Context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } /** @@ -1379,8 +1411,8 @@ { ((Context) pair1.context).rename(pair1.name, pair2.name); } else { - throw new NotContextException("found object is not a Context or " + - "target contexts are not equal"); + // jndi.4F=found object is not a Context or target contexts are not equal + throw new NotContextException(Messages.getString("jndi.4F")); //$NON-NLS-1$ } } @@ -1397,16 +1429,18 @@ Object obj; 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$ } obj = lookup(name); if (obj instanceof DNSContext) { return nameParser; } else if (obj instanceof Context) { - return ((Context) obj).getNameParser(""); + return ((Context) obj).getNameParser(""); //$NON-NLS-1$ } - throw new NotContextException("Found object is not a context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } /** @@ -1425,16 +1459,18 @@ Object obj; 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$ } obj = lookup(name); if (obj instanceof DNSContext) { return nameParser; } else if (obj instanceof Context) { - return ((Context) obj).getNameParser(""); + return ((Context) obj).getNameParser(""); //$NON-NLS-1$ } - throw new NotContextException("Found object is not a context"); + // jndi.4E=found object is not a Context + throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$ } /** @@ -1497,7 +1533,7 @@ * resolver's cache since we are sure the cache is up to date and contains * absolutely all records from target zone */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") //$NON-NLS-1$ private NamingEnumeration list_common(Name name, int contentSwt) throws NamingException { @@ -1507,11 +1543,12 @@ NamingEnumeration result = null; if (contentSwt != 1 && contentSwt != 2) { - throw new IllegalArgumentException( - "contentSwt should be equal to 1 or 2"); + // jndi.50=contentSwt should be equal to 1 or 2 + throw new IllegalArgumentException(Messages.getString("jndi.50")); //$NON-NLS-1$ } 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$ } // analyze given name object else if (name.size() == 0) { @@ -1541,8 +1578,7 @@ //} } else { - throw new InvalidNameException("Only instances of CompositeName " + - "class or DNSName class are acceptable"); + throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$ } // we should have correct nameToLookFor at this point if (remainingName != null) { @@ -1697,7 +1733,8 @@ Name name2 = null; if (name == null || prefix == null) { - throw new NullPointerException("Given name of prefix is null"); + // jndi.51=Given name of prefix is null + throw new NullPointerException(Messages.getString("jndi.51")); //$NON-NLS-1$ } if (name.length() == 0) { return prefix; @@ -1748,7 +1785,8 @@ Name result = null; if (name == null || prefix == null) { - throw new NullPointerException("The name or prefix given is null"); + // jndi.51=Given name of prefix is null + throw new NullPointerException(Messages.getString("jndi.51")); //$NON-NLS-1$ } if (name.size() == 0) { return prefix; @@ -1821,18 +1859,18 @@ boolean prefixIsRoot = (prefix.compareTo(rootZone) == 0); boolean nameIsRoot = (name.compareTo(rootZone) == 0); boolean nameStartsFromRoot = - name.get(0).equals(""); + name.get(0).equals(""); //$NON-NLS-1$ if (nameStartsFromRoot) { - throw new NamingException("Can't append an absolute " + - "DNS name"); + // jndi.52=Can't append an absolute DNS name + throw new NamingException(Messages.getString("jndi.52")); //$NON-NLS-1$ } if (prefixIsRoot && nameIsRoot) { result = (DNSName) rootZone.clone(); } else if (!prefixIsRoot && nameIsRoot) { - throw new NamingException("Root domain should " + - "be the rightmost one"); + // jndi.53=Root domain should be the rightmost one + throw new NamingException(Messages.getString("jndi.53")); //$NON-NLS-1$ } else { result = new DNSName(); @@ -1841,8 +1879,8 @@ } } else { - throw new NamingException("Only instances of DNSName class " + - "or CompositeName class are acceptable"); + // jndi.4B=Only instances of CompositeName class or DNSName class are acceptable + throw new NamingException(Messages.getString("jndi.4B")); //$NON-NLS-1$ } return result; } @@ -1860,27 +1898,28 @@ private String concatenateDNSNames(String comp1, String comp2) throws NamingException { - boolean comp1IsRoot = comp1.equals("."); - boolean comp2IsRoot = comp2.equals("."); + boolean comp1IsRoot = comp1.equals("."); //$NON-NLS-1$ + boolean comp2IsRoot = comp2.equals("."); //$NON-NLS-1$ String composition = null; nameParser.parse(comp1); nameParser.parse(comp2); - if (comp1.endsWith(".")) { - throw new NamingException("Can't append an absolute DNS name"); + if (comp1.endsWith(".")) { //$NON-NLS-1$ + // jndi.52=Can't append an absolute DNS name + throw new NamingException(Messages.getString("jndi.52")); //$NON-NLS-1$ } if (comp1IsRoot && comp2IsRoot) { - composition = "."; + composition = "."; //$NON-NLS-1$ } else if (!comp1IsRoot && comp2IsRoot) { - composition = comp1 + "."; + composition = comp1 + "."; //$NON-NLS-1$ } else if (comp1IsRoot && !comp2IsRoot) { - throw new NamingException("Root domain should " + - "be the rightmost one"); + // jndi.53=Root domain should be the rightmost one + throw new NamingException(Messages.getString("jndi.53")); //$NON-NLS-1$ } else { - composition = comp1 + "." + comp2; + composition = comp1 + "." + comp2; //$NON-NLS-1$ } return composition; } @@ -1930,7 +1969,7 @@ } remainingName = cmpName.get(cmpName.size() - 1); nameToLookFor = (CompositeName) cmpName.getPrefix(cmpName.size() - 1); - nameToLookFor.add(""); + nameToLookFor.add(""); //$NON-NLS-1$ obj = lookup(nameToLookFor); return new ContextNamePair(obj, remainingName); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.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/DNSName.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java Mon Oct 2 09:58:57 2006 @@ -29,6 +29,8 @@ import javax.naming.InvalidNameException; import javax.naming.Name; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * Represents the name in Domain Name System. The most significant part is the @@ -140,11 +142,12 @@ Enumeration enum2; if (name == null) { - throw new NullPointerException("The name is null"); + // jndi.2E=The name is null + throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$ } if (!(name instanceof DNSName)) { - throw new ClassCastException( - "Given name is not an instance of DNSName class"); + // jndi.2F=Given name is not an instance of DNSName class + throw new ClassCastException(Messages.getString("jndi.2F")); //$NON-NLS-1$ } nameToCompareWith = (DNSName) name; enum1 = this.getAll(); @@ -313,8 +316,8 @@ */ public Name add(int posn, String comp) throws InvalidNameException { if (!componentIsOk(comp)) { - throw new InvalidNameException(comp + " can't be used as a " + - "component for DNS name"); + // jndi.30={0} can't be used as a component for DNS name + throw new InvalidNameException(Messages.getString("jndi.30", comp)); //$NON-NLS-1$ } components.insertElementAt(comp, posn); return this; @@ -330,8 +333,8 @@ */ public Name add(String comp) throws InvalidNameException { if (!componentIsOk(comp)) { - throw new InvalidNameException(comp + " can't be used as a " + - "component for DNS name"); + // jndi.30={0} can't be used as a component for DNS name + throw new InvalidNameException(Messages.getString("jndi.30", comp));//$NON-NLS-1$ } components.addElement(comp); return this; @@ -350,8 +353,8 @@ Vector newComps; if (!(name instanceof DNSName)) { - throw new InvalidNameException("Given name is not an instance of " + - "DNSName class"); + // jndi.31=Given name is not an instance of DNSName class + throw new InvalidNameException(Messages.getString("jndi.31")); //$NON-NLS-1$ } newComps = ((DNSName) name).components; components.addAll(posn, newComps); @@ -370,8 +373,8 @@ Vector newComps; if (!(name instanceof DNSName)) { - throw new InvalidNameException("Given name is not an instance of " + - "DNSName class"); + // jndi.31=Given name is not an instance of DNSName class + throw new InvalidNameException(Messages.getString("jndi.31")); //$NON-NLS-1$ } newComps = ((DNSName) name).components; components.addAll(newComps); @@ -405,7 +408,7 @@ * @return true or false */ static boolean componentIsOk(String comp) { - if (comp.indexOf(".") != -1 || comp.length() > + if (comp.indexOf(".") != -1 || comp.length() > //$NON-NLS-1$ ProviderConstants.LABEL_MAX_CHARS) { return false; Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSNameParser.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSNameParser.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/DNSNameParser.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSNameParser.java Mon Oct 2 09:58:57 2006 @@ -28,6 +28,8 @@ import javax.naming.Name; import javax.naming.NameParser; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * DNS name parser * @author Alexei Zakharov @@ -61,39 +63,42 @@ DNSName dnsName = new DNSName(); if (name == null) { - throw new InvalidNameException("Given name is null"); + // jndi.2E=The name is null + throw new InvalidNameException(Messages.getString("jndi.2E")); //$NON-NLS-1$ } if (name.length() > 255) { - throw new InvalidNameException("The length of the name is more" + - " than 255 characters"); + // jndi.54=The length of the name is more than 255 characters + throw new InvalidNameException(Messages.getString("jndi.54")); //$NON-NLS-1$ } - st = new StringTokenizer(name, ".", true); + st = new StringTokenizer(name, ".", true); //$NON-NLS-1$ while (st.hasMoreTokens()) { String comp = st.nextToken(); - if (comp.equals(".")) { + if (comp.equals(".")) { //$NON-NLS-1$ if (lastTokenWasDilim) { // two delimiters one after another + // jndi.55=Null label is not the rightmost one throw new InvalidNameException( - "Null label is not the rightmost one"); + Messages.getString("jndi.55")); //$NON-NLS-1$ } lastTokenWasDilim = true; if (dnsName.size() == 0 && st.hasMoreTokens()) { - throw new InvalidNameException("DNS name shouldn't " + - "start with a dot"); + // jndi.56=DNS name shouldn't start with a dot + throw new InvalidNameException(Messages.getString("jndi.56")); //$NON-NLS-1$ } } else { if (comp.length() > 63) { - throw new InvalidNameException("The length of " + - comp + " label is more than 63 characters"); + // jndi.57=The length of {0} label is more than 63 characters + throw new InvalidNameException( + Messages.getString("jndi.57", comp)); //$NON-NLS-1$ } dnsName.add(0, comp); lastTokenWasDilim = false; } } if (lastTokenWasDilim) { - dnsName.add(0, ""); + dnsName.add(0, ""); //$NON-NLS-1$ } return dnsName; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSPseudoURL.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSPseudoURL.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/DNSPseudoURL.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSPseudoURL.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 a DNS pseudo URL. * @author Alexei Zakharov @@ -32,9 +34,9 @@ */ public class DNSPseudoURL { - private String host = "localhost"; + private String host = "localhost"; //$NON-NLS-1$ private int port = ProviderConstants.DEFAULT_DNS_PORT; - private String domain = "."; + private String domain = "."; //$NON-NLS-1$ private boolean hostIpWasGiven = false; /** @@ -58,31 +60,36 @@ String token; if (strForm == null) { - throw new NullPointerException("strForm is null"); + // jndi.67=strForm is null + throw new NullPointerException(Messages.getString("jndi.67")); //$NON-NLS-1$ } - st = new StringTokenizer(strForm, "/", true); + st = new StringTokenizer(strForm, "/", true); //$NON-NLS-1$ if (!st.hasMoreTokens()) { - throw new IllegalArgumentException("Empty URL"); + // jndi.68=Empty URL + throw new IllegalArgumentException(Messages.getString("jndi.68")); //$NON-NLS-1$ } // scheme token = st.nextToken(); - if (!token.equals("dns:")) { - throw new IllegalArgumentException("Specified scheme is not dns"); + if (!token.equals("dns:")) { //$NON-NLS-1$ + // jndi.69=Specified scheme is not dns + throw new IllegalArgumentException(Messages.getString("jndi.69")); //$NON-NLS-1$ } // host if (st.hasMoreTokens()) { token = st.nextToken(); - if (!token.equals("/") || !st.hasMoreTokens()) { - throw new IllegalArgumentException("Bad URL syntax"); + if (!token.equals("/") || !st.hasMoreTokens()) { //$NON-NLS-1$ + // jndi.6A=Bad URL syntax + throw new IllegalArgumentException(Messages.getString("jndi.6A")); //$NON-NLS-1$ } token = st.nextToken(); - if (token.equals("/")) { + if (token.equals("/")) { //$NON-NLS-1$ // host[:port] was given if (!st.hasMoreElements()) { - throw new IllegalArgumentException("Bad URL syntax"); + // jndi.6A=Bad URL syntax + throw new IllegalArgumentException(Messages.getString("jndi.6A")); //$NON-NLS-1$ } token = st.nextToken(); - st2 = new StringTokenizer(token, ":"); + st2 = new StringTokenizer(token, ":"); //$NON-NLS-1$ host = st2.nextToken(); try { ProviderMgr.parseIpStr(host); @@ -97,8 +104,9 @@ // domain if (st.hasMoreTokens()) { token = st.nextToken(); - if (!token.equals("/") || !st.hasMoreTokens()) { - throw new IllegalArgumentException("Bad URL syntax"); + if (!token.equals("/") || !st.hasMoreTokens()) { //$NON-NLS-1$ + // jndi.6A=Bad URL syntax + throw new IllegalArgumentException(Messages.getString("jndi.6A")); //$NON-NLS-1$ } domain = ProviderMgr.normalizeName(st.nextToken()); } @@ -108,8 +116,9 @@ } // extra if (st.hasMoreTokens()) { + // jndi.66=Extra characters encountered at the end of the URL throw new IllegalArgumentException( - "Extra characters encountered at the end of the URL"); + Messages.getString("jndi.66")); //$NON-NLS-1$ } } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Message.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Message.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/Message.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Message.java Mon Oct 2 09:58:57 2006 @@ -27,6 +27,8 @@ import java.util.Vector; import java.util.Enumeration; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * This class represents a domain protocol message. * @@ -154,7 +156,8 @@ // basic check if (buffer == null) { - throw new DomainProtocolException("buffer is null"); + // jndi.32=buffer is null + throw new DomainProtocolException(Messages.getString("jndi.32")); //$NON-NLS-1$ } // ID idx = ProviderMgr.write16Int(id, buffer, idx); @@ -234,8 +237,8 @@ int arCnt; if (mesObj == null) { - throw new DomainProtocolException( - "The value of parameter mesObj is null"); + // jndi.58=The value of parameter mesObj is null + throw new DomainProtocolException(Messages.getString("jndi.58")); //$NON-NLS-1$ } // header section // ID @@ -312,46 +315,46 @@ public String toString() { StringBuffer sb = new StringBuffer(); - sb.append("ID=" + id + "\n"); + sb.append("ID=" + id + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ if (qr) { - sb.append(" QR"); + sb.append(" QR"); //$NON-NLS-1$ } - sb.append(" OPCODE=" + opCode); + sb.append(" OPCODE=" + opCode); //$NON-NLS-1$ if (aa) { - sb.append(" AA"); + sb.append(" AA"); //$NON-NLS-1$ } if (tc) { - sb.append(" TC"); + sb.append(" TC"); //$NON-NLS-1$ } if (rd) { - sb.append(" RD"); + sb.append(" RD"); //$NON-NLS-1$ } if (ra) { - sb.append(" RA"); + sb.append(" RA"); //$NON-NLS-1$ } - sb.append(" RCODE=" + rCode); - sb.append("\n"); - sb.append("QDCOUNT=" + qdCount); + sb.append(" RCODE=" + rCode); //$NON-NLS-1$ + sb.append("\n"); //$NON-NLS-1$ + sb.append("QDCOUNT=" + qdCount); //$NON-NLS-1$ for (int i = 0; i < questionRecords.size(); i++) { - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ sb.append(questionRecords.elementAt(i).toString()); } - sb.append("\n"); - sb.append(" ANCOUNT=" + anCount); + sb.append("\n"); //$NON-NLS-1$ + sb.append(" ANCOUNT=" + anCount); //$NON-NLS-1$ for (int i = 0; i < answerRRs.size(); i++) { - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ sb.append(answerRRs.elementAt(i).toString()); } - sb.append("\n"); - sb.append(" NSCOUNT=" + nsCount); + sb.append("\n"); //$NON-NLS-1$ + sb.append(" NSCOUNT=" + nsCount); //$NON-NLS-1$ for (int i = 0; i < authorityRRs.size(); i++) { - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ sb.append(authorityRRs.elementAt(i).toString()); } - sb.append("\n"); - sb.append(" ARCOUNT=" + arCount); + sb.append("\n"); //$NON-NLS-1$ + sb.append(" ARCOUNT=" + arCount); //$NON-NLS-1$ for (int i = 0; i < additionalRRs.size(); i++) { - sb.append("\n"); + sb.append("\n"); //$NON-NLS-1$ sb.append(additionalRRs.elementAt(i).toString()); } return sb.toString(); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderConstants.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderConstants.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/ProviderConstants.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderConstants.java Mon Oct 2 09:58:57 2006 @@ -132,41 +132,41 @@ for (int i = 0; i < 256; i++) { rrTypeNames[i] = String.valueOf(i); } - rrTypeNames[A_TYPE] = "A"; - rrTypeNames[NS_TYPE] = "NS"; + rrTypeNames[A_TYPE] = "A"; //$NON-NLS-1$ + rrTypeNames[NS_TYPE] = "NS"; //$NON-NLS-1$ //rrTypeNames[MD_TYPE] = "MD"; //rrTypeNames[MF_TYPE] = "MF"; - rrTypeNames[CNAME_TYPE] = "CNAME"; - rrTypeNames[SOA_TYPE] = "SOA"; + rrTypeNames[CNAME_TYPE] = "CNAME"; //$NON-NLS-1$ + rrTypeNames[SOA_TYPE] = "SOA"; //$NON-NLS-1$ //rrTypeNames[MB_TYPE] = "MB"; //rrTypeNames[MG_TYPE] = "MG"; //rrTypeNames[MR_TYPE] = "MR"; //rrTypeNames[NULL_TYPE] = "NULL"; //rrTypeNames[WKS_TYPE] = "WKS"; - rrTypeNames[PTR_TYPE] = "PTR"; - rrTypeNames[HINFO_TYPE] = "HINFO"; + rrTypeNames[PTR_TYPE] = "PTR"; //$NON-NLS-1$ + rrTypeNames[HINFO_TYPE] = "HINFO"; //$NON-NLS-1$ //rrTypeNames[MINFO_TYPE] = "MINFO"; - rrTypeNames[MX_TYPE] = "MX"; - rrTypeNames[TXT_TYPE] = "TXT"; - rrTypeNames[AAAA_TYPE] = "AAAA"; - rrTypeNames[SRV_TYPE] = "SRV"; + rrTypeNames[MX_TYPE] = "MX"; //$NON-NLS-1$ + rrTypeNames[TXT_TYPE] = "TXT"; //$NON-NLS-1$ + rrTypeNames[AAAA_TYPE] = "AAAA"; //$NON-NLS-1$ + rrTypeNames[SRV_TYPE] = "SRV"; //$NON-NLS-1$ //rrTypeNames[AXFR_QTYPE] = "AXFR"; //rrTypeNames[MAILB_QTYPE] = "MAILB"; //rrTypeNames[MAILA_QTYPE] = "MAILA"; - rrTypeNames[ANY_QTYPE] = "*"; + rrTypeNames[ANY_QTYPE] = "*"; //$NON-NLS-1$ // Resource Record classes rrClassNames = new String[256]; for (int i = 0; i < 256; i++) { rrClassNames[i] = String.valueOf(i); } - rrClassNames[IN_CLASS] = "IN"; - rrClassNames[HS_CLASS] = "HS"; - rrClassNames[ANY_QCLASS] = "*"; + rrClassNames[IN_CLASS] = "IN"; //$NON-NLS-1$ + rrClassNames[HS_CLASS] = "HS"; //$NON-NLS-1$ + rrClassNames[ANY_QCLASS] = "*"; //$NON-NLS-1$ // Root zone name try { - ROOT_ZONE_NAME_OBJ = (DNSName) ((new DNSNameParser()).parse(".")); + ROOT_ZONE_NAME_OBJ = (DNSName) ((new DNSNameParser()).parse(".")); //$NON-NLS-1$ } catch (InvalidNameException e) { // ignore } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderMgr.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderMgr.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/ProviderMgr.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ProviderMgr.java Mon Oct 2 09:58:57 2006 @@ -24,6 +24,8 @@ package org.apache.harmony.jndi.provider.dns; import java.util.StringTokenizer; + +import org.apache.harmony.jndi.internal.nls.Messages; //import java.util.logging.Logger; /** @@ -62,7 +64,8 @@ if (name != null) { // initial check if (buffer == null) { - throw new NullPointerException("buffer is null"); + // jndi.32=buffer is null + throw new NullPointerException(Messages.getString("jndi.32")); //$NON-NLS-1$ } if (startIdx > buffer.length || startIdx < 0) { throw new ArrayIndexOutOfBoundsException(); @@ -73,7 +76,7 @@ // "The syntax of the domain name " + // name + " does not conform to RFC 1035"); //} - st = new StringTokenizer(name, "."); + st = new StringTokenizer(name, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { String token = st.nextToken(); byte[] tokenBytes; @@ -85,8 +88,8 @@ tokenBytes = token.getBytes(); tokenBytesLen = tokenBytes.length; if (tokenBytesLen > ProviderConstants.LABEL_MAX_CHARS) { - throw new DomainProtocolException("The domain label is " + - "too long: " + token); + // jndi.64=The domain label is too long: {0} + throw new DomainProtocolException(Messages.getString("jndi.64", token)); //$NON-NLS-1$ } if (idx + tokenBytesLen + 1 > buffer.length) { throw new ArrayIndexOutOfBoundsException(); @@ -96,9 +99,9 @@ buffer[idx++] = tokenBytes[i]; } if (idx - startIdx + 1 > ProviderConstants.NAME_MAX_CHARS) { - throw new DomainProtocolException("The domain name " + - "is more than " + ProviderConstants.NAME_MAX_CHARS + - " octets long: " + name); + // jndi.5A=The domain name is more than {0} octets long: {1} + throw new DomainProtocolException( + Messages.getString("jndi.5A", ProviderConstants.NAME_MAX_CHARS, name)); //$NON-NLS-1$ } } // every domain name should end with an zero octet @@ -123,10 +126,12 @@ boolean firstTime = true; if (mesBytes == null) { - throw new NullPointerException("Input byte array is null"); + // jndi.5B=Input byte array is null + throw new NullPointerException(Messages.getString("jndi.5B")); //$NON-NLS-1$ } if (result == null) { - throw new NullPointerException("The result string buffer is null"); + // jndi.5C=The result string buffer is null + throw new NullPointerException(Messages.getString("jndi.5C")); //$NON-NLS-1$ } while (true) { int n = parse8Int(mesBytes, idx++); @@ -148,12 +153,12 @@ } // plain label if (n > ProviderConstants.LABEL_MAX_CHARS) { - throw new DomainProtocolException("Domain label is too " + - " long"); + // jndi.59=Domain label is too long. + throw new DomainProtocolException(Messages.getString("jndi.59")); //$NON-NLS-1$ } if (idx + n > mesBytes.length) { - throw new DomainProtocolException("Truncated data while " + - " parsing the domain name"); + // jndi.5D=Truncated data while parsing the domain name + throw new DomainProtocolException(Messages.getString("jndi.5D")); //$NON-NLS-1$ } // append parsed label if (firstTime) { @@ -182,8 +187,8 @@ if (name1 == null || name2 == null) { return 0; } - st1 = new StringTokenizer(name1, "."); - st2 = new StringTokenizer(name2, "."); + st1 = new StringTokenizer(name1, "."); //$NON-NLS-1$ + st2 = new StringTokenizer(name2, "."); //$NON-NLS-1$ while (st1.hasMoreTokens() && st2.hasMoreTokens()) { if (st1.nextToken().equalsIgnoreCase(st2.nextToken())) { k++; @@ -205,14 +210,14 @@ if (name == null) { return null; } - if (name.trim().equals(".") || name.trim().length() == 0) { - return "."; + if (name.trim().equals(".") || name.trim().length() == 0) { //$NON-NLS-1$ + return "."; //$NON-NLS-1$ } n = name.indexOf('.'); if (n != -1 && name.length() > n + 1) { return name.substring(n + 1, name.length()); } - return "."; + return "."; //$NON-NLS-1$ } /** @@ -307,10 +312,12 @@ int idx = startIdx; if (value == null || buffer == null) { - throw new NullPointerException("value or buffer is null"); + // jndi.5E=value or buffer is null + throw new NullPointerException(Messages.getString("jndi.5E")); //$NON-NLS-1$ } if (value.length() > 255) { - throw new DomainProtocolException("Character string is too long"); + // jndi.5F=Character string is too long + throw new DomainProtocolException(Messages.getString("jndi.5F")); //$NON-NLS-1$ } bytes = value.getBytes(); buffer[idx++] = (byte) bytes.length; @@ -333,7 +340,8 @@ int len; if (mesBytes == null || result == null) { - throw new NullPointerException("mesBytes or result is null"); + // jndi.60=mesBytes or result is null + throw new NullPointerException(Messages.getString("jndi.60")); //$NON-NLS-1$ } len = mesBytes[startIdx]; result.append(new String(mesBytes, startIdx + 1, len)); @@ -383,11 +391,11 @@ */ public static boolean namesAreEqual(String name1, String name2) { - if (!name1.endsWith(".")) { - name1 += "."; + if (!name1.endsWith(".")) { //$NON-NLS-1$ + name1 += "."; //$NON-NLS-1$ } - if (!name2.endsWith(".")) { - name2 += "."; + if (!name2.endsWith(".")) { //$NON-NLS-1$ + name2 += "."; //$NON-NLS-1$ } return name1.equalsIgnoreCase(name2); } @@ -430,8 +438,8 @@ if (zone == null) { return zone; } - return zone.endsWith(".") ? zone.toLowerCase() : - zone.toLowerCase() + "."; + return zone.endsWith(".") ? zone.toLowerCase() : //$NON-NLS-1$ + zone.toLowerCase() + "."; //$NON-NLS-1$ } @@ -447,14 +455,14 @@ StringBuffer sb = new StringBuffer(); if (ip == null || ip.length < 4) { - throw new IllegalArgumentException("Given array is null or has the"+ - " length less than four"); + // jndi.61=Given array is null or has the length less than four + throw new IllegalArgumentException(Messages.getString("jndi.61")); //$NON-NLS-1$ } for (int i = 0; i < 4; i++) { if (i > 0) { - sb.append("."); + sb.append("."); //$NON-NLS-1$ } - sb.append("" + ((ip[i]) & 0xff)); + sb.append("" + ((ip[i]) & 0xff)); //$NON-NLS-1$ } return sb.toString(); } @@ -471,12 +479,13 @@ public static byte[] parseIpStr(String ipStr) { StringTokenizer st; byte[] b = new byte[4]; - final String errMsg1 = "Given string is not in appropriate format"; + // jndi.62=Given string is not in appropriate format + final String errMsg1 = Messages.getString("jndi.62"); //$NON-NLS-1$ if (ipStr != null) { int k = 0; - st = new StringTokenizer(ipStr, "."); + st = new StringTokenizer(ipStr, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { String token = st.nextToken(); int n; @@ -492,8 +501,8 @@ throw new IllegalArgumentException(errMsg1); } } else { - throw new NullPointerException( - "Given string representation is null"); + // jndi.63=Given string representation is null + throw new NullPointerException(Messages.getString("jndi.63")); //$NON-NLS-1$ } return b; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/QuestionRecord.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/QuestionRecord.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/QuestionRecord.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/QuestionRecord.java Mon Oct 2 09:58:57 2006 @@ -23,6 +23,8 @@ package org.apache.harmony.jndi.provider.dns; +import org.apache.harmony.jndi.internal.nls.Messages; + /** * Represents domain protocol Question Record @@ -78,7 +80,8 @@ // basic checkings if (buffer == null) { - throw new DomainProtocolException("buffer is null"); + // jndi.32=buffer is null + throw new DomainProtocolException(Messages.getString("jndi.32")); //$NON-NLS-1$ } if (startIdx >= buffer.length || startIdx < 0) { throw new ArrayIndexOutOfBoundsException(); @@ -111,7 +114,8 @@ StringBuffer nameSB = new StringBuffer(); if (resultQR == null) { - throw new NullPointerException("Given resultQR is null"); + // jndi.33=Given resultQR is null + throw new NullPointerException(Messages.getString("jndi.33")); //$NON-NLS-1$ } // name idx = ProviderMgr.parseName(mesBytes, idx , nameSB); @@ -141,9 +145,9 @@ qClassStr = String.valueOf(qClass); } sb.append(qClassStr); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(qTypeStr); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ sb.append(qName); return sb.toString(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.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/Resolver.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java Mon Oct 2 09:58:57 2006 @@ -39,6 +39,7 @@ import javax.naming.NamingException; import javax.naming.ServiceUnavailableException; +import org.apache.harmony.jndi.internal.nls.Messages; import org.apache.harmony.jndi.provider.dns.SList.Server; //import org.apache.harmony.util.logging.LogConst; @@ -273,13 +274,16 @@ 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$ } if (types == null) { - throw new NullPointerException("types is null"); + // jndi.6B=types is null + throw new NullPointerException(Messages.getString("jndi.6B")); //$NON-NLS-1$ } if (classes == null) { - throw new NullPointerException("classes is null"); + // jndi.6C=classes is null + throw new NullPointerException(Messages.getString("jndi.6C")); //$NON-NLS-1$ } for (int element : classes) { for (int element0 : types) { @@ -326,14 +330,14 @@ // query remote DNS servers // determine work zone - if (qName != null && !qName.equals(".")) { + if (qName != null && !qName.equals(".")) { //$NON-NLS-1$ workZone = qName; // support for SRV-style qNames - while (workZone.startsWith("_")) { + while (workZone.startsWith("_")) { //$NON-NLS-1$ workZone = ProviderMgr.getParentName(workZone); } } else { - workZone = "."; + workZone = "."; //$NON-NLS-1$ } //if (LogConst.DEBUG) { // ProviderMgr.logger.fine("Lookup: new workZone is " + @@ -398,8 +402,8 @@ //if (LogConst.DEBUG) { // ProviderMgr.logger.fine("Lookup: name error"); //} - throw new NameNotFoundException("The name " + name + - " has not been found"); + // jndi.6D=Name {0} was not found + throw new NameNotFoundException(Messages.getString("jndi.6D", name)); //$NON-NLS-1$ } else if (report.aliasInfoWasReceived) { // alias received @@ -431,12 +435,12 @@ break; } } - if (qName != null && !qName.equals(".")) + if (qName != null && !qName.equals(".")) //$NON-NLS-1$ { workZone = qName; } else { - workZone = "."; + workZone = "."; //$NON-NLS-1$ } visitedServers = new Hashtable(); for (int k = 0; k < report.records.size(); k++) { @@ -510,7 +514,7 @@ //if (LogConst.DEBUG) { // ProviderMgr.logger.fine("Lookup: no idea"); //} - if (!workZone.equals(".")) { + if (!workZone.equals(".")) { //$NON-NLS-1$ workZone = ProviderMgr.getParentName(workZone); //if (LogConst.DEBUG) { // ProviderMgr.logger.fine( @@ -577,11 +581,12 @@ //SList slist = SList.getInstance(); 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$ } // if given name is SRV style name where domain name is prefixed // with _Proto - if (name.startsWith("_")) { + if (name.startsWith("_")) { //$NON-NLS-1$ int n = name.indexOf('.'); if (n != -1) { @@ -590,11 +595,11 @@ name = name.substring(n + 1, name.length()); } else { // nonsense - name = "."; + name = "."; //$NON-NLS-1$ } } else { // nonsense - name = "."; + name = "."; //$NON-NLS-1$ } } enum1 = lookup(name, new int[] {ProviderConstants.NS_TYPE}, @@ -613,7 +618,7 @@ qClassArr[0] = rr.getRRClass(); } else if (rr.getRRType() == ProviderConstants.SOA_TYPE) { StringTokenizer st = new StringTokenizer( - (String) rr.getRData(), " "); + (String) rr.getRData(), " "); //$NON-NLS-1$ if (st.hasMoreTokens()) { authoritativeServers.add(st.nextToken()); @@ -688,8 +693,8 @@ completeAnswer = true; break; case ProviderConstants.NAME_ERROR: - throw new NameNotFoundException("Name " + name + - " was not found"); + // jndi.6D=Name {0} was not found + throw new NameNotFoundException(Messages.getString("jndi.6D", name)); //$NON-NLS-1$ case ProviderConstants.SERVER_FAILURE: case ProviderConstants.FORMAT_ERROR: case ProviderConstants.NOT_IMPLEMENTED: @@ -713,8 +718,9 @@ if (!completeAnswer) { // found nothing + // jndi.6E=Unable to perform zone transfer throw new ServiceUnavailableException( - "Unable to perform zone transfer"); + Messages.getString("jndi.6E")); //$NON-NLS-1$ } // SRV _Proto prefix support - filter all records that don't have given // _Proto field @@ -724,7 +730,7 @@ for (int i = 0; i < answerVect.size(); i++) { ResourceRecord rr = answerVect.elementAt(i); StringTokenizer st = new StringTokenizer(rr.getName(), - "."); + "."); //$NON-NLS-1$ String token = null; boolean valid = false; @@ -763,10 +769,12 @@ SList slist = SList.getInstance(); if (name == null && ip == null) { - throw new NullPointerException("Both name and IP are null"); + // jndi.6F=Both name and IP are null + throw new NullPointerException(Messages.getString("jndi.6F")); //$NON-NLS-1$ } if (zoneName == null) { - throw new NullPointerException("zoneName is null"); + // jndi.70=zoneName is null + throw new NullPointerException(Messages.getString("jndi.70")); //$NON-NLS-1$ } // if IP is not given and we don't know this server yet // try to determine IP from underlying OS services @@ -824,7 +832,8 @@ // determine a question if (!request.getQuestionRecords().hasMoreElements()) { - throw new IllegalArgumentException("no question record"); + // jndi.71=no question record + throw new IllegalArgumentException(Messages.getString("jndi.71")); //$NON-NLS-1$ } qRecord = request.getQuestionRecords().nextElement(); // preparing a domain protocol message @@ -1073,15 +1082,16 @@ // Check the ID. if (request.getId() != answer.getId()) { - throw new DomainProtocolException( - "Request and Answer have different ids"); + // jndi.72=Request and Answer have different ids + throw new DomainProtocolException(Messages.getString("jndi.72")); //$NON-NLS-1$ } // Determine a question. if (questions.hasMoreElements()) { question = questions.nextElement(); } else { - throw new IllegalArgumentException("no question record"); + // jndi.73=no question record + throw new IllegalArgumentException(Messages.getString("jndi.73")); //$NON-NLS-1$ } // If name error occurred - no extra processing needed. if (answer.getRCode() == ProviderConstants.NAME_ERROR) { @@ -1337,7 +1347,7 @@ } for (int i = 0; i < records.size(); i++) { ResourceRecord rr = records.elementAt(i); - String key = rr.getName() + " " + rr.getRRClass() + " " + + String key = rr.getName() + " " + rr.getRRClass() + " " + //$NON-NLS-1$ //$NON-NLS-2$ rr.getRRType(); long ttl = rr.getTtl(); Vector objToUpdateTTL = new Vector(); @@ -1349,7 +1359,7 @@ // look forward for records with the same NAME CLASS TYPE for (int j = i; j < records.size(); j++) { ResourceRecord rr2 = records.elementAt(j); - String key2 = rr2.getName() + " " + rr2.getRRClass() + " " + + String key2 = rr2.getName() + " " + rr2.getRRClass() + " " + //$NON-NLS-1$ //$NON-NLS-2$ rr2.getRRType(); long ttl2 = rr2.getTtl();