harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r903199 [4/4] - in /harmony/enhanced/classlib/branches/java6: ./ depends/libs/ make/ modules/accessibility/src/test/api/java/common/javax/accessibility/ modules/archive/src/main/java/java/util/jar/ modules/archive/src/main/java/java/util/zi...
Date Tue, 26 Jan 2010 12:40:40 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java Tue Jan 26 12:40:37 2010
@@ -287,6 +287,16 @@
 
     }
 
+    class MyProxy extends Proxy{
+        private static final long serialVersionUID = 1L;
+
+        protected MyProxy(InvocationHandler h) {
+            super(h);
+        }
+    }
+
+
+
 	protected void setUp() {
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractListTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractListTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractListTest.java Tue Jan 26 12:40:37 2010
@@ -430,4 +430,77 @@
 
         holder.clear();
     }
+
+    /**
+     * @tests {@link java.util.AbstractList#indexOf(Object)}
+     */
+    public void test_indexOf_Ljava_lang_Object() {
+        AbstractList<Integer> list = new MockArrayList<Integer>();
+        Integer[] array = { 1, 2, 3, 4, 5 };
+        list.addAll(Arrays.asList(array));
+
+        assertEquals("find 0 in the list do not contain 0", -1, list
+                .indexOf(new Integer(0)));
+        assertEquals("did not return the right location of element 3", 2, list
+                .indexOf(new Integer(3)));
+        assertEquals("find null in the list do not contain null element", -1,
+                list.indexOf(null));
+        list.add(null);
+        assertEquals("did not return the right location of element null", 5,
+                list.indexOf(null));
+    }
+
+    /**
+     * @add tests {@link java.util.AbstractList#lastIndexOf(Object)}
+     */
+    public void test_lastIndexOf_Ljava_lang_Object() {
+        AbstractList<Integer> list = new MockArrayList<Integer>();
+        Integer[] array = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 };
+        list.addAll(Arrays.asList(array));
+
+        assertEquals("find 6 in the list do not contain 6", -1, list
+                .lastIndexOf(new Integer(6)));
+        assertEquals("did not return the right location of element 4", 6, list
+                .lastIndexOf(new Integer(4)));
+        assertEquals("find null in the list do not contain null element", -1,
+                list.lastIndexOf(null));
+        list.add(null);
+        assertEquals("did not return the right location of element null", 10,
+                list.lastIndexOf(null));
+    }
+
+    /**
+     * @add tests {@link java.util.AbstractList#remove(int)}
+     * @add tests {@link java.util.AbstractList#set(int, Object)}
+     */
+    public void test_remove_I() {
+        class MockList<E> extends AbstractList<E> {
+            private ArrayList<E> list;
+
+            @Override
+            public E get(int location) {
+                return list.get(location);
+            }
+
+            @Override
+            public int size() {
+                return list.size();
+            }
+
+        }
+        AbstractList<Integer> list = new MockList<Integer>();
+        try {
+            list.remove(0);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            list.set(0, null);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java Tue Jan 26 12:40:37 2010
@@ -19,6 +19,7 @@
 
 import java.util.AbstractMap;
 import java.util.AbstractSet;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -355,6 +356,57 @@
         assertEquals("Should be equal", amt, ht);
     }
 
+    public void testEqualsWithNullValues() {
+        Map<String, String> a = new HashMap<String, String>();
+        a.put("a", null);
+        a.put("b", null);
+
+        Map<String, String> b = new HashMap<String, String>();
+        a.put("c", "cat");
+        a.put("d", "dog");
+
+        assertFalse(a.equals(b));
+        assertFalse(b.equals(a));
+    }
+
+    public void testNullsOnViews() {
+        Map<String, String> nullHostile = new Hashtable<String, String>();
+
+        nullHostile.put("a", "apple");
+        testNullsOnView(nullHostile.entrySet());
+
+        nullHostile.put("a", "apple");
+        testNullsOnView(nullHostile.keySet());
+
+        nullHostile.put("a", "apple");
+        testNullsOnView(nullHostile.values());
+    }
+
+    private void testNullsOnView(Collection<?> view) {
+        try {
+            assertFalse(view.contains(null));
+        } catch (NullPointerException optional) {
+        }
+
+        try {
+            assertFalse(view.remove(null));
+        } catch (NullPointerException optional) {
+        }
+
+        Set<Object> setOfNull = Collections.singleton(null);
+        assertFalse(view.equals(setOfNull));
+
+        try {
+            assertFalse(view.removeAll(setOfNull));
+        } catch (NullPointerException optional) {
+        }
+
+        try {
+            assertTrue(view.retainAll(setOfNull)); // destructive
+        } catch (NullPointerException optional) {
+        }
+    }
+
     protected void setUp() {
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java Tue Jan 26 12:40:37 2010
@@ -912,9 +912,13 @@
 		double[] specials2 = new double[] { 0d, Double.POSITIVE_INFINITY, -0d,
 				Double.NEGATIVE_INFINITY, Double.MIN_VALUE, Double.NaN,
 				Double.MAX_VALUE };
+        double[] specials3 = new double[] { 0.0, Double.NaN, 1.0, 2.0, Double.NaN,
+                Double.NaN, 1.0, 3.0, -0.0};
 		double[] answer = new double[] { Double.NEGATIVE_INFINITY, -0d, 0d,
 				Double.MIN_VALUE, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
 				Double.NaN };
+        double[] answer3 = new double[] { -0.0, 0.0, 1.0, 1.0, 2.0, 3.0, Double.NaN,
+                Double.NaN, Double.NaN };
 
 		Arrays.sort(specials1);
 		Object[] print1 = new Object[specials1.length];
@@ -929,6 +933,13 @@
 			print2[i] = new Double(specials2[i]);
 		assertTrue("specials sort incorrectly 2: " + Arrays.asList(print2),
 				Arrays.equals(specials2, answer));
+        
+        Arrays.sort(specials3);
+        Object[] print3 = new Object[specials3.length];
+        for (int i = 0; i < specials3.length; i++)
+            print3[i] = new Double(specials3[i]);
+        assertTrue("specials sort incorrectly 3: " + Arrays.asList(print3),
+                Arrays.equals(specials3, answer3));
 	}
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumSetTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumSetTest.java Tue Jan 26 12:40:37 2010
@@ -137,6 +137,25 @@
         }
     }
 
