harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r389148 - in /incubator/harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/javax/naming/ test/java/tests/api/javax/naming/ test/java/tests/api/javax/naming/directory/
Date Mon, 27 Mar 2006 14:02:47 GMT
Author: tellison
Date: Mon Mar 27 06:02:46 2006
New Revision: 389148

URL: http://svn.apache.org/viewcvs?rev=389148&view=rev
Log:
Additional fix for HARMONY-220; NameClassPair names cannot be null.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Binding.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestBinding.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestNameClassPair.java
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchResult.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Binding.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Binding.java?rev=389148&r1=389147&r2=389148&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Binding.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Binding.java
Mon Mar 27 06:02:46 2006
@@ -53,11 +53,10 @@
 
     /**
      * Construct a <code>Binding</code> from a name and a class.
-     * The name and class parameters may be null.
      * Relative flag is true.
      *
-     * @param name  a name
-     * @param obj   an object bound with the name
+     * @param name  a name, may not be <code>null</code>.
+     * @param obj   an object bound with the name, may be <code>null</code>.
      */
     public Binding(String name, Object obj) {
         this(name, null, obj, true);
@@ -65,10 +64,10 @@
 
     /**
      * Construct a <code>Binding</code> from a name, an object and a relative
-     * flag. The name and object parameters may be null.
+     * flag.
      *
-     * @param name      a name
-     * @param obj       an object bound with the name
+     * @param name      a name, which may not be <code>null</code>.
+     * @param obj       an object bound with the name, may be <code>null</code>.
      * @param relative  a relative flag
      */
     public Binding(String name, Object obj, boolean relative) {
@@ -77,12 +76,12 @@
 
     /**
      * Construct a <code>Binding</code> from a name, a class, and an object.
-     * The name, class and object parameters may be null.
+     * The class and object parameters may be null.
      * Relative flag is true.
      *
-     * @param name      a name
-     * @param className a class name
-     * @param obj       an object bound with the name
+     * @param name      a name, which may not be <code>null</code>.
+     * @param className a class name, may be <code>null</code>.
+     * @param obj       an object bound with the name, may be <code>null</code>.
      */
     public Binding(String name, String className, Object obj) {
         this(name, className, obj, true);
@@ -90,11 +89,11 @@
 
     /**
      * Construct a <code>Binding</code> from a name, a class, an object and a
-     * relative flag. The name, class and object parameters may be null.
+     * relative flag. The class and object parameters may be null.
      *
-     * @param name      a name
-     * @param className a class name
-     * @param obj       an object bound with the name
+     * @param name      a name, which may not be <code>null</code>.
+     * @param className a class name, may be <code>null</code>.
+     * @param obj       an object bound with the name, may be <code>null</code>.
      * @param relative  a relative flag
      */
     public Binding(

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestBinding.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestBinding.java?rev=389148&r1=389147&r2=389148&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestBinding.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestBinding.java
Mon Mar 27 06:02:46 2006
@@ -58,8 +58,9 @@
 
 	public void testConstructor_NullValue() {
 		Binding p;
-		p = new Binding(null, null, null);
-		assertTrue(null == p.getName());
+
+		p = new Binding("name1", null, null);
+		assertEquals("name1", p.getName());
 		assertTrue(null == p.getClassName());
 		assertTrue(null == p.getObject());
 	}
@@ -67,14 +68,15 @@
 	public void testConstructor_DefaultRelativeValue() {
 		Binding p;
 
-		p = new Binding(null, null);
+		p = new Binding("name1", null);
 		assertEquals(true, p.isRelative());
 	}
 
 	public void testToString() {
 		log.setMethod("testToString");
 		Binding p;
-		p = new Binding(null, null, false);
+
+		p = new Binding("name1", null, false);
 		assertTrue(p.toString().startsWith("(not relative"));
 		p = new Binding("name1", new Integer(3));
 		String str = p.toString();
@@ -102,15 +104,14 @@
 	}
 
 	public void testGetSetName() {
-		Binding p = new Binding("name", new Integer(1));
+		Binding p;
 
+		p = new Binding("name", new Integer(1));
 		assertEquals("name", p.getName());
 		p.setName("name1");
 		assertEquals("name1", p.getName());
 		p.setName("");
 		assertEquals("", p.getName());
-		p.setName(null);
-		assertEquals(null, p.getName());
 	}
 
 	public void testGetSetClassName() {
@@ -124,10 +125,10 @@
 
 	public void testGetSetRelative() {
 		Binding p;
+
 		p = new Binding("name", new Integer(1));
 		assertTrue(p.isRelative());
 		p.setRelative(false);
 		assertFalse(p.isRelative());
 	}
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestNameClassPair.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestNameClassPair.java?rev=389148&r1=389147&r2=389148&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestNameClassPair.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/TestNameClassPair.java
Mon Mar 27 06:02:46 2006
@@ -59,29 +59,29 @@
 	public void testConstructor_NullValue() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null);
-		assertTrue(null == p.getName());
+		p = new NameClassPair("name1", null);
+		assertEquals("name1", p.getName());
 		assertTrue(null == p.getClassName());
 	}
 
 	public void testConstructor_DefaultRelativeValue() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null);
+		p = new NameClassPair("name1", null);
 		assertEquals(true, p.isRelative());
 	}
 
 	public void testToString() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null, false);
+		p = new NameClassPair("name1", null, false);
 		assertTrue(p.toString().startsWith("(not relative"));
 	}
 
 	public void testGetSetName() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null, true);
+		p = new NameClassPair("name1", null, true);
 		p.setName("aname");
 		assertEquals("aname", p.getName());
 	}
@@ -89,7 +89,7 @@
 	public void testGetSetClassName() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null, true);
+		p = new NameClassPair("name1", null, true);
 		p.setClassName("aclassname");
 		assertEquals("aclassname", p.getClassName());
 	}
@@ -97,9 +97,8 @@
 	public void testGetSetRelative() {
 		NameClassPair p;
 
-		p = new NameClassPair(null, null, true);
+		p = new NameClassPair("name1", null, true);
 		p.setRelative(false);
 		assertEquals(false, p.isRelative());
 	}
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchResult.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchResult.java?rev=389148&r1=389147&r2=389148&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchResult.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchResult.java
Mon Mar 27 06:02:46 2006
@@ -113,7 +113,12 @@
 		log.setMethod("testSearchResult_NullAttributes()");
 		SearchResult r;
 
-		r = new SearchResult(null, null, null);
+		try {
+			r = new SearchResult(null, null, null);
+		} 
+		catch (IllegalArgumentException e) {
+			// Expected, name cannot be null
+		}
 	}
 
 	public void testGetterAndSetter() {



Mime
View raw message