harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r634175 - in /harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/javax/naming/CompoundName.java test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java
Date Thu, 06 Mar 2008 06:29:45 GMT
Author: tonywu
Date: Wed Mar  5 22:29:44 2008
New Revision: 634175

URL: http://svn.apache.org/viewvc?rev=634175&view=rev
Log:
According to spec, it should return empty name if the parameter equals to size. 

Modified:
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java?rev=634175&r1=634174&r2=634175&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/CompoundName.java
Wed Mar  5 22:29:44 2008
@@ -625,6 +625,9 @@
     }
 
     public Name getSuffix(int index) {
+        if (index == elem.size()) {
+            return new CompoundName(new Vector<String>().elements(), mySyntax);
+        }
         validateIndex(index, false);
         return new CompoundName(new Vector<String>(elem.subList(index, elem
                 .size())).elements(), mySyntax);

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java?rev=634175&r1=634174&r2=634175&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/CompoundNameTest.java
Wed Mar  5 22:29:44 2008
@@ -968,7 +968,8 @@
 		assertNameEquals(name.getSuffix(0), "a", "b", "c");
 		assertNameEquals(name.getSuffix(1), "b", "c");
 		assertNameEquals(name.getSuffix(2), "c");
-		// assertNameEmpty(name.getSuffix(3)); // worth debate
+        // Follow spec: If posn is equal to size(), an empty compound name is returned.
+        assertNameEmpty(name.getSuffix(3));
 		try {
 			name.getPrefix(-1);
 			fail();



Mime
View raw message