+    public void testRemoveIteratorRemoveFromHugeEnumSet() {
+        EnumSet<HugeEnumCount> set = EnumSet.noneOf(HugeEnumCount.class);
+        set.add(HugeEnumCount.NO64);
+        set.add(HugeEnumCount.NO65);
+        set.add(HugeEnumCount.NO128);
+        Iterator<HugeEnumCount> iterator = set.iterator();
+        assertTrue(iterator.hasNext());
+        assertEquals(HugeEnumCount.NO64, iterator.next());
+        assertTrue(iterator.hasNext());
+        iterator.remove();
+        assertEquals(HugeEnumCount.NO65, iterator.next());
+        assertTrue(iterator.hasNext());
+        assertEquals(HugeEnumCount.NO128, iterator.next());
+        assertFalse(iterator.hasNext());
+        assertEquals(EnumSet.of(HugeEnumCount.NO65, HugeEnumCount.NO128), set);
+        iterator.remove();
+        assertEquals(EnumSet.of(HugeEnumCount.NO65), set);
+    }
+
     /**
      * @tests java.util.EnumSet#allOf(java.lang.Class)
      */
@@ -1220,21 +1239,21 @@
         Set<EnumWithInnerClass> setWithInnerClass = EnumSet
                 .allOf(EnumWithInnerClass.class);
         result = set.retainAll(setWithInnerClass);
-        assertTrue("Should return true", result); //$NON-NLS-1$
+        assertFalse("Should return false", result); //$NON-NLS-1$
         assertEquals("Size of set should be 0", 0, set.size()); //$NON-NLS-1$
 
         setWithInnerClass = EnumSet.noneOf(EnumWithInnerClass.class);
         result = set.retainAll(setWithInnerClass);
-        assertTrue("Should return true", result); //$NON-NLS-1$
+        assertFalse("Should return false", result); //$NON-NLS-1$
 
         Set<EmptyEnum> emptySet = EnumSet.allOf(EmptyEnum.class);
         result = set.retainAll(emptySet);
-        assertTrue("Should return true", result); //$NON-NLS-1$
+        assertFalse("Should return false", result); //$NON-NLS-1$
 
         Set<EnumWithAllInnerClass> setWithAllInnerClass = EnumSet
                 .allOf(EnumWithAllInnerClass.class);
         result = set.retainAll(setWithAllInnerClass);
-        assertTrue("Should return true", result); //$NON-NLS-1$
+        assertFalse("Should return false", result); //$NON-NLS-1$
 
         set.add(EnumFoo.a);
         result = set.retainAll(setWithInnerClass);
