Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 97893 invoked from network); 25 Sep 2006 03:33:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Sep 2006 03:33:56 -0000 Received: (qmail 88497 invoked by uid 500); 25 Sep 2006 03:33:56 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 88383 invoked by uid 500); 25 Sep 2006 03:33:56 -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 88257 invoked by uid 99); 25 Sep 2006 03:33:55 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Sep 2006 20:33:55 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=ndbeyer@apache.org; spf=permerror X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received-SPF: error (idunn.apache.osuosl.org: domain apache.org from 140.211.166.113 cause and error) Received: from [140.211.166.113] ([140.211.166.113:52684] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 22/B4-13750-51E47154 for ; Sun, 24 Sep 2006 20:33:42 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 808881A981A; Sun, 24 Sep 2006 20:33:39 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r449555 [1/6] - in /incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java: com/sun/jndi/url/dir2/ com/sun/jndi/url/nntp/ dazzle/jndi/testing/spi/ org/apache/harmony/jndi/provider/dns/ org/apache/harmony/jndi/tests/javax/namin... Date: Mon, 25 Sep 2006 03:33:32 -0000 To: harmony-commits@incubator.apache.org From: ndbeyer@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060925033339.808881A981A@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ndbeyer Date: Sun Sep 24 20:33:27 2006 New Revision: 449555 URL: http://svn.apache.org/viewvc?view=rev&rev=449555 Log: Code cleanup for jndi module, test source: * General generification * Add braces around if/else statements * Remove unused code * Fix spelling errors * Remove unnecessary javadoc * Add annotations for Override * Eliminate compiler warnings Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/dir2/dir2URLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/nntp/nntpURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContext.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/DNSContextTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/NSLookup.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BinaryRefAddrTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BindingTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CannotProceedExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompositeNameTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppletTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextEnvTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextLibTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextMockTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSPITest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSysTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/LinkRefTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NameClassPairTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionsTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferenceTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferralExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/StringRefAddrTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/AttributeModificationExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributeTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributesTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/InitialDirContextTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/ModificationItemTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchControlsTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchResultTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/MockEventDirContext.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingEventTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingExceptionEventTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ControlFactoryTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/InitialLdapContextTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapReferralExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockControl.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockControlFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockExtendedRequest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockExtendedResponse.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockHasControls.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/MockUnsolicitedNotification.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/UnsolicitedNotificationEventTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ctx1/MockContextOne.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ctx2/MockContextTwo.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/DirectoryManagerBuilderTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/DirectoryManagerJCKTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/DirectoryManagerTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/MockResolver.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerBuilderTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerExploreTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirObjectFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirObjectFactoryNoException.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirStateFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockInitialContextFactoryBuilder.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockLdapContext.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockLdapContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/SuccessMockDirStateFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/a_b_c/a_b_cURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/abc/abcURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/dire/direURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ftp/ftpURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/http/httpURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/https/httpsURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/news/newsURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mocksuccess/http/httpURLContextFactory.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/util/FileFilter.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/util/Log.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/util/Person.java incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/util/Util.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/dir2/dir2URLContextFactory.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/dir2/dir2URLContextFactory.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/dir2/dir2URLContextFactory.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/dir2/dir2URLContextFactory.java Sun Sep 24 20:33:27 2006 @@ -28,13 +28,7 @@ Log log = new Log(dir2URLContextFactory.class); - /* - * (non-Javadoc) - * - * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, - * javax.naming.Name, javax.naming.Context, java.util.Hashtable) - */ - public Object getObjectInstance(Object o, Name n, Context c, Hashtable h) + public Object getObjectInstance(Object o, Name n, Context c, Hashtable h) throws Exception { log.setMethod("getObjectInstance"); log.log("wrong method call"); @@ -51,9 +45,9 @@ private Context c; - private Hashtable envmt; + private Hashtable envmt; - public MockObject(Object o, Name n, Context c, Hashtable envmt, + public MockObject(Object o, Name n, Context c, Hashtable envmt, Attributes a) { this.o = o; this.n = n; @@ -62,7 +56,8 @@ this.a = a; } - public String toString() { + @Override + public String toString() { String s = "MockObject {"; s += "Object= " + o + "\n"; @@ -75,7 +70,8 @@ return s; } - public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { if (obj instanceof MockObject) { MockObject theOther = (MockObject) obj; if (o != theOther.o) { @@ -98,24 +94,17 @@ return false; } - boolean attrEqual = (null == a ? null == theOther.a : a - .equals(theOther.a)); - + // This comparison is ignored, why?? + // DirectoryManagerTest fails if this is enabled + //boolean attrEqual = (null == a ? null == theOther.a : a.equals(theOther.a)); + return true; - } else { - return false; } + return false; } } - /* - * (non-Javadoc) - * - * @see javax.naming.spi.DirObjectFactory#getObjectInstance(java.lang.Object, - * javax.naming.Name, javax.naming.Context, java.util.Hashtable, - * javax.naming.directory.Attributes) - */ - public Object getObjectInstance(Object o, Name n, Context c, Hashtable h, + public Object getObjectInstance(Object o, Name n, Context c, Hashtable h, Attributes a) throws Exception { NamingManagerTest.issueIndicatedExceptions(h); if (NamingManagerTest.returnNullIndicated(h)) { Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/nntp/nntpURLContextFactory.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/nntp/nntpURLContextFactory.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/nntp/nntpURLContextFactory.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/com/sun/jndi/url/nntp/nntpURLContextFactory.java Sun Sep 24 20:33:27 2006 @@ -25,13 +25,7 @@ public class nntpURLContextFactory implements ObjectFactory { - /* - * (non-Javadoc) - * - * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, - * javax.naming.Name, javax.naming.Context, java.util.Hashtable) - */ - public Object getObjectInstance(Object o, Name n, Context c, Hashtable h) + public Object getObjectInstance(Object o, Name n, Context c, Hashtable h) throws Exception { NamingManagerTest.issueIndicatedExceptions(h); @@ -49,16 +43,17 @@ private Context c; - private Hashtable envmt; + private Hashtable envmt; - public MockObject(Object o, Name n, Context c, Hashtable envmt) { + public MockObject(Object o, Name n, Context c, Hashtable envmt) { this.o = o; this.n = n; this.c = c; this.envmt = envmt; } - public String toString() { + @Override + public String toString() { String s = "MockObject {"; s += "Object= " + o + "\n"; @@ -71,7 +66,8 @@ return s; } - public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { if (obj instanceof MockObject) { MockObject theOther = (MockObject) obj; if (o != theOther.o) { @@ -95,9 +91,8 @@ } return true; - } else { - return false; } + return false; } } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContext.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContext.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContext.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContext.java Sun Sep 24 20:33:27 2006 @@ -34,23 +34,39 @@ public class DazzleContext implements Context { - class BindingsEnum extends NamesEnum { + class BindingsEnum implements NamingEnumeration { - BindingsEnum(Enumeration keysEnum) { - super(keysEnum); - } + Enumeration keysEnum; - public Object nextElement() { - String key = (String) super.keysEnum.nextElement(); + BindingsEnum(Enumeration keysEnum) { + this.keysEnum = keysEnum; + } + public void close() throws NamingException { + } + + public boolean hasMore() throws NamingException { + return hasMoreElements(); + } + + public boolean hasMoreElements() { + return keysEnum.hasMoreElements(); + } + + public Binding next() throws NamingException { + return nextElement(); + } + + public Binding nextElement() { + String key = keysEnum.nextElement(); return new Binding(key, namespace.get(key)); } } - class NamesEnum implements NamingEnumeration { + class NamesEnum implements NamingEnumeration { - Enumeration keysEnum; + Enumeration keysEnum; - NamesEnum(Enumeration keysEnum) { + NamesEnum(Enumeration keysEnum) { this.keysEnum = keysEnum; } @@ -65,27 +81,28 @@ return keysEnum.hasMoreElements(); } - public Object next() throws NamingException { + public NameClassPair next() throws NamingException { return nextElement(); } - public Object nextElement() { - String key = (String) keysEnum.nextElement(); + public NameClassPair nextElement() { + String key = keysEnum.nextElement(); return new NameClassPair(key, namespace.get(key).getClass() .getName()); } } - private static NameParser nameParser = new DazzleParser(); + private static final NameParser nameParser = new DazzleParser(); - Hashtable environment; + Hashtable environment; - Hashtable namespace; + Hashtable namespace; - DazzleContext(Hashtable environment) { - this.environment = new Hashtable(); - namespace = new Hashtable(); - this.environment = (Hashtable) environment.clone(); + @SuppressWarnings("unchecked") + DazzleContext(Hashtable environment) { + this.environment = new Hashtable(); + namespace = new Hashtable(); + this.environment = (Hashtable) environment.clone(); } public Object addToEnvironment(String propertyName, Object propertyValue) @@ -103,14 +120,14 @@ } if (namespace.get(strName) != null) { throw new NameAlreadyBoundException(); - } else { - namespace.put(strName, target); - return; } + namespace.put(strName, target); + return; } public void close() throws NamingException { - environment = namespace = null; + environment = null; + namespace = null; } public Name composeName(Name name, Name prefix) throws NamingException { @@ -121,8 +138,8 @@ public String composeName(String strName, String strPrefix) throws NamingException { - return composeName(((Name) (new CompositeName(strName))), - ((Name) (new CompositeName(strPrefix)))).toString(); + return composeName(((new CompositeName(strName))), + ((new CompositeName(strPrefix)))).toString(); } public Context createSubcontext(Name name) throws NamingException { @@ -141,8 +158,8 @@ throw new OperationNotSupportedException(); } - public Hashtable getEnvironment() throws NamingException { - return (Hashtable) environment.clone(); + public Hashtable getEnvironment() throws NamingException { + return (Hashtable) environment.clone(); } public String getNameInNamespace() throws NamingException { @@ -157,27 +174,26 @@ return nameParser; } - public NamingEnumeration list(Name name) throws NamingException { + public NamingEnumeration list(Name name) throws NamingException { return list(name.toString()); } - public NamingEnumeration list(String strName) throws NamingException { + public NamingEnumeration list(String strName) throws NamingException { if (strName.length() == 0) { return new NamesEnum(namespace.keys()); } Object target = namespace.get(strName); if (target instanceof Context) { return ((Context) target).list(""); - } else { - throw new NotContextException(); } + throw new NotContextException(); } - public NamingEnumeration listBindings(Name name) throws NamingException { + public NamingEnumeration listBindings(Name name) throws NamingException { return listBindings(name.toString()); } - public NamingEnumeration listBindings(String strName) + public NamingEnumeration listBindings(String strName) throws NamingException { if (strName.length() == 0) { return new BindingsEnum(namespace.keys()); @@ -185,9 +201,8 @@ Object target = namespace.get(strName); if (target instanceof Context) { return ((Context) target).listBindings(""); - } else { - throw new NotContextException(); } + throw new NotContextException(); } public Object lookup(Name name) throws NamingException { @@ -201,9 +216,8 @@ Object result = namespace.get(strName); if (result == null) { throw new NameNotFoundException(); - } else { - return result; } + return result; } public Object lookupLink(Name name) throws NamingException { @@ -221,10 +235,9 @@ public void rebind(String strName, Object target) throws NamingException { if (strName.length() == 0) { throw new InvalidNameException("Name cannot be empty!"); - } else { - namespace.put(strName, target); - return; } + namespace.put(strName, target); + return; } public Object removeFromEnvironment(String propertyName) @@ -247,10 +260,9 @@ Object target = namespace.remove(fromStrName); if (target == null) { throw new NameNotFoundException(); - } else { - namespace.put(toStrName, target); - return; } + namespace.put(toStrName, target); + return; } public void unbind(Name name) throws NamingException { @@ -260,9 +272,8 @@ public void unbind(String strName) throws NamingException { if (strName.length() == 0) { throw new InvalidNameException("Name cannot be empty!"); - } else { - namespace.remove(strName); - return; } + namespace.remove(strName); + return; } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContextFactory.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContextFactory.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContextFactory.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/dazzle/jndi/testing/spi/DazzleContextFactory.java Sun Sep 24 20:33:27 2006 @@ -27,7 +27,7 @@ super(); } - public Context getInitialContext(Hashtable environment) + public Context getInitialContext(Hashtable environment) throws NamingException { return new DazzleContext(environment); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/DNSContextTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/DNSContextTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/DNSContextTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/DNSContextTest.java Sun Sep 24 20:33:27 2006 @@ -41,6 +41,7 @@ private DNSNameParser nameParser = null; + @Override protected void setUp() { nameParser = new DNSNameParser(); } @@ -49,7 +50,7 @@ Context ctx; String propStr1 = "dns://localhost/example.com"; String propStr2 = "dns://localhost"; - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put(Context.PROVIDER_URL, propStr1); ctx = new DNSContextFactory().getInitialContext(env); @@ -65,7 +66,7 @@ Name result = null; String resultStr = null; String propStr1 = "dns://localhost/example.com"; - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); Context ctx; env.put(Context.PROVIDER_URL, propStr1); @@ -127,11 +128,8 @@ public void testConstructor() throws NoSuchFieldException, IllegalArgumentException, SecurityException, NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); DNSContext context = null; - SList slist = null; - SList.Server serv = null; - env.put(Context.AUTHORITATIVE, "true"); env.put(DNSContext.LOOKUP_ATTR, "IN A"); env.put(DNSContext.RECURSION, "true"); @@ -191,7 +189,7 @@ } catch (NumberFormatException e) {} env.put(DNSContext.TIMEOUT_RETRIES, "5"); - env.put(DNSContext.PROVIDER_URL, + env.put(Context.PROVIDER_URL, "dns://dnsserver1.com/super.zone.ru. " + "dns://123.456.78.90/super.zone.ru"); context = (DNSContext)new DNSContextFactory().getInitialContext(env); @@ -206,7 +204,7 @@ fail("DNS server has not been added"); } */ - env.put(DNSContext.PROVIDER_URL, "file:/etc/passwd"); + env.put(Context.PROVIDER_URL, "file:/etc/passwd"); try { context = (DNSContext)new DNSContextFactory().getInitialContext(env); fail("NamingException has not been thrown"); @@ -221,8 +219,8 @@ */ public void testEnvironment() throws NamingException { DNSContext context = null; - Hashtable env = new Hashtable(); - Hashtable env2 = null; + Hashtable env = new Hashtable(); + Hashtable env2 = null; // no side effect env.put(DNSContext.TIMEOUT_INITIAL, "2000"); @@ -251,6 +249,7 @@ // // TODO // } + @Override protected void tearDown() { nameParser = null; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/NSLookup.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/NSLookup.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/NSLookup.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/dns/NSLookup.java Sun Sep 24 20:33:27 2006 @@ -53,11 +53,11 @@ * as an argument */ public static void main(String[] args) throws NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); DirContext ctx = null; Attributes attrs = null; String[] attrNames = new String[1]; - NamingEnumeration attrEnum; + NamingEnumeration attrEnum; if (args.length == 0) { System.out.println("USAGE: java " + @@ -75,7 +75,7 @@ attrEnum = attrs.getAll(); while (attrEnum.hasMoreElements()) { Attribute attr = (Attribute) attrEnum.nextElement(); - NamingEnumeration vals = attr.getAll(); + NamingEnumeration vals = attr.getAll(); while (vals.hasMoreElements()) { System.out.println(attr.getID() + " " + vals.nextElement()); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BinaryRefAddrTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BinaryRefAddrTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BinaryRefAddrTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BinaryRefAddrTest.java Sun Sep 24 20:33:27 2006 @@ -24,45 +24,23 @@ import javax.naming.BinaryRefAddr; import javax.naming.RefAddr; +import junit.framework.Assert; import junit.framework.TestCase; public class BinaryRefAddrTest extends TestCase { - /** - * Constructor for BinaryRefAddr. - * - * @param arg0 - */ - public BinaryRefAddrTest(String arg0) { - super(arg0); - } - - /* - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - } - - /* - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - public void testBinaryRefAddr_SimpleNormale() { byte[] ab = new byte[] { 1, 2, 3 }; byte[] ab2; // Test normal condition BinaryRefAddr addr = new BinaryRefAddr("binary", ab); - TestCase.assertNotNull(addr); - TestCase.assertEquals("binary", addr.getType()); + Assert.assertNotNull(addr); + Assert.assertEquals("binary", addr.getType()); ab2 = (byte[]) addr.getContent(); - TestCase.assertEquals(ab.length, ab2.length); + Assert.assertEquals(ab.length, ab2.length); for (int i = ab2.length - 1; i >= 0; i--) { - TestCase.assertEquals(ab[i], ab2[i]); + Assert.assertEquals(ab[i], ab2[i]); } assertNotSame(ab, ab2); } @@ -73,12 +51,12 @@ // Test null "type" parameter BinaryRefAddr addr = new BinaryRefAddr(null, ab); - TestCase.assertNotNull(addr); - TestCase.assertNull(addr.getType()); + Assert.assertNotNull(addr); + Assert.assertNull(addr.getType()); ab2 = (byte[]) addr.getContent(); - TestCase.assertEquals(ab.length, ab2.length); + Assert.assertEquals(ab.length, ab2.length); for (int i = ab2.length - 1; i >= 0; i--) { - TestCase.assertEquals(ab[i], ab2[i]); + Assert.assertEquals(ab[i], ab2[i]); } } @@ -91,7 +69,7 @@ fail("Should throw NullPointerException here."); } catch (NullPointerException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testBinaryRefAddr_ComplexNormal() { @@ -100,12 +78,12 @@ // Test normal condition BinaryRefAddr addr = new BinaryRefAddr("binary", ab, 1, 1); - TestCase.assertNotNull(addr); - TestCase.assertEquals("binary", addr.getType()); + Assert.assertNotNull(addr); + Assert.assertEquals("binary", addr.getType()); ab2 = (byte[]) addr.getContent(); - TestCase.assertEquals(ab2.length, 1); + Assert.assertEquals(ab2.length, 1); for (int i = ab2.length - 1; i >= 0; i--) { - TestCase.assertEquals(ab[i + 1], ab2[i]); + Assert.assertEquals(ab[i + 1], ab2[i]); } assertNotSame(ab, ab2); } @@ -116,12 +94,12 @@ // Test null "type" parameter BinaryRefAddr addr = new BinaryRefAddr(null, ab, 1, 1); - TestCase.assertNotNull(addr); - TestCase.assertNull(addr.getType()); + Assert.assertNotNull(addr); + Assert.assertNull(addr.getType()); ab2 = (byte[]) addr.getContent(); - TestCase.assertEquals(ab2.length, 1); + Assert.assertEquals(ab2.length, 1); for (int i = ab2.length - 1; i >= 0; i--) { - TestCase.assertEquals(ab[i + 1], ab2[i]); + Assert.assertEquals(ab[i + 1], ab2[i]); } } @@ -134,7 +112,7 @@ fail("Should throw NullPointerException here."); } catch (NullPointerException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testBinaryRefAddr_TooSmallIndex() { @@ -146,7 +124,7 @@ fail("Should throw ArrayIndexOutOfBoundsException here."); } catch (ArrayIndexOutOfBoundsException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testBinaryRefAddr_TooBigIndex() { @@ -158,7 +136,7 @@ fail("Should throw ArrayIndexOutOfBoundsException here."); } catch (ArrayIndexOutOfBoundsException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testBinaryRefAddr_ComplexZeroSize() { @@ -168,8 +146,8 @@ // Test zero size addr = new BinaryRefAddr("binary", new byte[] { 2, 3 }, 0, 0); ab = (byte[]) addr.getContent(); - TestCase.assertEquals(ab.length, 0); - TestCase.assertNotNull(addr); + Assert.assertEquals(ab.length, 0); + Assert.assertNotNull(addr); } public void testBinaryRefAddr_TooSmallSize() { @@ -181,7 +159,7 @@ fail("Should throw NegativeArraySizeException here."); } catch (NegativeArraySizeException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testBinaryRefAddr_TooBigSize() { @@ -193,14 +171,14 @@ fail("Should throw ArrayIndexOutOfBoundsException here."); } catch (ArrayIndexOutOfBoundsException e) { } - TestCase.assertNull(addr); + Assert.assertNull(addr); } public void testGetType() { // Test empty type BinaryRefAddr addr = new BinaryRefAddr("", new byte[] { 1 }); - TestCase.assertEquals("", addr.getType()); + Assert.assertEquals("", addr.getType()); // Other conditions are tested in testBinaryRefAddr_XXX } @@ -236,7 +214,7 @@ BinaryRefAddr addr0 = new BinaryRefAddr(null, address0); BinaryRefAddr addr1 = new BinaryRefAddr(null, address1); try { - boolean result = addr0.equals(addr1); + addr0.equals(addr1); fail("Should throw NullPoinerException."); } catch (NullPointerException e) { } @@ -262,20 +240,19 @@ } int hashCode = type.hashCode(); - for (int i = 0; i < address.length; i++) { - hashCode += address[i]; + for (byte element : address) { + hashCode += element; } BinaryRefAddr addr = new BinaryRefAddr(type, address); assertEquals(hashCode, addr.hashCode()); } public void testHashcode_TypeNull() { - int count = 10; byte[] address = { 1, 2, 3, }; BinaryRefAddr addr = new BinaryRefAddr(null, address); try { - int hashCode = addr.hashCode(); + addr.hashCode(); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -298,8 +275,8 @@ String str = "The type of the address is: " + type + "\nThe content of the address is:"; - for (int i = 0; i < address.length; i++) { - str += " " + Integer.toHexString(address[i]); + for (byte element : address) { + str += " " + Integer.toHexString(element); } str += "\n"; // assertEquals(str, addr.toString()); @@ -309,8 +286,6 @@ public void testToString_TypeNull() { byte[] address = { 1, 2, 3, }; BinaryRefAddr addr = new BinaryRefAddr(null, address); - String str = "The type of the address is: null" - + "\nThe content of the address is: 1 2 3\n"; // assertEquals(str, addr.toString()); assertNotNull(addr.toString()); } @@ -364,7 +339,8 @@ } class MyRefAddr extends RefAddr { - byte[] address; + private static final long serialVersionUID = 1L; + byte[] address; public MyRefAddr(String type, byte[] address) { super(type); @@ -372,7 +348,8 @@ System.arraycopy(address, 0, this.address, 0, address.length); } - public Object getContent() { + @Override + public Object getContent() { return address; } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BindingTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BindingTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BindingTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/BindingTest.java Sun Sep 24 20:33:27 2006 @@ -21,7 +21,7 @@ public class BindingTest extends TestCase { - private static Log log = new Log(BindingTest.class); + private static final Log log = new Log(BindingTest.class); /** * Constructor for TestBinding. @@ -35,14 +35,16 @@ /* * @see TestCase#setUp() */ - protected void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); } /* * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + @Override + protected void tearDown() throws Exception { super.tearDown(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CannotProceedExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CannotProceedExceptionTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CannotProceedExceptionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CannotProceedExceptionTest.java Sun Sep 24 20:33:27 2006 @@ -27,16 +27,7 @@ public class CannotProceedExceptionTest extends TestCase { - static private Log log = new Log(CannotProceedExceptionTest.class); - - /** - * Constructor for TestCannotProceedException. - * - * @param arg0 - */ - public CannotProceedExceptionTest(String arg0) { - super(arg0); - } + private static final Log log = new Log(CannotProceedExceptionTest.class); public void testConstructorAndGetterSetter() throws InvalidNameException { log.setMethod("testConstructorAndGetterSetter()"); @@ -44,7 +35,7 @@ CannotProceedException cpe = new CannotProceedException(); Name altName = new CompositeName("1"); Context altContext = null; - Hashtable h = new Hashtable(); + Hashtable h = new Hashtable(); Name newName = new CompositeName("2"); cpe.setAltName(altName); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompositeNameTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompositeNameTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompositeNameTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompositeNameTest.java Sun Sep 24 20:33:27 2006 @@ -40,7 +40,7 @@ * Constants * ------------------------------------------------------------------- */ - private static Log log = new Log(CompositeNameTest.class); + private static final Log log = new Log(CompositeNameTest.class); private static final char SEPARATOR = '/'; @@ -51,7 +51,7 @@ */ private CompositeName name; - private String[] elements = { "www.apache.org", "gbank" }; + private final String[] elements = { "www.apache.org", "gbank" }; private String initName; @@ -65,8 +65,8 @@ public CompositeNameTest(String arg0) { super(arg0); StringBuffer sb = new StringBuffer(); - for (int i = 0; i < elements.length; i++) { - sb.append(elements[i]).append(SEPARATOR); + for (String element : elements) { + sb.append(element).append(SEPARATOR); } initName = sb.toString(); } @@ -77,10 +77,8 @@ * ------------------------------------------------------------------- */ - /* - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); name = new CompositeName(initName); props = new Properties(); @@ -95,10 +93,8 @@ props.put("jndi.syntax.trimblanks", "false"); } - /* - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { + @Override + protected void tearDown() throws Exception { super.tearDown(); } @@ -160,9 +156,9 @@ */ public void testGetAll() { log.setMethod("testGetAll()"); - Enumeration enumeration = name.getAll(); - for (int j = 0; j < elements.length; j++) { - assertTrue(elements[j].equals(enumeration.nextElement())); + Enumeration enumeration = name.getAll(); + for (String element : elements) { + assertTrue(element.equals(enumeration.nextElement())); } assertTrue("".equals(enumeration.nextElement())); } @@ -368,10 +364,11 @@ * * @throws InvalidNameException */ + @SuppressWarnings("unused") public void testIsEmpty() throws InvalidNameException { log.setMethod("testIsEmpty()"); assertFalse(name.isEmpty()); - for (int i = 0; i < elements.length; i++) { + for (String element : elements) { name.remove(0); } name.remove(0); @@ -441,7 +438,7 @@ // The name "a//a" has 3 elements. The middle element is empty and the // first & third elements are both "a". name = new CompositeName("a//a"); - Enumeration enumeration = name.getAll(); + Enumeration enumeration = name.getAll(); assertEquals("a", enumeration.nextElement()); assertEquals("", enumeration.nextElement()); assertEquals("a", enumeration.nextElement()); @@ -591,7 +588,7 @@ } int i = 0; - Enumeration enumeration = n.getAll(); + Enumeration enumeration = n.getAll(); while (enumeration.hasMoreElements()) { assertEquals(elems[i++], enumeration.nextElement()); } @@ -652,7 +649,7 @@ CompositeName name2 = new MockCompositeName(name.getAll()); assertEquals(name2, name); try { - name2 = new MockCompositeName((Enumeration) null); + name2 = new MockCompositeName((Enumeration) null); fail(); } catch (NullPointerException e) { } @@ -660,7 +657,9 @@ // mock class to test protected methods public class MockCompositeName extends CompositeName { - public MockCompositeName(Enumeration enumeration) { + private static final long serialVersionUID = 1L; + + public MockCompositeName(Enumeration enumeration) { super(enumeration); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java Sun Sep 24 20:33:27 2006 @@ -37,21 +37,10 @@ static Log log = new Log(CompoundNameTest.class); - private Properties props = new Properties(); + private final Properties props = new Properties(); - /** - * Constructor for TestCompoundName. - * - * @param arg0 - */ - public CompoundNameTest(String arg0) { - super(arg0); - } - - /* - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); props.clear(); props.put("jndi.syntax.direction", "left_to_right"); @@ -68,13 +57,6 @@ props2 = (Properties) props.clone(); } - /* - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { - super.tearDown(); - } - public void testConstructor_Simple() throws InvalidNameException { log.setMethod("testConstructor_Simple()"); CompoundName name; @@ -891,7 +873,7 @@ public void testGetAll() throws InvalidNameException { log.setMethod("testGetAll()"); CompoundName name; - Enumeration enumeration; + Enumeration enumeration; // has more than one elements name = new CompoundName("a/b/c", props); @@ -1658,7 +1640,7 @@ } int i = 0; - Enumeration enumeration = n.getAll(); + Enumeration enumeration = n.getAll(); while (enumeration.hasMoreElements()) { assertEquals(elems[i++], enumeration.nextElement()); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppTest.java Sun Sep 24 20:33:27 2006 @@ -18,14 +18,13 @@ import java.util.Enumeration; import java.util.Hashtable; -import javax.naming.InitialContext; import javax.naming.NamingException; import junit.framework.TestCase; import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class InitialContextAppTest extends TestCase { - private static Log log = new Log(InitialContextAppTest.class); + private static final Log log = new Log(InitialContextAppTest.class); public void testConstructor_App() throws NamingException, IOException { //Comment this test case out because this test case @@ -39,9 +38,9 @@ // assertEquals(expected, props); } - void printHashtable(Hashtable env) { + void printHashtable(Hashtable env) { // TO DO: Need to remove - Enumeration keys = env.keys(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); log.log(key + "=" + env.get(key)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppletTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppletTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppletTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextAppletTest.java Sun Sep 24 20:33:27 2006 @@ -15,13 +15,7 @@ package org.apache.harmony.jndi.tests.javax.naming; -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.InitialContext; import javax.naming.NamingException; - -import org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockApplet; import junit.framework.TestCase; Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextEnvTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextEnvTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextEnvTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextEnvTest.java Sun Sep 24 20:33:27 2006 @@ -27,12 +27,10 @@ import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class InitialContextEnvTest extends TestCase { - private static Log log = new Log(InitialContextEnvTest.class); + private static final Log log = new Log(InitialContextEnvTest.class); - /* - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception { + @Override + protected void tearDown() throws Exception { super.tearDown(); Log.close(); } @@ -42,7 +40,7 @@ /* * set properties for environment parameter */ - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "dazzle.jndi.testing.spi.DazzleContextFactory"); // C type @@ -115,9 +113,9 @@ InitialContext context = new InitialContext(env); - Hashtable props = context.getEnvironment(); + Hashtable props = context.getEnvironment(); // printHashtable(props); - Hashtable expected = InitialContextLibTest.readAllProps(env); + Hashtable expected = InitialContextLibTest.readAllProps(env); assertEquals(expected, props); } @@ -126,7 +124,7 @@ /* * set properties for environment parameter */ - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "dazzle.jndi.testing.spi.DazzleContextFactory"); // C type @@ -201,15 +199,15 @@ InitialContext context = new InitialContext(env); - Hashtable props = context.getEnvironment(); + Hashtable props = context.getEnvironment(); // printHashtable(props); - Hashtable expected = InitialContextLibTest.readAllProps(env); + Hashtable expected = InitialContextLibTest.readAllProps(env); assertEquals(expected, props); } - void printHashtable(Hashtable env) { + void printHashtable(Hashtable env) { // TO DO: Need to remove - Enumeration keys = env.keys(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); log.log(key + "=" + env.get(key)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextLibTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextLibTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextLibTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextLibTest.java Sun Sep 24 20:33:27 2006 @@ -15,9 +15,6 @@ package org.apache.harmony.jndi.tests.javax.naming; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -25,16 +22,15 @@ import java.util.Hashtable; import java.util.Properties; -import javax.naming.InitialContext; import javax.naming.NamingException; import junit.framework.TestCase; import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class InitialContextLibTest extends TestCase { - private static Log log = new Log(InitialContextLibTest.class); + private static final Log log = new Log(InitialContextLibTest.class); - private static String jndiProp = "jndi.properties"; + private static final String jndiProp = "jndi.properties"; public void testConstructor_Lib() throws NamingException, IOException { //Comment this test case out because this test case @@ -47,16 +43,16 @@ // assertEquals(expected, props); } - void printHashtable(Hashtable env) { + void printHashtable(Hashtable env) { // TO DO: Need to remove - Enumeration keys = env.keys(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); log.log(key + "=" + env.get(key)); } } - static Properties readAllProps(Hashtable env) throws IOException { + static Properties readAllProps(Hashtable env) throws IOException { // env param Properties props = new Properties(); if (env != null) { @@ -70,7 +66,7 @@ // ClassLoader classLoader = ClassLoader.getSystemClassLoader(); ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); - Enumeration resources = classLoader.getResources(jndiProp); + Enumeration resources = classLoader.getResources(jndiProp); while (resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); InputStream fis = url.openStream(); @@ -91,19 +87,19 @@ return props; } - static Properties mergProps(Properties props, Hashtable env) { + static Properties mergProps(Properties props, Hashtable env) { Properties resource = new Properties(); resource.putAll(props); - Hashtable items = getItemsType(); - Enumeration keys = env.keys(); + Hashtable items = getItemsType(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); - String type = (String) items.get(key); + String type = items.get(key); Object oldObj = resource.get(key); Object newObj = env.get(key); if (type == null) { - resource.put(key, (String) newObj); + resource.put(key, newObj); continue; } @@ -115,7 +111,7 @@ if ((oldObj != null) && (newObj != null)) { resource.put(key, (String) oldObj + ":" + (String) newObj); } else if ((oldObj == null) && (newObj != null)) { - resource.put(key, (String) newObj); + resource.put(key, newObj); } } } @@ -123,15 +119,15 @@ return resource; } - static Properties mergSysProps(Properties props, Hashtable env) { + static Properties mergSysProps(Properties props, Hashtable env) { Properties resource = new Properties(); resource.putAll(props); - Hashtable items = getSystemItemsType(); - Enumeration keys = items.keys(); + Hashtable items = getSystemItemsType(); + Enumeration keys = items.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); - String type = (String) items.get(key); + String type = items.get(key); Object oldObj = resource.get(key); Object newObj = env.get(key); @@ -148,8 +144,8 @@ return resource; } - static Hashtable getItemsType() { - Hashtable hashtable = new Hashtable(); + static Hashtable getItemsType() { + Hashtable hashtable = new Hashtable(); hashtable.put("java.naming.factory.initial", "F"); hashtable.put("java.naming.provider.url", "F"); hashtable.put("java.naming.factory.control", "C"); @@ -169,8 +165,8 @@ return hashtable; } - static Hashtable getSystemItemsType() { - Hashtable hashtable = new Hashtable(); + static Hashtable getSystemItemsType() { + Hashtable hashtable = new Hashtable(); hashtable.put("java.naming.factory.initial", "F"); hashtable.put("java.naming.provider.url", "F"); hashtable.put("java.naming.factory.control", "C"); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextMockTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextMockTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextMockTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextMockTest.java Sun Sep 24 20:33:27 2006 @@ -39,11 +39,12 @@ private Context gContext; - private String urlSchema = "http"; + private final String urlSchema = "http"; + @Override protected void setUp() throws Exception { super.setUp(); - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContextFactory"); env.put(Context.URL_PKG_PREFIXES, @@ -601,7 +602,7 @@ public void testInvalidFactory() throws NamingException { log.setMethod("testInvalidFactory"); - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContext"); try { Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSPITest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSPITest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSPITest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSPITest.java Sun Sep 24 20:33:27 2006 @@ -18,15 +18,13 @@ import java.util.Enumeration; import java.util.Hashtable; -import javax.naming.Context; -import javax.naming.InitialContext; import javax.naming.NamingException; import junit.framework.TestCase; import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class InitialContextSPITest extends TestCase { - private Log log = new Log(InitialContextSPITest.class); + private final Log log = new Log(InitialContextSPITest.class); public void testConstructor_SPI() throws NamingException { // log.setMethod("testConstructor_SPI"); @@ -44,9 +42,9 @@ // //printHashtable(props); } - void printHashtable(Hashtable env) { + void printHashtable(Hashtable env) { // TO DO: Need to remove - Enumeration keys = env.keys(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); log.log(key + "=" + env.get(key)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSysTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSysTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSysTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/InitialContextSysTest.java Sun Sep 24 20:33:27 2006 @@ -27,7 +27,7 @@ import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class InitialContextSysTest extends TestCase { - private Log log = new Log(InitialContextSysTest.class); + private final Log log = new Log(InitialContextSysTest.class); public void testConstructor_sys() throws NamingException, IOException { log.setMethod("testConstructor_sys"); @@ -71,15 +71,15 @@ System.setProperty("sys.type", "sys.type.sys"); InitialContext context = new InitialContext(); - Hashtable props = context.getEnvironment(); + Hashtable props = context.getEnvironment(); // printHashtable(props); - Hashtable expected = InitialContextLibTest.readAllProps(null); + Hashtable expected = InitialContextLibTest.readAllProps(null); assertEquals(expected, props); } - void printHashtable(Hashtable env) { + void printHashtable(Hashtable env) { // TO DO: Need to remove - Enumeration keys = env.keys(); + Enumeration keys = env.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); log.log(key + "=" + env.get(key)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/LinkRefTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/LinkRefTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/LinkRefTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/LinkRefTest.java Sun Sep 24 20:33:27 2006 @@ -28,10 +28,8 @@ import javax.naming.StringRefAddr; import junit.framework.TestCase; -import org.apache.harmony.jndi.tests.javax.naming.util.Log; public class LinkRefTest extends TestCase { - private static Log log = new Log(LinkRefTest.class); public void testConstructor_ByName() throws NamingException { Name name = new CompositeName("www.apache.org/index.html"); @@ -43,7 +41,7 @@ public void testConstrcutor_ByNameNull() { Name name = null; try { - LinkRef linkRef = new LinkRef(name); + new LinkRef(name); fail("It should throw NullPointerException."); } catch (NullPointerException e) { } @@ -85,10 +83,8 @@ String name = "www.apache.org/index.html"; LinkRef linkRef = new LinkRef(name); linkRef.clear(); - StringRefAddr stringRefAddr = new StringRefAddr("illegal type name", - name); try { - String link = linkRef.getLinkName(); + linkRef.getLinkName(); fail("It should throw a MalformedLinkException"); } catch (MalformedLinkException e1) { } @@ -99,7 +95,7 @@ MyLinkRef linkRef = new MyLinkRef(name); linkRef.setClassName("Invalid Class name"); try { - String link = linkRef.getLinkName(); + linkRef.getLinkName(); fail("Should throw MalformedLinkException"); } catch (MalformedLinkException e) { } @@ -146,7 +142,6 @@ public void testToString_Simple() { String name = "www.apache.org/index.html"; LinkRef linkRef = new LinkRef(name); - StringRefAddr addr0 = new StringRefAddr("LinkAddress", name); StringRefAddr addr1 = new StringRefAddr("LinkAddress", "www.apache.org"); linkRef.add(addr1); @@ -202,8 +197,9 @@ } class MyLinkRef extends LinkRef { + private static final long serialVersionUID = 1L; - public MyLinkRef(String s) { + public MyLinkRef(String s) { super(s); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NameClassPairTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NameClassPairTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NameClassPairTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NameClassPairTest.java Sun Sep 24 20:33:27 2006 @@ -32,14 +32,16 @@ /* * @see TestCase#setUp() */ - protected void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); } /* * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + @Override + protected void tearDown() throws Exception { super.tearDown(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionTest.java Sun Sep 24 20:33:27 2006 @@ -49,7 +49,8 @@ /* * @see TestCase#setUp() */ - protected void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); ex = new NamingException("test message"); } @@ -57,7 +58,8 @@ /* * @see TestCase#tearDown() */ - protected void tearDown() throws Exception { + @Override + protected void tearDown() throws Exception { super.tearDown(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionsTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionsTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionsTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/NamingExceptionsTest.java Sun Sep 24 20:33:27 2006 @@ -23,9 +23,9 @@ public class NamingExceptionsTest extends TestCase { - static private Log log = new Log(NamingExceptionsTest.class); + private static final Log log = new Log(NamingExceptionsTest.class); - static private Class nexClasses[] = { + private static final Class nexClasses[] = { javax.naming.directory.SchemaViolationException.class, javax.naming.directory.AttributeInUseException.class, javax.naming.directory.AttributeModificationException.class, @@ -75,16 +75,16 @@ public void testDefaultConstructor() { log.setMethod("testDefaultConstructor()"); - for (int i = 0; i < nexClasses.length; i++) { + for (Class element : nexClasses) { try { - if (Modifier.isAbstract(nexClasses[i].getModifiers())) { + if (Modifier.isAbstract(element.getModifiers())) { continue; } - NamingException nex = (NamingException) nexClasses[i] + NamingException nex = (NamingException) element .newInstance(); assertNull(nex.getMessage()); } catch (Throwable e) { - log.log("Failed at " + nexClasses[i]); + log.log("Failed at " + element); log.log(e); } } @@ -93,17 +93,17 @@ public void testStringConstructor() { log.setMethod("testStringConstructor()"); - for (int i = 0; i < nexClasses.length; i++) { + for (Class element : nexClasses) { try { - if (Modifier.isAbstract(nexClasses[i].getModifiers())) { + if (Modifier.isAbstract(element.getModifiers())) { continue; } - NamingException nex = (NamingException) nexClasses[i] + NamingException nex = (NamingException) element .getConstructor(new Class[] { String.class }) .newInstance(new Object[] { "sample text" }); assertEquals("sample text", nex.getMessage()); } catch (Throwable e) { - log.log("Failed at " + nexClasses[i]); + log.log("Failed at " + element); log.log(e); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferenceTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferenceTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferenceTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferenceTest.java Sun Sep 24 20:33:27 2006 @@ -35,7 +35,8 @@ private byte[] buffer; - protected void setUp() { + @Override + protected void setUp() { int bufferLen = 50; buffer = new byte[bufferLen]; Random random = new Random(); @@ -180,7 +181,7 @@ byte[] buffer1 = { 1, 2, 3, 4 }; BinaryRefAddr refAddr1 = new BinaryRefAddr(type, buffer1); byte[] buffer2 = { 1, 2, 3, 4, 5 }; - BinaryRefAddr refAddr2 = new BinaryRefAddr(type, buffer1); + BinaryRefAddr refAddr2 = new BinaryRefAddr(type, buffer2); ref.add(0, refAddr0); ref.add(1, refAddr1); @@ -217,7 +218,7 @@ ref.add(refAddr); try { - RefAddr refAddr2 = ref.get(ref.size()); + ref.get(ref.size()); fail("This should throw a ArrayIndexOutOfBoundsException"); } catch (ArrayIndexOutOfBoundsException e) { } @@ -229,7 +230,7 @@ ref.add(refAddr); try { - RefAddr refAddr2 = ref.get(-1); + ref.get(-1); fail("This should throw a ArrayIndexOutOfBoundsException"); } catch (ArrayIndexOutOfBoundsException e) { } @@ -248,7 +249,7 @@ } for (int i = 0; i < types.length; i++) { - assertEquals(refAddrs[i], (BinaryRefAddr) ref.get(types[i])); + assertEquals(refAddrs[i], ref.get(types[i])); } } @@ -265,7 +266,7 @@ BinaryRefAddr refAddr = new BinaryRefAddr(type, buffer); ref.add(refAddr); try { - RefAddr addr = ref.get(null); + ref.get(null); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -276,13 +277,13 @@ BinaryRefAddr refAddr = new BinaryRefAddr(type, buffer); ref.add(refAddr); - Enumeration allAddrs = ref.getAll(); + Enumeration allAddrs = ref.getAll(); assertTrue(allAddrs.hasMoreElements()); assertEquals(refAddr, allAddrs.nextElement()); } public void testGetAll_Empty() { - Enumeration allAddrs = ref.getAll(); + Enumeration allAddrs = ref.getAll(); assertFalse(allAddrs.hasMoreElements()); } @@ -414,16 +415,14 @@ } public void testEquals_NullClassName() { - String className = "java.lang.String"; String classFactory = "class factory"; String location = "/home/neuser"; Reference reference0 = new Reference(null, classFactory, location); Reference reference1 = new Reference(null, classFactory, location); - Reference reference2 = new Reference(className, classFactory, location); try { - boolean result = reference0.equals(reference1); + reference0.equals(reference1); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -435,7 +434,6 @@ String location = "/home/neuser"; Reference reference0 = new Reference(null, classFactory, location); - Reference reference1 = new Reference(null, classFactory, location); Reference reference2 = new Reference(className, classFactory, location); // try { @@ -451,11 +449,10 @@ String location = "/home/neuser"; Reference reference0 = new Reference(null, classFactory, location); - Reference reference1 = new Reference(null, classFactory, location); Reference reference2 = new Reference(className, classFactory, location); try { - boolean result = reference2.equals(reference0); + reference2.equals(reference0); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferralExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferralExceptionTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferralExceptionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ReferralExceptionTest.java Sun Sep 24 20:33:27 2006 @@ -32,7 +32,7 @@ * ------------------------------------------------------------------- */ - private static Log log = new Log(ReferralExceptionTest.class); + private static final Log log = new Log(ReferralExceptionTest.class); /* * ------------------------------------------------------------------- @@ -69,65 +69,39 @@ public static class MockReferralException extends ReferralException { - /** - * - */ + private static final long serialVersionUID = 1L; + public MockReferralException() { super(); } - /** - * @param s - */ public MockReferralException(String s) { super(s); } - /* - * (non-Javadoc) - * - * @see javax.naming.ReferralException#getReferralContext() - */ - public Context getReferralContext() throws NamingException { + @Override + public Context getReferralContext() throws NamingException { return null; } - /* - * (non-Javadoc) - * - * @see javax.naming.ReferralException#getReferralContext(java.util.Hashtable) - */ - public Context getReferralContext(Hashtable h) throws NamingException { + @Override + public Context getReferralContext(Hashtable h) throws NamingException { return null; } - /* - * (non-Javadoc) - * - * @see javax.naming.ReferralException#getReferralInfo() - */ - public Object getReferralInfo() { + @Override + public Object getReferralInfo() { return null; } - /* - * (non-Javadoc) - * - * @see javax.naming.ReferralException#skipReferral() - */ - public boolean skipReferral() { + @Override + public boolean skipReferral() { return false; } - /* - * (non-Javadoc) - * - * @see javax.naming.ReferralException#retryReferral() - */ - public void retryReferral() { + @Override + public void retryReferral() { } - } - } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/StringRefAddrTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/StringRefAddrTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/StringRefAddrTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/StringRefAddrTest.java Sun Sep 24 20:33:27 2006 @@ -106,7 +106,7 @@ StringRefAddr addr0 = new StringRefAddr(null, address); StringRefAddr addr1 = new StringRefAddr(null, address); try { - boolean result = addr0.equals(addr1); + addr0.equals(addr1); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -123,7 +123,7 @@ String content = "null"; StringRefAddr addr0 = new StringRefAddr(null, content); try { - int hashcode = addr0.hashCode(); + addr0.hashCode(); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -161,8 +161,6 @@ public void testToString_typeNull() { String address = "this is a simple object with null type"; StringRefAddr stringRefAddr = new StringRefAddr(null, address); - String str = "The type of the address is: null" - + "\nThe content of the address is: " + address + "\n"; // assertEquals(str, stringRefAddr.toString()); assertNotNull(stringRefAddr.toString()); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/AttributeModificationExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/AttributeModificationExceptionTest.java?view=diff&rev=449555&r1=449554&r2=449555 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/AttributeModificationExceptionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/AttributeModificationExceptionTest.java Sun Sep 24 20:33:27 2006 @@ -27,7 +27,7 @@ public class AttributeModificationExceptionTest extends TestCase { - private static Log log = new Log(AttributeModificationExceptionTest.class); + private static final Log log = new Log(AttributeModificationExceptionTest.class); /* * -------------------------------------------------------------------