@@ -1314,17 +1333,17 @@
         Set<HugeEnumWithInnerClass> hugeSetWithInnerClass = EnumSet
                 .allOf(HugeEnumWithInnerClass.class);
         result = hugeSet.retainAll(hugeSetWithInnerClass);
-        assertTrue(result);
+        assertFalse(result);
         assertEquals(0, hugeSet.size());
 
         hugeSetWithInnerClass = EnumSet.noneOf(HugeEnumWithInnerClass.class);
         result = hugeSet.retainAll(hugeSetWithInnerClass);
-        assertTrue(result);
+        assertFalse(result);
 
         Set<HugeEnumWithInnerClass> hugeSetWithAllInnerClass = EnumSet
                 .allOf(HugeEnumWithInnerClass.class);
         result = hugeSet.retainAll(hugeSetWithAllInnerClass);
-        assertTrue(result);
+        assertFalse(result);
 
         hugeSet.add(HugeEnum.a);
         result = hugeSet.retainAll(hugeSetWithInnerClass);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/InvalidPropertiesFormatExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/InvalidPropertiesFormatExceptionTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/InvalidPropertiesFormatExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/InvalidPropertiesFormatExceptionTest.java Tue Jan 26 12:40:37 2010
@@ -36,4 +36,15 @@
         }
     }
 
+    /**
+     * @tests {@link java.util.InvalidPropertiesFormatException#InvalidPropertiesFormatException(Throwable)}
+     */
+    public void test_Constructor_Ljava_lang_Throwable() {
+        Throwable throwable = new Throwable();
+        InvalidPropertiesFormatException exception = new InvalidPropertiesFormatException(
+                throwable);
+        assertEquals("the casue did not equals argument passed in constructor",
+                throwable, exception.getCause());
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ListResourceBundleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ListResourceBundleTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ListResourceBundleTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ListResourceBundleTest.java Tue Jan 26 12:40:37 2010
@@ -34,8 +34,8 @@
 		String name = "tests.support.Support_TestResource";
 		Locale.setDefault(new Locale("en", "US"));
 		bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "VAR"));
-		Enumeration keys = bundle.getKeys();
-		Vector result = new Vector();
+		Enumeration<String> keys = bundle.getKeys();
+		Vector<String> result = new Vector<String>();
 		while (keys.hasMoreElements()) {
 			result.addElement(keys.nextElement());
 		}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertiesTest.java Tue Jan 26 12:40:37 2010
@@ -151,6 +151,8 @@
         Properties myProps = new Properties();
         myProps.setProperty("Abba", "Cadabra");
         myProps.setProperty("Open", "Sesame");
+        myProps.setProperty("LongProperty",
+                "a long long long long long long long property");
         myProps.list(ps);
         ps.flush();
         String propList = baos.toString();
@@ -158,6 +160,16 @@
                 propList.indexOf("Abba=Cadabra") >= 0);
         assertTrue("Property list innacurate",
                 propList.indexOf("Open=Sesame") >= 0);
+        assertTrue("property list do not conatins \"...\"", propList
+                .indexOf("...") != -1);
+
+        ps = null;
+        try {
+            myProps.list(ps);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
     }
 
     /**
@@ -169,6 +181,8 @@
         Properties myProps = new Properties();
         myProps.setProperty("Abba", "Cadabra");
         myProps.setProperty("Open", "Sesame");
+        myProps.setProperty("LongProperty",
+                "a long long long long long long long property");
         myProps.list(pw);
         pw.flush();
         String propList = baos.toString();
@@ -176,6 +190,13 @@
                 propList.indexOf("Abba=Cadabra") >= 0);
         assertTrue("Property list innacurate",
                 propList.indexOf("Open=Sesame") >= 0);
+        pw = null;
+        try {
+            myProps.list(pw);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
     }
 
     /**
@@ -435,10 +456,8 @@
      * @tests java.util.Properties#propertyNames()
      */
     public void test_propertyNames() {
-        // Test for method java.util.Enumeration
-        // java.util.Properties.propertyNames()
-
-        Enumeration names = tProps.propertyNames();
+        Properties myPro = new Properties(tProps);
+        Enumeration names = myPro.propertyNames();
         int i = 0;
         while (names.hasMoreElements()) {
             ++i;
@@ -458,6 +477,41 @@
         }
     }
 
+    public void test_propertyNames_sequence() {
+        Properties parent = new Properties();
+        parent.setProperty("parent.a.key", "parent.a.value");
+        parent.setProperty("parent.b.key", "parent.b.value");
+
+        Enumeration<?> names = parent.propertyNames();
+        assertEquals("parent.a.key", names.nextElement());
+        assertEquals("parent.b.key", names.nextElement());
+        assertFalse(names.hasMoreElements());
+
+        Properties current = new Properties(parent);
+        current.setProperty("current.a.key", "current.a.value");
+        current.setProperty("current.b.key", "current.b.value");
+
+        names = current.propertyNames();
+        assertEquals("parent.a.key", names.nextElement());
+        assertEquals("current.b.key", names.nextElement());
+        assertEquals("parent.b.key", names.nextElement());
+        assertEquals("current.a.key", names.nextElement());
+        assertFalse(names.hasMoreElements());
+
+        Properties child = new Properties(current);
+        child.setProperty("child.a.key", "child.a.value");
+        child.setProperty("child.b.key", "child.b.value");
+
+        names = child.propertyNames();
+        assertEquals("parent.a.key", names.nextElement());
+        assertEquals("child.b.key", names.nextElement());
+        assertEquals("current.b.key", names.nextElement());
+        assertEquals("parent.b.key", names.nextElement());
+        assertEquals("child.a.key", names.nextElement());
+        assertEquals("current.a.key", names.nextElement());
+        assertFalse(names.hasMoreElements());
+    }
+
     /**
      * @tests {@link java.util.Properties#stringPropertyNames()}
      * @since 1.6
@@ -762,7 +816,7 @@
     /**
      * @tests java.util.Properties#loadFromXML(java.io.InputStream)
      */
-    public void test_loadFromXMLLjava_io_InputStream() {
+    public void test_loadFromXMLLjava_io_InputStream() throws Exception {
         // Test for method void
         // java.util.Properties.loadFromXML(java.io.InputStream)
         Properties prop = null;
@@ -793,13 +847,21 @@
                 .getProperty("key2"));
         assertEquals("Failed to load correct properties", "value1", prop
                 .getProperty("key1"));
+        
+        try {
+            prop.loadFromXML(null);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
     }
 
     /**
      * @tests java.util.Properties#storeToXML(java.io.OutputStream,
      *        java.lang.String, java.lang.String)
      */
-    public void test_storeToXMLLjava_io_OutputStreamLjava_lang_StringLjava_lang_String() {
+    public void test_storeToXMLLjava_io_OutputStreamLjava_lang_StringLjava_lang_String()
+            throws Exception {
         // Test for method void
         // java.util.Properties.storeToXML(java.io.OutputStream,
         // java.lang.String, java.lang.String)
@@ -873,6 +935,14 @@
             assertTrue("Stored property list not equal to original", myProps2
                     .getProperty(nextKey).equals(myProps.getProperty(nextKey)));
         }
+        
+        try {
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            myProps.storeToXML(out, null, null);
+            fail("should throw nullPointerException");
+        } catch (NullPointerException ne) {
+            // expected
+        }
     }
  
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyResourceBundleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyResourceBundleTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyResourceBundleTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyResourceBundleTest.java Tue Jan 26 12:40:37 2010
@@ -29,6 +29,7 @@
 import java.util.Enumeration;
 import java.util.MissingResourceException;
 import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
 import java.util.Vector;
 
 public class PropertyResourceBundleTest extends junit.framework.TestCase {
@@ -162,4 +163,39 @@
 	 */
 	protected void tearDown() {
 	}
+
+    /**
+     * @add tests {@link java.util.PropertyResourceBundle#Enumeration}
+     */
+    public void test_access$0_Enumberation() throws IOException {
+        class MockResourceBundle extends PropertyResourceBundle {
+            MockResourceBundle(java.io.InputStream stream) throws IOException {
+                super(stream);
+            }
+
+            @Override
+            protected void setParent(ResourceBundle bundle) {
+                super.setParent(bundle);
+            }
+        }
+
+        java.io.InputStream localStream = new java.io.ByteArrayInputStream(
+                "p3=three\np4=four".getBytes());
+        MockResourceBundle localPrb = new MockResourceBundle(localStream);
+        localPrb.setParent(prb);
+        Enumeration<String> keys = localPrb.getKeys();
+        Vector<String> contents = new Vector<String>();
+        while (keys.hasMoreElements()) {
+            contents.add(keys.nextElement());
+        }
+
+        assertEquals("did not get the right number of properties", 4, contents
+                .size());
+        assertTrue("did not get the parent property p1", contents
+                .contains("p1"));
+        assertTrue("did not get the parent property p2", contents
+                .contains("p2"));
+        assertTrue("did not get the local property p3", contents.contains("p3"));
+        assertTrue("did not get the local property p4", contents.contains("p4"));
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java Tue Jan 26 12:40:37 2010
@@ -17,10 +17,12 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Formatter;
 import java.util.GregorianCalendar;
+import java.util.List;
 import java.util.Locale;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
@@ -207,4 +209,67 @@
 
 	protected void tearDown() {
 	}
+	
+    /**
+     * @add test {@link java.util.TimeZone#getAvailableIDs(int)}
+     */
+    public void test_getAvailableIDs_I() {
+        TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
+        int rawoffset = tz.getRawOffset();
+        String[] ids = TimeZone.getAvailableIDs(rawoffset);
+        List<String> idList = Arrays.asList(ids);
+        assertTrue("Asia/shanghai and Hongkong should have the same rawoffset",
+                idList.contains("Hongkong"));        
+    }
+    
+    /**
+     * @add test {@link java.util.TimeZone#getDisplayName()}
+     */
+    public void test_getDisplayName() {
+        TimeZone defaultZone = TimeZone.getDefault();
+        Locale defaulLocal = Locale.getDefault();
+        String defaultName = defaultZone.getDisplayName();
+        String expectedName = defaultZone.getDisplayName(defaulLocal);
+        assertEquals(
+                "getDispalyName() did not return the default Locale suitable name",
+                expectedName, defaultName);
+    }
+
+    /**
+     * @add test {@link java.util.TimeZone#getDisplayName(boolean, int)}
+     */
+    public void test_getDisplayName_ZI() {
+        TimeZone defaultZone = TimeZone.getDefault();
+        Locale defaultLocale = Locale.getDefault();
+        String actualName = defaultZone.getDisplayName(false, TimeZone.LONG);
+        String expectedName = defaultZone.getDisplayName(false, TimeZone.LONG,
+                defaultLocale);
+        assertEquals(
+                "getDisplayName(daylight,style) did not return the default locale suitable name",
+                expectedName, actualName);
+    }
+
+    /**
+     * @add test {@link java.util.TimeZone#hasSameRules(TimeZone)}
+     */
+    public void test_hasSameRules_Ljava_util_TimeZone() {
+        TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
+        int offset = tz.getRawOffset();
+
+        String[] ids = TimeZone.getAvailableIDs(offset);
+        int i = 0;
+        if (ids.length != 0) {
+            while (true) {
+                if (!(ids[i].equalsIgnoreCase(tz.getID()))) {
+                    TimeZone sameZone = TimeZone.getTimeZone(ids[i]);
+                    assertTrue(tz.hasSameRules(sameZone));
+                    break;
+                } else {
+                    i++;
+                }
+            }
+        }
+        assertFalse("should return false when parameter is null", tz
+                .hasSameRules(null));
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java Tue Jan 26 12:40:37 2010
@@ -368,7 +368,8 @@
 		super.tearDown();
 	}
 
-    public void test_getCanonicalPath() throws IOException {
+    public void test_getCanonicalPath() throws IOException,
+                                               InterruptedException {
         File tmpFolder1 = new File("folder1");
         tmpFolder1.mkdirs();
         tmpFolder1.deleteOnExit();
@@ -386,7 +387,8 @@
         tmpFolder4.deleteOnExit();
 
         // make a link to folder1/folder2
-        Runtime.getRuntime().exec("ln -s folder1/folder2 folder2");
+        Process ln = Runtime.getRuntime().exec("ln -s folder1/folder2 folder2");
+        ln.waitFor();
         File linkFile = new File("folder2");
         linkFile.deleteOnExit();
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/io/FileCanonPathCacheTest.java Tue Jan 26 12:40:37 2010
@@ -95,6 +95,20 @@
         assertNull(FileCanonPathCache.get(file5.getAbsolutePath()));
     }
 
+    public void testTimeout03() throws Exception {
+        FileCanonPathCache.setTimeout(10);
+        File file = new File("1");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        file = new File("2");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        file = new File("3");
+        FileCanonPathCache.put(file.getAbsolutePath(), file.getAbsolutePath());
+        Thread.sleep(100);
+        FileCanonPathCache.get(file.getAbsolutePath());
+        assertNull(FileCanonPathCache.get(new File("1").getAbsolutePath()));
+        assertNull(FileCanonPathCache.get(new File("2").getAbsolutePath()));
+    }
+
     public void testCacheFull() throws Exception {
         int cacheSize = FileCanonPathCache.CACHE_SIZE;
         File[] files = new File[cacheSize];

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/net.resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-885602
+/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-901560

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/depends/manifests/asm-3.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-885602
+/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-901560

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-885602
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-901560

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-885602
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-901560

Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java Tue Jan 26 12:40:37 2010
@@ -1090,7 +1090,7 @@
         byte[] result = out.toByteArray();
         ByteArrayInputStream in = new ByteArrayInputStream(result);
 
-        Document doc = parseXmlStream(in, true);
+        Document doc = parseXmlStream(in, false);
 
         // only output this node without parent and children
         String rootpath = "/preferences[@EXTERNAL_XML_VERSION='1.0']/root[@type='user']/node[@name='java']/node[@name='util']/node[@name='prefs']";
@@ -1116,6 +1116,7 @@
         // Create a builder factory
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setValidating(validating);
+        factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
 
         // Create the builder and parse the file
         DocumentBuilder builder = factory.newDocumentBuilder();
@@ -1144,7 +1145,7 @@
         byte[] result = out.toByteArray();
         // System.out.println(new String(result, "utf-8"));
         ByteArrayInputStream in = new ByteArrayInputStream(result);
-        Document doc = parseXmlStream(in, true);
+        Document doc = parseXmlStream(in, false);
 
         // only output this node and subtree without parent
         String rootpath = "/preferences[@EXTERNAL_XML_VERSION='1.0']/root[@type='user']/node[@name='java']/node[@name='util']/node[@name='prefs']";

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF Tue Jan 26 12:40:37 2010
@@ -23,6 +23,7 @@
  javax.net,
  javax.net.ssl,
  org.apache.harmony.kernel.vm,
+ org.apache.harmony.luni.util,
  org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional
 Export-Package: java.rmi,
  java.rmi.activation,

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/java/rmi/server/RMIClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/java/rmi/server/RMIClassLoader.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/java/rmi/server/RMIClassLoader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/java/rmi/server/RMIClassLoader.java Tue Jan 26 12:40:37 2010
@@ -29,6 +29,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
+import org.apache.harmony.luni.util.InputStreamHelper;
 import org.apache.harmony.rmi.DefaultRMIClassLoaderSpi;
 import org.apache.harmony.rmi.internal.nls.Messages;
 
@@ -210,9 +211,7 @@
             // resource not found
             return null;
         }
-        Object obj = null;
-        byte[] buf = new byte[in.available()];
-        in.read(buf);
+        byte[] buf = InputStreamHelper.readFullyAndClose(in);
         String str = new String(buf, "UTF-8"); //$NON-NLS-1$
         StringTokenizer tok = new StringTokenizer(str, "\n\r"); //$NON-NLS-1$
 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java Tue Jan 26 12:40:37 2010
@@ -309,7 +309,8 @@
             case StreamTokenizer.TT_WORD:
                 if (Util.equalsIgnoreCase("permission", st.sval)) { //$NON-NLS-1$
                     PermissionEntry pe = new PermissionEntry();
-                    if (st.nextToken() == StreamTokenizer.TT_WORD) {
+                    int tok = st.nextToken();
+                    if (tok == StreamTokenizer.TT_WORD || tok == '"') {
                         pe.klass = st.sval;
                         if (st.nextToken() == '"') {
                             pe.name = st.sval;

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/UnresolvedPrincipal.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/UnresolvedPrincipal.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/UnresolvedPrincipal.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/UnresolvedPrincipal.java Tue Jan 26 12:40:37 2010
@@ -52,7 +52,7 @@
     private final String name;
 
     /**
-     * Constructs a a new definition of a Principal with specified
+     * Constructs a new definition of a Principal with specified
      * parameters. 
      * @param klass fully qualified class name, may be wildcard
      * @param name name of principal, may be wildcard
@@ -140,4 +140,4 @@
     public String toString() {
         return "Principal " + klass + " \"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java Tue Jan 26 12:40:37 2010
@@ -72,7 +72,7 @@
      * Initializes this signature object with PrivateKey object 
      * passed as argument to the method.
      *
-     * @params
+     * @param
      *    privateKey DSAPrivateKey object
      * @throws
      *    InvalidKeyException if privateKey is not DSAPrivateKey object
@@ -119,7 +119,7 @@
      * Initializes this signature object with PublicKey object 
      * passed as argument to the method.
      *
-     * @params
+     * @param
      *    publicKey DSAPublicKey object
      * @throws
      *    InvalidKeyException if publicKey is not DSAPublicKey object
@@ -289,7 +289,7 @@
     /**
      * Updates data to sign or to verify.
      *
-     * @params
+     * @param
      *    b byte to update
      * @throws
      *    SignatureException if object was not initialized for signing or verifying
@@ -302,11 +302,11 @@
     /**
      * Updates data to sign or to verify.
      *
-     * @params
+     * @param
      *    b byte array containing bytes to update
-     * @params
+     * @param
      *    off offset in byte array to start from
-     * @params
+     * @param
      *    len number of bytes to use for updating
      * @throws
      *    SignatureException if object was not initialized for signing or verifying
@@ -392,7 +392,7 @@
     /**
      * Verifies the signature bytes.
      *
-     * @params
+     * @param
      *    sigBytes byte array with signature bytes to verify.
      * @return
      *    true if signature bytes were verified, false otherwise
@@ -413,11 +413,11 @@
     /**
      * Verifies the signature bytes.
      *
-     * @params
+     * @param
      *    sigBytes byte array with signature bytes to verify.
-     * @params
+     * @param
      *    offset index in sigBytes to start from
-     * @params
+     * @param
      *    length number of bytes allotted for signature
      * @return
      *    true if signature bytes were verified, false otherwise

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/JarUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/JarUtils.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/JarUtils.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/JarUtils.java Tue Jan 26 12:40:37 2010
@@ -38,6 +38,7 @@
 
 import javax.security.auth.x500.X500Principal;
 
+import org.apache.harmony.luni.util.InputStreamHelper;
 import org.apache.harmony.security.asn1.BerInputStream;
 import org.apache.harmony.security.internal.nls.Messages;
 import org.apache.harmony.security.pkcs7.ContentInfo;
@@ -144,8 +145,7 @@
         // Otherwise, compute the message digest on the data.
         List atr = sigInfo.getAuthenticatedAttributes();
 
-        byte[] sfBytes = new byte[signature.available()];
-        signature.read(sfBytes);
+        byte[] sfBytes = InputStreamHelper.readFullyAndClose(signature);
 
         if (atr == null) {
             sig.update(sfBytes);    

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.java Tue Jan 26 12:40:37 2010
@@ -76,4 +76,35 @@
 
         }
     }
-}
\ No newline at end of file
+
+    /**
+     * Test method tests the policy file with one of the entrie's
+     * permission_class_name surrounded with quotes.
+     * 
+     */
+    public void test_policyFileEntry_contains_Quotes1() throws Exception{
+        System.setProperty("java.security.policy", "resources/policyTest2.txt");
+        AccessController.checkPermission(new RuntimePermission("setSecurityManager"));
+    }
+    
+    /**
+     * Test method tests the policy file, one of the entrie's
+     * permission_class_name surrounded with quotes.
+     * 
+     */
+    public void test_policyFileEntry_contains_Quotes2() throws Exception{
+        class CustomSecurityMgr extends SecurityManager{
+            CustomSecurityMgr(){ }
+        }
+
+        System.setProperty("java.security.policy", "resources/policyTest2.txt");
+        SecurityManager security = System.getSecurityManager();
+        System.setSecurityManager(security);
+
+        // Setting the CustomSecurity Manager
+        SecurityManager customsecurity = new CustomSecurityMgr();
+        System.setSecurityManager(customsecurity);
+        customsecurity = System.getSecurityManager();
+        System.setSecurityManager(security);
+    }
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureClassLoader2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureClassLoader2Test.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureClassLoader2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureClassLoader2Test.java Tue Jan 26 12:40:37 2010
@@ -17,7 +17,6 @@
 
 package org.apache.harmony.security.tests.java.security;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -29,6 +28,8 @@
 import java.util.Enumeration;
 import java.util.jar.JarFile;
 
+import org.apache.harmony.luni.util.InputStreamHelper;
+
 import tests.support.Support_GetLocal;
 
 public class SecureClassLoader2Test extends junit.framework.TestCase {
@@ -61,47 +62,11 @@
 
         File file = Support_GetLocal.getLocalFile("hyts_security.jar");
         JarFile jar = new JarFile(file);
-        InputStream in = jar.getInputStream(jar
-                .getEntry("packA/SecurityTest.class"));
-        byte[] bytes = drain(in);
+        InputStream in = jar.getInputStream(jar.getEntry("packA/SecurityTest.class"));
+        byte[] bytes = InputStreamHelper.readFullyAndClose(in);
         Class c = myloader.define("packA.SecurityTest", bytes);
 		ProtectionDomain pd = c.getProtectionDomain();
 		assertNotNull("Expected dynamic policy", pd.getClassLoader());
 		assertNull("Expected null permissions", pd.getPermissions());
 	}
-
-    /*
-     * Drains the entire content from the given input stream and returns it as a
-     * byte[]. The stream is closed after being drained, or if an IOException
-     * occurs.
-     */
-    private byte[] drain(InputStream is) throws IOException {
-        try {
-            // Initial read
-            byte[] buffer = new byte[1024];
-            int count = is.read(buffer);
-            int nextByte = is.read();
-
-            // Did we get it all in one read?
-            if (nextByte == -1) {
-                byte[] dest = new byte[count];
-                System.arraycopy(buffer, 0, dest, 0, count);
-                return dest;
-            }
-
-            // Requires additional reads
-            ByteArrayOutputStream baos = new ByteArrayOutputStream(count * 2);
-            baos.write(buffer, 0, count);
-            baos.write(nextByte);
-            while (true) {
-                count = is.read(buffer);
-                if (count == -1) {
-                    return baos.toByteArray();
-                }
-                baos.write(buffer, 0, count);
-            }
-        } finally {
-            is.close();
-        }
-    }
 }
\ No newline at end of file

Modified: harmony/enhanced/classlib/branches/java6/modules/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java Tue Jan 26 12:40:37 2010
@@ -17,12 +17,11 @@
 
 package org.apache.harmony.sound.utils;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.InputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -31,6 +30,8 @@
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.harmony.luni.util.InputStreamHelper;
+
 public class ProviderService {
 
     // Properties from sound.propertie file
@@ -145,7 +146,7 @@
                             try {
                                 InputStream in = urls.nextElement()
                                         .openStream();
-                                bytes = getAllBytesFromStreamAndClose(in);
+                                bytes = InputStreamHelper.readFullyAndClose(in);
                             } catch (IOException e) {
                                 continue;
                             }
@@ -172,41 +173,5 @@
     public static Properties getSoundProperties() {
         return devices;
     }
-    
-    /*
-     * Drains the entire content from the given input stream and returns it as a
-     * byte[]. The stream is closed after being drained, or if an IOException
-     * occurs.
-     */
-    private static byte[] getAllBytesFromStreamAndClose(InputStream is)
-            throws IOException {
-        try {
-            // Initial read
-            byte[] buffer = new byte[512];
-            int count = is.read(buffer);
-            int nextByte = is.read();
-
-            // Did we get it all in one read?
-            if (nextByte == -1) {
-                byte[] dest = new byte[count];
-                System.arraycopy(buffer, 0, dest, 0, count);
-                return dest;
-            }
-
-            // Requires additional reads
-            ByteArrayOutputStream baos = new ByteArrayOutputStream(count * 2);
-            baos.write(buffer, 0, count);
-            baos.write(nextByte);
-            while (true) {
-                count = is.read(buffer);
-                if (count == -1) {
-                    return baos.toByteArray();
-                }
-                baos.write(buffer, 0, count);
-            }
-        } finally {
-            is.close();
-        }
-    }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLExceptionTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
Files harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLExceptionTest.java (original) and harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLExceptionTest.java Tue Jan 26 12:40:37 2010 differ

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLWarningTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLWarningTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
Files harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLWarningTest.java (original) and harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLWarningTest.java Tue Jan 26 12:40:37 2010 differ

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java Tue Jan 26 12:40:37 2010
@@ -970,6 +970,12 @@
         assertEquals(0, baseRowSet.getMaxRows());
         baseRowSet.setFetchSize(3);
         assertEquals("The fetch size should be set to 3.", 3, baseRowSet.getFetchSize());
+        try {
+            baseRowSet.setFetchSize(-1);
+            fail("should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
     }
     
     private static final class BaseRowSetImpl extends BaseRowSet {

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
Files harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java (original) and harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRequiredExceptionTest.java Tue Jan 26 12:40:37 2010 differ

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
Files harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java (original) and harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/transaction/TransactionRolledbackExceptionTest.java Tue Jan 26 12:40:37 2010 differ

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-885602
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/BasicSwingTestCase.java:768152-901560

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-885602
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/SwingTestCase.java:768152-901560

Propchange: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/parser/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 12:40:37 2010
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-885602
+/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/parser:768152-901560

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java?rev=903199&r1=903198&r2=903199&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/KeyStoreBuilderParameters.java Tue Jan 26 12:40:37 2010
@@ -27,7 +27,7 @@
  * {@code KeyStore.Builder}s.
  *
  * @since 1.5
- * @see KeyStore.Builder
+ * @see java.security.KeyStore.Builder
  */
 public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
 



Mime
View raw message