You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/01/31 11:04:22 UTC

svn commit: r617085 [11/14] - in /harmony/enhanced/classlib/branches/java6: depends/build/ depends/build/platform/ depends/libs/ depends/oss/ make/ make/linux.x86_64.libstdc++6/ make/windows.x86/ make/windows.x86_64/ modules/archive/META-INF/ modules/a...

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=617085&r1=617084&r2=617085&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 Thu Jan 31 02:04:05 2008
@@ -37,6 +37,12 @@
 		}
 	}
 
+    static class MockComparable implements Comparable{
+        public int compareTo(Object o) {
+            return 0;
+        }
+    }
+    
 	final static int arraySize = 100;
 
 	static Object[] objArray;
@@ -267,6 +273,18 @@
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(objectArray, new Integer(arraySize)) == -(arraySize + 1));
+        
+        Object object = new Object();
+        Object[] objects = new MockComparable[] { new MockComparable() };
+        assertEquals("Should always return 0", 0, Arrays.binarySearch(objects, object));
+
+        Object[] string_objects = new String[] { "one" };
+        try {
+            Arrays.binarySearch(string_objects, object);
+            fail("No expected ClassCastException");
+        } catch (ClassCastException e) {
+            // Expected
+        }
 	}
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CurrencyTest.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/CurrencyTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CurrencyTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CurrencyTest.java Thu Jan 31 02:04:05 2008
@@ -22,337 +22,336 @@
 
 public class CurrencyTest extends junit.framework.TestCase {
 
-	private static Locale defaultLocale = Locale.getDefault();
+    private static Locale defaultLocale = Locale.getDefault();
 
-	/**
-	 * @tests java.util.Currency#getInstance(java.lang.String)
-	 */
-	public void test_getInstanceLjava_lang_String() {
-		// see test_getInstanceLjava_util_Locale() tests
-	}
-
-	/**
-	 * @tests java.util.Currency#getInstance(java.util.Locale)
-	 */
-	public void test_getInstanceLjava_util_Locale() {
-		/*
-		 * the behaviour in all these three cases should be the same since this
-		 * method ignores language and variant component of the locale.
-		 */
-		Currency c0 = Currency.getInstance("CAD");
-		Currency c1 = Currency.getInstance(new Locale("en", "CA"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"en\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
-				c1 == c0);
-		Currency c2 = Currency.getInstance(new Locale("fr", "CA"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"fr\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
-				c2 == c0);
-		Currency c3 = Currency.getInstance(new Locale("", "CA"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
-				c3 == c0);
-
-		c0 = Currency.getInstance("JPY");
-		c1 = Currency.getInstance(new Locale("ja", "JP"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"ja\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
-				c1 == c0);
-		c2 = Currency.getInstance(new Locale("", "JP"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
-				c2 == c0);
-		c3 = Currency.getInstance(new Locale("bogus", "JP"));
-		assertTrue(
-				"Currency.getInstance(new Locale(\"bogus\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
-				c3 == c0);
-
-		Locale localeGu = new Locale("gu", "IN");
-		Currency cGu = Currency.getInstance(localeGu);
-		Locale localeKn = new Locale("kn", "IN");
-		Currency cKn = Currency.getInstance(localeKn);
-		assertTrue("Currency.getInstance(Locale_" + localeGu.toString() + "))"
-				+ "isn't equal to " + "Currency.getInstance(Locale_"
-				+ localeKn.toString() + "))", cGu == cKn);
-
-		// some teritories do not have currencies, like Antarctica
-		Locale loc = new Locale("", "AQ");
-		try {
-			Currency curr = Currency.getInstance(loc);
-			assertNull(
-					"Currency.getInstance(new Locale(\"\", \"AQ\")) did not return null",
-					curr);
-		} catch (IllegalArgumentException e) {
-			fail("Unexpected IllegalArgumentException " + e);
-		}
-
-		// unsupported/legacy iso3 countries
-		loc = new Locale("", "ZR");
-		try {
-			Currency curr = Currency.getInstance(loc);
-			fail("Expected IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-
-		loc = new Locale("", "ZAR");
-		try {
-			Currency curr = Currency.getInstance(loc);
-			fail("Expected IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-
-		loc = new Locale("", "FX");
-		try {
-			Currency curr = Currency.getInstance(loc);
-			fail("Expected IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-
-		loc = new Locale("", "FXX");
-		try {
-			Currency curr = Currency.getInstance(loc);
-			fail("Expected IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	/**
-	 * @tests java.util.Currency#getSymbol()
-	 */
-	public void test_getSymbol() {
-
-		Currency currK = Currency.getInstance("KRW");
-		Currency currI = Currency.getInstance("INR");
-		Currency currUS = Currency.getInstance("USD");
-
-		Locale.setDefault(Locale.US);
-		assertEquals("currK.getSymbol()", "KRW", currK.getSymbol());
-		assertEquals("currI.getSymbol()", "INR", currI.getSymbol());
-		assertEquals("currUS.getSymbol()", "$", currUS.getSymbol());
-
-		Locale.setDefault(new Locale("ko", "KR"));
-		assertEquals("currK.getSymbol()", "\uffe6", currK.getSymbol());
-		assertEquals("currI.getSymbol()", "INR", currI.getSymbol());
-		assertEquals("currUS.getSymbol()", "USD", currUS.getSymbol());
-
-		// test what happens if this is an invalid locale,
-		// one with Korean country but an India language
-		// this method should return the currency codes in that case
-		Locale.setDefault(new Locale("kr", "KR"));
-		assertEquals("currK.getSymbol()", "KRW", currK.getSymbol());
-		assertEquals("currI.getSymbol()", "INR", currI.getSymbol());
-		assertEquals("currUS.getSymbol()", "USD", currUS.getSymbol());
-	}
-
-	/**
-	 * @tests java.util.Currency#getSymbol(java.util.Locale)
-	 */
-	public void test_getSymbolLjava_util_Locale() {
-		Locale.setDefault(Locale.US);
-		Currency currE = Currency.getInstance("EUR");
-		assertEquals("EUR", currE.getSymbol(Locale.JAPAN));
-		assertEquals("EUR", currE.getSymbol(Locale.JAPANESE));
-		assertEquals("EUR", currE.getSymbol(new Locale("", "FR")));
-		assertEquals("\u20ac", currE.getSymbol(Locale.FRANCE));
-		assertEquals("EUR", currE.getSymbol(Locale.FRENCH));
-
-		Currency currJ = Currency.getInstance("JPY");
-		assertEquals("\uffe5", currJ.getSymbol(Locale.JAPAN));
-		assertEquals("JPY", currJ.getSymbol(Locale.JAPANESE));
-		assertEquals("JPY", currJ.getSymbol(Locale.FRANCE));
-		assertEquals("JPY", currJ.getSymbol(Locale.FRENCH));
-
-		Currency currUS = Currency.getInstance("USD");
-		assertEquals("USD", currUS.getSymbol(Locale.JAPAN));
-
-		Locale.setDefault(new Locale("ja", "JP"));
-		assertEquals("\uffe5", currJ.getSymbol(new Locale("", "JP")));
-		assertEquals("USD", currUS.getSymbol(new Locale("", "JP")));
-
-		Locale.setDefault(Locale.US);
-		assertEquals("JPY", currJ.getSymbol(new Locale("", "JP")));
-		assertEquals("$", currUS.getSymbol(new Locale("", "JP")));
-
-		assertEquals("USD", currUS.getSymbol(Locale.JAPANESE));
-		assertEquals("USD", currUS.getSymbol(Locale.FRANCE));
-		assertEquals("USD", currUS.getSymbol(Locale.FRENCH));
-		assertEquals("USD", currUS.getSymbol(new Locale("fr", "FR")));
-		assertEquals("$", currUS.getSymbol(new Locale("", "FR"))); // default
-		// locale
-
-		assertEquals("$", currUS.getSymbol(Locale.US));
-		assertEquals("USD", currUS.getSymbol(Locale.ENGLISH));
-
-		assertEquals("$", currUS.getSymbol(new Locale("en", "US")));
-		assertEquals("$", currUS.getSymbol(new Locale("", "US")));
-
-		Currency currCA = Currency.getInstance("CAD");
-		assertEquals("CAD", currCA.getSymbol(Locale.JAPAN));
-		assertEquals("CAD", currCA.getSymbol(Locale.JAPANESE));
-		assertEquals("CAD", currCA.getSymbol(Locale.FRANCE));
-		assertEquals("CAD", currCA.getSymbol(Locale.FRENCH));
-		assertEquals("CAD", currCA.getSymbol(Locale.US));
-		assertEquals("CAD", currCA.getSymbol(Locale.ENGLISH));
-		assertEquals("CAD", currCA.getSymbol(new Locale("es", "US")));
-		assertEquals("CAD", currCA.getSymbol(new Locale("en", "US")));
-
-		assertEquals("$", currCA.getSymbol(Locale.CANADA));
-		assertEquals("$", currCA.getSymbol(Locale.CANADA_FRENCH));
-		assertEquals("$", currCA.getSymbol(new Locale("en", "CA")));
-		assertEquals("$", currCA.getSymbol(new Locale("fr", "CA")));
-		assertEquals("CAD", currCA.getSymbol(new Locale("", "CA")));
-
-		// tests what happens with improper locales, i.e. countries without the
-		// given language
-		assertEquals("currUS.getSymbol(new Locale(\"ar\", \"US\"))", "USD",
-				currUS.getSymbol(new Locale("ar", "US")));
-		assertEquals("currUS.getSymbol(new Locale(\"ar\", \"CA\"))", "USD",
-				currUS.getSymbol(new Locale("ar", "CA")));
-		assertEquals("currCA.getSymbol(new Locale(\"ar\", \"US\"))", "CAD",
-				currCA.getSymbol(new Locale("ar", "US")));
-		assertEquals("currCA.getSymbol(new Locale(\"ar\", \"CA\"))", "CAD",
-				currCA.getSymbol(new Locale("ar", "CA")));
-		assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "JPY",
-				currJ.getSymbol(new Locale("ja", "US")));
-		assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "USD",
-				currUS.getSymbol(new Locale("ja", "US")));
-
-		// cross testing between USD and JPY when locale is JAPANESE JAPAN
-
-		// set default locale to Locale_ja_JP
-		Locale.setDefault(new Locale("ja", "JP"));
-
-		Currency currJ2 = Currency.getInstance("JPY");
-		Currency currUS2 = Currency.getInstance("USD");
-
-		// the real JAPAN locale
-		assertEquals("\uffe5", currJ2.getSymbol(new Locale("ja", "JP")));
-
-		// no language
-		assertEquals("\uffe5", currJ2.getSymbol(new Locale("", "JP")));
-
-		// no country
-		assertEquals("JPY", currJ2.getSymbol(new Locale("ja", "")));
-
-		// no language
-		assertEquals("\uffe5", currJ2.getSymbol(new Locale("", "US")));
-
-		// no country
-		assertEquals("JPY", currJ2.getSymbol(new Locale("en", "")));
-
-		// bogus Locales , when default locale is Locale_ja_JP
-		assertEquals("JPY", currJ2.getSymbol(new Locale("ar", "JP")));
-		assertEquals("JPY", currJ2.getSymbol(new Locale("ar", "US")));
-		assertEquals("JPY", currJ2.getSymbol(new Locale("ja", "AE")));
-		assertEquals("JPY", currJ2.getSymbol(new Locale("en", "AE")));
-		assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "JPY",
-				currJ.getSymbol(new Locale("ja", "US")));
-
-		// the real US locale
-		assertEquals("$", currUS2.getSymbol(new Locale("en", "US")));
-
-		// no country
-		assertEquals("USD", currUS2.getSymbol(new Locale("ja", "")));
-
-		// no language
-		assertEquals("USD", currUS2.getSymbol(new Locale("", "JP")));
-
-		// no language
-		assertEquals("USD", currUS2.getSymbol(new Locale("", "US")));
-
-		// no country
-		assertEquals("USD", currUS2.getSymbol(new Locale("en", "")));
-
-		// bogus Locales , when default locale is Locale_ja_JP
-		assertEquals("USD", currUS2.getSymbol(new Locale("ar", "JP")));
-		assertEquals("USD", currUS2.getSymbol(new Locale("ar", "US")));
-		assertEquals("USD", currUS2.getSymbol(new Locale("ja", "AE")));
-		assertEquals("USD", currUS2.getSymbol(new Locale("en", "AE")));
-		assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "USD",
-				currUS.getSymbol(new Locale("ja", "US")));
-
-		Locale.setDefault(Locale.US);
-
-		// euro tests
-		Currency currDKK = Currency.getInstance("DKK");
-		assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
-		assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
-
-		assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
-		assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
-
-		assertEquals("EUR", currE.getSymbol(new Locale("", "DK")));
-		assertEquals("DKK", currDKK.getSymbol(new Locale("", "DK")));
-
-		Locale.setDefault(new Locale("da", "DK"));
-		assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
-		assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
-
-		assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
-		assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
-
-		assertEquals("\u20ac", currE.getSymbol(new Locale("", "DK")));
-		assertEquals("kr", currDKK.getSymbol(new Locale("", "DK")));
-
-		assertEquals("EUR", currE.getSymbol(new Locale("ar", "AE")));
-		assertEquals("DKK", currDKK.getSymbol(new Locale("ar", "AE")));
-	}
-
-	/**
-	 * @tests java.util.Currency#getDefaultFractionDigits()
-	 */
-	public void test_getDefaultFractionDigits() {
-		Currency c1 = Currency.getInstance("EUR");
-		c1.getDefaultFractionDigits();
-		assertEquals(" Currency.getInstance(\"" + c1
-				+ "\") returned incorrect number of digits. ", 2, c1
-				.getDefaultFractionDigits());
-
-		Currency c2 = Currency.getInstance("JPY");
-		c2.getDefaultFractionDigits();
-		assertEquals(" Currency.getInstance(\"" + c2
-				+ "\") returned incorrect number of digits. ", 0, c2
-				.getDefaultFractionDigits());
-
-		Currency c3 = Currency.getInstance("XBD");
-		c3.getDefaultFractionDigits();
-		assertEquals(" Currency.getInstance(\"" + c3
-				+ "\") returned incorrect number of digits. ", -1, c3
-				.getDefaultFractionDigits());
-
-	}
-
-	protected void setUp() {
-		Locale.setDefault(defaultLocale);
-	}
-
-	protected void tearDown() {
-	}
-
-	/**
-	 * Helper method to display Currency info
-	 * 
-	 * @param c
-	 */
-	private void printCurrency(Currency c) {
-		System.out.println();
-		System.out.println(c.getCurrencyCode());
-		System.out.println(c.getSymbol());
-		System.out.println(c.getDefaultFractionDigits());
-	}
-
-	/**
-	 * helper method to display Locale info
-	 */
-	private static void printLocale(Locale loc) {
-		System.out.println();
-		System.out.println(loc.getDisplayName());
-		System.out.println(loc.getCountry());
-		System.out.println(loc.getLanguage());
-		System.out.println(loc.getDisplayCountry());
-		System.out.println(loc.getDisplayLanguage());
-		System.out.println(loc.getDisplayName());
-		System.out.println(loc.getISO3Country());
-		System.out.println(loc.getISO3Language());
-	}
+    /**
+     * @tests java.util.Currency#getInstance(java.lang.String)
+     */
+    public void test_getInstanceLjava_lang_String() {
+        // see test_getInstanceLjava_util_Locale() tests
+    }
+
+    /**
+     * @tests java.util.Currency#getInstance(java.util.Locale)
+     */
+    public void test_getInstanceLjava_util_Locale() {
+        /*
+         * the behaviour in all these three cases should be the same since this
+         * method ignores language and variant component of the locale.
+         */
+        Currency c0 = Currency.getInstance("CAD");
+        Currency c1 = Currency.getInstance(new Locale("en", "CA"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"en\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
+                c1 == c0);
+        Currency c2 = Currency.getInstance(new Locale("fr", "CA"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"fr\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
+                c2 == c0);
+        Currency c3 = Currency.getInstance(new Locale("", "CA"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"\",\"CA\")) isn't equal to Currency.getInstance(\"CAD\")",
+                c3 == c0);
+
+        c0 = Currency.getInstance("JPY");
+        c1 = Currency.getInstance(new Locale("ja", "JP"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"ja\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
+                c1 == c0);
+        c2 = Currency.getInstance(new Locale("", "JP"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
+                c2 == c0);
+        c3 = Currency.getInstance(new Locale("bogus", "JP"));
+        assertTrue(
+                "Currency.getInstance(new Locale(\"bogus\",\"JP\")) isn't equal to Currency.getInstance(\"JPY\")",
+                c3 == c0);
+
+        Locale localeGu = new Locale("gu", "IN");
+        Currency cGu = Currency.getInstance(localeGu);
+        Locale localeKn = new Locale("kn", "IN");
+        Currency cKn = Currency.getInstance(localeKn);
+        assertTrue("Currency.getInstance(Locale_" + localeGu.toString() + "))"
+                + "isn't equal to " + "Currency.getInstance(Locale_"
+                + localeKn.toString() + "))", cGu == cKn);
+
+        // some territories do not have currencies, like Antarctica(AQ)
+        Locale loc = new Locale("", "AQ");
+        Currency curr = Currency.getInstance(loc);
+        assertNull(curr);
+        
+        try {
+            Currency.getInstance((Locale) null);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        
+        try {
+            Currency.getInstance(new Locale("ABC","DEF"));
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+        
+        // unsupported/legacy iso3 countries
+        // RI does not support them.
+        loc = new Locale("", "ZR");
+        Currency.getInstance(loc);
+
+        loc = new Locale("", "ZAR");
+        Currency.getInstance(loc);
+
+        loc = new Locale("", "FX");
+        Currency.getInstance(loc);
+
+        loc = new Locale("", "FXX");
+        Currency.getInstance(loc);
+    }
+
+    /**
+     * @tests java.util.Currency#getSymbol()
+     */
+    public void test_getSymbol() {
+
+        Currency currK = Currency.getInstance("KRW");
+        Currency currI = Currency.getInstance("INR");
+        Currency currUS = Currency.getInstance("USD");
+
+        Locale.setDefault(Locale.US);
+        assertEquals("currK.getSymbol()", "KRW", currK.getSymbol());
+        // Some non-bug differences below because of CLDR data.
+        assertEquals("currI.getSymbol()", "0#Rs.|1#Re.|1<Rs.", currI
+                .getSymbol());
+        assertEquals("currUS.getSymbol()", "$", currUS.getSymbol());
+
+        Locale.setDefault(new Locale("ko", "KR"));
+        assertEquals("currK.getSymbol()", "\uffe6", currK.getSymbol());
+        assertEquals("currI.getSymbol()", "0#Rs.|1#Re.|1<Rs.", currI
+                .getSymbol());
+        assertEquals("currUS.getSymbol()", "US$", currUS.getSymbol());
+
+        // test what happens if this is an invalid locale,
+        // one with Korean country but an India language
+        // this method should return the currency codes in that case
+        Locale.setDefault(new Locale("kr", "KR"));
+        assertEquals("currK.getSymbol()", "KRW", currK.getSymbol());
+        assertEquals("currI.getSymbol()", "0#Rs.|1#Re.|1<Rs.", currI
+                .getSymbol());
+        assertEquals("currUS.getSymbol()", "US$", currUS.getSymbol());
+    }
+
+    /**
+     * @tests java.util.Currency#getSymbol(java.util.Locale)
+     */
+    public void test_getSymbolLjava_util_Locale() {
+        Locale.setDefault(Locale.US);
+        Currency currE = Currency.getInstance("EUR");
+        // Some non-bug differences below because of CLDR data.
+        assertEquals("\u20ac", currE.getSymbol(Locale.JAPAN));
+        assertEquals("EUR", currE.getSymbol(Locale.JAPANESE));
+        assertEquals("\u20ac", currE.getSymbol(new Locale("", "FR")));
+        assertEquals("\u20ac", currE.getSymbol(Locale.FRANCE));
+        assertEquals("EUR", currE.getSymbol(Locale.FRENCH));
+
+        Currency currJ = Currency.getInstance("JPY");
+        assertEquals("\uffe5", currJ.getSymbol(Locale.JAPAN));
+        assertEquals("JPY", currJ.getSymbol(Locale.JAPANESE));
+        assertEquals("\u00a5JP", currJ.getSymbol(Locale.FRANCE));
+        assertEquals("JPY", currJ.getSymbol(Locale.FRENCH));
+
+        Currency currUS = Currency.getInstance("USD");
+        assertEquals("US$", currUS.getSymbol(Locale.JAPAN));
+
+        Locale.setDefault(new Locale("ja", "JP"));
+        assertEquals("JP\u00a5", currJ.getSymbol(new Locale("", "JP")));
+        assertEquals("US$", currUS.getSymbol(new Locale("", "JP")));
+
+        Locale.setDefault(Locale.US);
+        assertEquals("JP\u00a5", currJ.getSymbol(new Locale("", "JP")));
+        assertEquals("US$", currUS.getSymbol(new Locale("", "JP")));
+
+        assertEquals("USD", currUS.getSymbol(Locale.JAPANESE));
+        assertEquals("$US", currUS.getSymbol(Locale.FRANCE));
+        assertEquals("USD", currUS.getSymbol(Locale.FRENCH));
+        assertEquals("$US", currUS.getSymbol(new Locale("fr", "FR")));
+        assertEquals("US$", currUS.getSymbol(new Locale("", "FR"))); // default
+        // locale
+
+        assertEquals("$", currUS.getSymbol(Locale.US));
+        assertEquals("USD", currUS.getSymbol(Locale.ENGLISH));
+
+        assertEquals("$", currUS.getSymbol(new Locale("en", "US")));
+        assertEquals("US$", currUS.getSymbol(new Locale("", "US")));
+
+        Currency currCA = Currency.getInstance("CAD");
+        assertEquals("CAD", currCA.getSymbol(Locale.JAPAN));
+        assertEquals("CAD", currCA.getSymbol(Locale.JAPANESE));
+        assertEquals("$Ca", currCA.getSymbol(Locale.FRANCE));
+        assertEquals("CAD", currCA.getSymbol(Locale.FRENCH));
+        assertEquals("Can$", currCA.getSymbol(Locale.US));
+        assertEquals("CAD", currCA.getSymbol(Locale.ENGLISH));
+        assertEquals("Can$", currCA.getSymbol(new Locale("es", "US")));
+        assertEquals("Can$", currCA.getSymbol(new Locale("en", "US")));
+
+        assertEquals("$", currCA.getSymbol(Locale.CANADA));
+        assertEquals("$", currCA.getSymbol(Locale.CANADA_FRENCH));
+        assertEquals("$", currCA.getSymbol(new Locale("en", "CA")));
+        assertEquals("$", currCA.getSymbol(new Locale("fr", "CA")));
+        assertEquals("CAD", currCA.getSymbol(new Locale("", "CA")));
+
+        // tests what happens with improper locales, i.e. countries without the
+        // given language
+        assertEquals("currUS.getSymbol(new Locale(\"ar\", \"US\"))", "US$",
+                currUS.getSymbol(new Locale("ar", "US")));
+        assertEquals("currUS.getSymbol(new Locale(\"ar\", \"CA\"))", "US$",
+                currUS.getSymbol(new Locale("ar", "CA")));
+        assertEquals("currCA.getSymbol(new Locale(\"ar\", \"US\"))", "CAD",
+                currCA.getSymbol(new Locale("ar", "US")));
+        assertEquals("currCA.getSymbol(new Locale(\"ar\", \"CA\"))", "CAD",
+                currCA.getSymbol(new Locale("ar", "CA")));
+        assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "\uffe5",
+                currJ.getSymbol(new Locale("ja", "US")));
+        assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "US$",
+                currUS.getSymbol(new Locale("ja", "US")));
+
+        // cross testing between USD and JPY when locale is JAPANESE JAPAN
+
+        // set default locale to Locale_ja_JP
+        Locale.setDefault(new Locale("ja", "JP"));
+
+        Currency currJ2 = Currency.getInstance("JPY");
+        Currency currUS2 = Currency.getInstance("USD");
+
+        // the real JAPAN locale
+        assertEquals("\uffe5", currJ2.getSymbol(new Locale("ja", "JP")));
+
+        // no language
+        assertEquals("JP\u00a5", currJ2.getSymbol(new Locale("", "JP")));
+
+        // no country
+        assertEquals("JPY", currJ2.getSymbol(new Locale("ja", "")));
+
+        // no language
+        assertEquals("JP\u00a5", currJ2.getSymbol(new Locale("", "US")));
+
+        // no country
+        assertEquals("JPY", currJ2.getSymbol(new Locale("en", "")));
+
+        // bogus Locales , when default locale is Locale_ja_JP
+        assertEquals("JP\u00a5", currJ2.getSymbol(new Locale("ar", "JP")));
+        assertEquals("JP\u00a5", currJ2.getSymbol(new Locale("ar", "US")));
+        assertEquals("\uffe5", currJ2.getSymbol(new Locale("ja", "AE")));
+        assertEquals("\u00a5", currJ2.getSymbol(new Locale("en", "AE")));
+        assertEquals("currJ.getSymbol(new Locale(\"ja\", \"US\"))", "\uffe5",
+                currJ.getSymbol(new Locale("ja", "US")));
+
+        // the real US locale
+        assertEquals("$", currUS2.getSymbol(new Locale("en", "US")));
+
+        // no country
+        assertEquals("USD", currUS2.getSymbol(new Locale("ja", "")));
+
+        // no language
+        assertEquals("US$", currUS2.getSymbol(new Locale("", "JP")));
+
+        // no language
+        assertEquals("US$", currUS2.getSymbol(new Locale("", "US")));
+
+        // no country
+        assertEquals("USD", currUS2.getSymbol(new Locale("en", "")));
+
+        // bogus Locales , when default locale is Locale_ja_JP
+        assertEquals("US$", currUS2.getSymbol(new Locale("ar", "JP")));
+        assertEquals("US$", currUS2.getSymbol(new Locale("ar", "US")));
+        assertEquals("US$", currUS2.getSymbol(new Locale("ja", "AE")));
+        assertEquals("$", currUS2.getSymbol(new Locale("en", "AE")));
+        assertEquals("currUS.getSymbol(new Locale(\"ja\", \"US\"))", "US$",
+                currUS.getSymbol(new Locale("ja", "US")));
+
+        Locale.setDefault(Locale.US);
+
+        // euro tests
+        Currency currDKK = Currency.getInstance("DKK");
+        assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
+        assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
+
+        assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
+        assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
+
+        assertEquals("\u20ac", currE.getSymbol(new Locale("", "DK")));
+        assertEquals("DKK", currDKK.getSymbol(new Locale("", "DK")));
+
+        Locale.setDefault(new Locale("da", "DK"));
+        assertEquals("\u20ac", currE.getSymbol(new Locale("da", "DK")));
+        assertEquals("kr", currDKK.getSymbol(new Locale("da", "DK")));
+
+        assertEquals("EUR", currE.getSymbol(new Locale("da", "")));
+        assertEquals("DKK", currDKK.getSymbol(new Locale("da", "")));
+
+        assertEquals("\u20ac", currE.getSymbol(new Locale("", "DK")));
+        assertEquals("DKK", currDKK.getSymbol(new Locale("", "DK")));
+
+        assertEquals("\u20ac", currE.getSymbol(new Locale("ar", "AE")));
+        assertEquals("DKK", currDKK.getSymbol(new Locale("ar", "AE")));
+    }
+
+    /**
+     * @tests java.util.Currency#getDefaultFractionDigits()
+     */
+    public void test_getDefaultFractionDigits() {
+        Currency c1 = Currency.getInstance("EUR");
+        c1.getDefaultFractionDigits();
+        assertEquals(" Currency.getInstance(\"" + c1
+                + "\") returned incorrect number of digits. ", 2, c1
+                .getDefaultFractionDigits());
+
+        Currency c2 = Currency.getInstance("JPY");
+        c2.getDefaultFractionDigits();
+        assertEquals(" Currency.getInstance(\"" + c2
+                + "\") returned incorrect number of digits. ", 0, c2
+                .getDefaultFractionDigits());
+
+        Currency c3 = Currency.getInstance("XBD");
+        // A non-bug differences below because of CLDR data.
+        c3.getDefaultFractionDigits();
+        assertEquals(" Currency.getInstance(\"" + c3
+                + "\") returned incorrect number of digits. ", 2, c3
+                .getDefaultFractionDigits());
+
+    }
+
+    protected void setUp() {
+        Locale.setDefault(defaultLocale);
+    }
+
+    protected void tearDown() {
+    }
+
+    /**
+     * Helper method to display Currency info
+     * 
+     * @param c
+     */
+    private void printCurrency(Currency c) {
+        System.out.println();
+        System.out.println(c.getCurrencyCode());
+        System.out.println(c.getSymbol());
+        System.out.println(c.getDefaultFractionDigits());
+    }
+
+    /**
+     * helper method to display Locale info
+     */
+    private static void printLocale(Locale loc) {
+        System.out.println();
+        System.out.println(loc.getDisplayName());
+        System.out.println(loc.getCountry());
+        System.out.println(loc.getLanguage());
+        System.out.println(loc.getDisplayCountry());
+        System.out.println(loc.getDisplayLanguage());
+        System.out.println(loc.getDisplayName());
+        System.out.println(loc.getISO3Country());
+        System.out.println(loc.getISO3Language());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.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/GregorianCalendarTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java Thu Jan 31 02:04:05 2008
@@ -674,20 +674,21 @@
      */
     public void test_getMinimalDaysInFirstWeek() {
         // Regression for Harmony-1037
+        // Some non-bug differences below because of different CLDR data of Harmony
         GregorianCalendar g = new GregorianCalendar(TimeZone
                 .getTimeZone("Europe/London"), new Locale("en", "GB"));
         int minimalDaysInFirstWeek = g.getMinimalDaysInFirstWeek();
-        assertEquals(4, minimalDaysInFirstWeek);
+        assertEquals(1, minimalDaysInFirstWeek);
 
         g = new GregorianCalendar(TimeZone.getTimeZone("Europe/London"),
                 new Locale("fr"));
         minimalDaysInFirstWeek = g.getMinimalDaysInFirstWeek();
-        assertEquals(4, minimalDaysInFirstWeek);
+        assertEquals(1, minimalDaysInFirstWeek);
         
         g = new GregorianCalendar(TimeZone.getTimeZone("Europe/London"),
                 new Locale("fr", "CA"));
         minimalDaysInFirstWeek = g.getMinimalDaysInFirstWeek();
-        assertEquals(1, minimalDaysInFirstWeek);
+        assertEquals(4, minimalDaysInFirstWeek);
 
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/LocaleTest.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/LocaleTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/LocaleTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/LocaleTest.java Thu Jan 31 02:04:05 2008
@@ -102,7 +102,8 @@
         // regression test for HARMONY-1514
         // HashSet can filter duplicate locales
         Set<Locale> localesSet = new HashSet<Locale>(Arrays.asList(locales));
-        assertEquals(localesSet.size(), locales.length);
+        // Non-bug difference for HARMONY-5442
+        assertTrue(localesSet.size() <= locales.length);
     }
 
 	/**
@@ -137,8 +138,9 @@
 				.getDisplayCountry().equals("Canada"));
         
         // Regression for Harmony-1146
+        // Non-bug difference for HARMONY-5442
         Locale l_countryCD = new Locale("", "CD"); //$NON-NLS-1$ //$NON-NLS-2$
-                assertEquals("The Democratic Republic Of Congo", //$NON-NLS-1$
+                assertEquals("Congo - Kinshasa", //$NON-NLS-1$
                         l_countryCD.getDisplayCountry()); 
 	}
 
@@ -254,8 +256,10 @@
         assertEquals("ave", l.getISO3Language());
         
         // Regression for Harmony-1146
+        
+        // Non-bug difference for HARMONY-5442
         Locale l_CountryCS = new Locale("", "CS"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertEquals("SCG", l_CountryCS.getISO3Country()); //$NON-NLS-1$
+        assertEquals("", l_CountryCS.getISO3Country()); //$NON-NLS-1$
         
         // Regression for Harmony-1129
         l = new Locale("ak", ""); //$NON-NLS-1$ //$NON-NLS-2$
@@ -294,10 +298,10 @@
 		// Assumes always at least 131 ISOlanguages...
 		String[] isoLang = Locale.getISOLanguages();
 		int length = isoLang.length;
-		assertTrue("Random element in wrong format.", (isoLang[length / 2]
-				.length() == 2)
-				&& isoLang[length / 2].toLowerCase()
-						.equals(isoLang[length / 2]));
+		
+		// Non-bug difference for HARMONY-5442
+		assertTrue(isoLang[length / 2].length() == 3);
+		assertTrue(isoLang[length / 2].toLowerCase().equals(isoLang[length / 2]));
 		assertTrue("Wrong number of ISOLanguages.", length > 130);
 	}
 
@@ -351,10 +355,12 @@
 		assertEquals("Wrong representation 1", "en", l.toString());
 		l = new Locale("", "CA");
 		assertEquals("Wrong representation 2", "_CA", l.toString());
+		
+		// Non-bug difference for HARMONY-5442
 		l = new Locale("", "CA", "var");
-		assertEquals("Wrong representation 2.5", "_CA_var", l.toString());
+		assertEquals("Wrong representation 2.5", "_CA_VAR", l.toString());
 		l = new Locale("en", "", "WIN");
-		assertEquals("Wrong representation 4", "en__WIN", l.toString());
+		assertEquals("Wrong representation 4", "en_WIN", l.toString());
 		l = new Locale("en", "CA");
 		assertEquals("Wrong representation 6", "en_CA", l.toString());
 		l = new Locale("en", "CA", "VAR");
@@ -375,9 +381,10 @@
 
         List<String> languages = Arrays.asList(Locale.getISOLanguages());
         assertTrue(languages.contains("ak"));
-
+        
+		// Non-bug difference for HARMONY-5442
         List<String> countries = Arrays.asList(Locale.getISOCountries());
-        assertTrue(countries.contains("CS"));
+        assertFalse(countries.contains("CS"));
     }
     
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.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/ScannerTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java Thu Jan 31 02:04:05 2008
@@ -18,6 +18,7 @@
 import java.io.Closeable;
 import java.io.EOFException;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -34,7 +35,6 @@
 import java.nio.CharBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.ReadableByteChannel;
-import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 import java.nio.charset.Charset;
 import java.util.Arrays;
@@ -45,8 +45,6 @@
 import java.util.regex.MatchResult;
 import java.util.regex.Pattern;
 
-import tests.support.Support_PortManager;
-
 import junit.framework.TestCase;
 
 public class ScannerTest extends TestCase {
@@ -271,7 +269,25 @@
             // expected
         }
 
-        // TODO: test if the default charset is used.
+        // Test if the default charset is used.
+        String sampleData = "1 2 3 4 5 6 7 8 9 10";
+        File tempFile = File.createTempFile("harmony", "test");
+        tempFile.deleteOnExit();
+        FileOutputStream os = new FileOutputStream(tempFile);
+        os.write(sampleData.getBytes());
+        os.close();
+
+        FileInputStream is = new FileInputStream(tempFile);
+        FileChannel channel = is.getChannel();
+
+        Scanner s = new Scanner(channel);
+        int count = 0;
+        while (s.hasNextInt()) {
+            s.nextInt();
+            count++;
+        }
+        channel.close();
+        assertEquals(10, count);
     }
 
     /**
@@ -5676,31 +5692,4 @@
             // do nothing
         }
     }
-    
-    /**
-     * @tests java.util.Scanner#Scanner(ReadableByteChannel)
-     */   
-    public void test_Constructor_LReadableByteChannel()
-			throws IOException {
-		InetSocketAddress localAddr = new InetSocketAddress("127.0.0.1",
-				Support_PortManager.getNextPort());
-		ServerSocketChannel ssc = ServerSocketChannel.open();
-		ssc.socket().bind(localAddr);
-
-		SocketChannel sc = SocketChannel.open();
-		sc.connect(localAddr);
-		sc.configureBlocking(false);
-		assertFalse(sc.isBlocking());
-
-		ssc.accept().close();
-		ssc.close();
-		assertFalse(sc.isBlocking());
-
-		Scanner s = new Scanner(sc);
-		while (s.hasNextInt()) {
-			s.nextInt();
-		}
-
-		sc.close();
-	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/StackTest.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/StackTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/StackTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/StackTest.java Thu Jan 31 02:04:05 2008
@@ -184,6 +184,7 @@
 		testStack.setLength(20);
 		try{
 			testStack.pop();
+			fail("Should throw ArrayIndexOutOfBoundsException here");
 		}
 		catch(ArrayIndexOutOfBoundsException e)
 		{

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ByteBuffer.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ByteBuffer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/java/nio/ByteBuffer.java Thu Jan 31 02:04:05 2008
@@ -718,7 +718,7 @@
      * 
      * @param byteOrder
      *            The byte order to set. If <code>null</code> then the order
-     *            will be {@link ByteOrder.LITTLE_ENDIAN LITTLE_ENDIAN}.
+     *            will be {@link ByteOrder#LITTLE_ENDIAN LITTLE_ENDIAN}.
      * @return This buffer
      * @see ByteOrder
      */

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttrDefinitionBands.java Thu Jan 31 02:04:05 2008
@@ -26,14 +26,14 @@
 
     private int[] attributeDefinitionHeader;
 
-    private String[] attributeDefinitionLayout;    
+    private String[] attributeDefinitionLayout;
 
     private String[] attributeDefinitionName;
 
     private AttributeLayoutMap attributeDefinitionMap;
 
     private String[] cpUTF8;
-    
+
     public AttrDefinitionBands(Segment segment) {
         super(segment);
         this.cpUTF8 = segment.getCpBands().getCpUTF8();
@@ -51,9 +51,9 @@
                 Codec.UNSIGNED5, attributeDefinitionCount, cpUTF8);
         attributeDefinitionLayout = parseReferences("attr_definition_layout",
                 in, Codec.UNSIGNED5, attributeDefinitionCount, cpUTF8);
-        
+
         attributeDefinitionMap = new AttributeLayoutMap();
-        
+
         int overflowIndex = 32;
         if(segment.getSegmentHeader().getOptions().hasClassFlagsHi()) {
             overflowIndex = 63;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java Thu Jan 31 02:04:05 2008
@@ -87,8 +87,8 @@
 		}
 		throw new Pack200Exception("Unknown layout encoding: " + layout);
 	}
-    
-    
+
+
     private int context;
 
     private int index;
@@ -96,11 +96,11 @@
 	private final String layout;
 
 	private long mask;
-    
+
     private String name;
     private boolean isDefault;
     private int backwardsCallCount;
-    
+
 
     /**
      * Construct a default AttributeLayout
@@ -115,7 +115,7 @@
 			throws Pack200Exception {
 		this(name, context, layout, index, true);
 	}
-    
+
     public AttributeLayout(String name, int context, String layout, int index,
             boolean isDefault) throws Pack200Exception {
         super();
@@ -138,8 +138,8 @@
         this.layout = layout;
         this.isDefault = isDefault;
     }
-    
-    
+
+
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;
@@ -153,7 +153,7 @@
 				return false;
 		} else if (!layout.equals(other.layout))
 			return false;
-        if(index != other.index) 
+        if(index != other.index)
             return false;
         if(context != other.context)
             return false;
@@ -258,7 +258,7 @@
     public String getName() {
         return name;
     }
-    
+
     public int numBackwardsCallables() {
         if(layout == "*") {
             return 1;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java Thu Jan 31 02:04:05 2008
@@ -26,7 +26,7 @@
  * internationalized, and should not be translated.
  */
 public class AttributeLayoutMap {
-    
+
 	// Create all the default AttributeLayouts here
 	private static AttributeLayout[] getDefaultAttributeLayouts()
 			throws Pack200Exception {
@@ -193,13 +193,13 @@
     private final Map fieldLayouts = new HashMap();
     private final Map methodLayouts = new HashMap();
     private final Map codeLayouts = new HashMap();
-    
+
     // The order of the maps in this array should not be changed as their indices correspond to
     // the value of their context constants (AttributeLayout.CONTEXT_CLASS etc.)
     private final Map[] layouts = new Map[] {classLayouts, fieldLayouts, methodLayouts, codeLayouts};
 
     private final Map layoutsToBands = new HashMap();
-    
+
 	public AttributeLayoutMap() throws Pack200Exception {
 		AttributeLayout[] defaultAttributeLayouts = getDefaultAttributeLayouts();
 		for (int i = 0; i < defaultAttributeLayouts.length; i++) {
@@ -210,7 +210,7 @@
 	public void add(AttributeLayout layout) {
         layouts[layout.getContext()].put(new Integer(layout.getIndex()), layout);
 	}
-    
+
 
 
     public void add(AttributeLayout layout, NewAttributeBands newBands) {
@@ -225,21 +225,21 @@
             AttributeLayout layout = (AttributeLayout) iter.next();
             if(layout.getName().equals(name)) {
                 return layout;
-            }            
+            }
         }
         return null;
 	}
-    
+
     public AttributeLayout getAttributeLayout(int index, int context)
             throws Pack200Exception {
         Map map = layouts[context];
         return (AttributeLayout) map.get(new Integer(index));
     }
-    
+
     /**
      * The map should not contain the same layout and name combination more than
      * once for each context.
-     * @throws Pack200Exception 
+     * @throws Pack200Exception
      *
      */
     public void checkMap() throws Pack200Exception {
@@ -271,5 +271,5 @@
     public NewAttributeBands getAttributeBands(AttributeLayout layout) {
         return (NewAttributeBands) layoutsToBands.get(layout);
     }
-    
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java Thu Jan 31 02:04:05 2008
@@ -25,7 +25,7 @@
 /**
  * TODO Comment -- quite a lot can be nicked from Codec, since this was created
  * from it
- *  
+ *
  */
 public final class BHSDCodec extends Codec {
 
@@ -53,12 +53,12 @@
 	 * Represents signed numbers or not (0=unsigned,1/2=signed)
 	 */
 	private int s;
-    
+
     private long cardinality;
 
 	/**
 	 * Constructs an unsigned, non-delta Codec with the given B and H values.
-	 * 
+	 *
 	 * @param b
 	 *            the maximum number of bytes that a value can be encoded as
 	 *            [1..5]
@@ -71,7 +71,7 @@
 
 	/**
 	 * Constructs a non-delta Codec with the given B, H and S values.
-	 * 
+	 *
 	 * @param b
 	 *            the maximum number of bytes that a value can be encoded as
 	 *            [1..5]
@@ -87,7 +87,7 @@
 
 	/**
 	 * Constructs a Codec with the given B, H, S and D values.
-	 * 
+	 *
 	 * @param b
 	 *            the maximum number of bytes that a value can be encoded as
 	 *            [1..5]
@@ -128,14 +128,14 @@
 	/**
 	 * Returns the cardinality of this codec; that is, the number of distinct
 	 * values that it can contain.
-	 * 
+	 *
 	 * @return the cardinality of this codec
 	 */
 	public long cardinality() {
 		return cardinality;
 	}
 
-	
+
 	public long decode(InputStream in) throws IOException, Pack200Exception {
 		if (d != 0)
 			throw new Pack200Exception(
@@ -143,7 +143,7 @@
 		return decode(in, 0);
 	}
 
-	
+
 	public long decode(InputStream in, long last) throws IOException,
 			Pack200Exception {
 		int n = 0;
@@ -172,10 +172,10 @@
             double twoPowSMinusOne = twoPowS-1;
             if(u % twoPowS < twoPowSMinusOne) {
                 if(cardinality < Math.pow(2, 32)) {
-                    z = (long) (u - (Math.floor(u/ twoPowS)));                    
+                    z = (long) (u - (Math.floor(u/ twoPowS)));
                 } else {
                     z = cast32((long) (u - (Math.floor(u/ twoPowS))));
-                }                
+                }
             } else {
                 z = (long) (-Math.floor(u/ twoPowS) - 1);
             }
@@ -196,7 +196,7 @@
 
     /**
 	 * True if this encoding can code the given value
-	 * 
+	 *
 	 * @param value
 	 *            the value to check
 	 * @return <code>true</code> if the encoding can encode this value
@@ -204,7 +204,7 @@
 	public boolean encodes(long value) {
 		return (value >= smallest() && value <= largest());
 	}
-    
+
     public byte[] encode(long value, long last) throws Pack200Exception {
         if (isDelta()) {
             value -= last;
@@ -267,7 +267,7 @@
 
 	/**
 	 * Returns the largest value that this codec can represent.
-	 * 
+	 *
 	 * @return the largest value that this codec can represent.
 	 */
 	public long largest() {
@@ -287,7 +287,7 @@
 	}
 	/**
 	 * Returns the smallest value that this codec can represent.
-	 * 
+	 *
 	 * @return the smallest value that this codec can represent.
 	 */
 	public long smallest() {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Thu Jan 31 02:04:05 2008
@@ -35,11 +35,11 @@
 import org.apache.harmony.pack200.bytecode.ClassConstantPool;
 
 public abstract class BandSet {
-    
+
     public abstract void unpack(InputStream inputStream) throws IOException, Pack200Exception;
-    
+
     protected Segment segment;
-    
+
     protected SegmentHeader header;
 
     public BandSet(Segment segment) {
@@ -49,7 +49,7 @@
 
     /**
      * Decode a band and return an array of <code>int</code> values
-     * 
+     *
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -81,7 +81,7 @@
 
     /**
      * Decode a band and return an array of <code>int[]</code> values
-     * 
+     *
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -117,10 +117,10 @@
         }
         return result;
     }
-    
+
     /**
      * Decode a band and return an array of <code>long</code> values
-     * 
+     *
      * @param name
      *            the name of the band (primarily for logging/debugging
      *            purposes)
@@ -172,7 +172,7 @@
         }
         return baos.toByteArray();
     }
-    
+
     public long[] parseFlags(String name, InputStream in, int count,
             BHSDCodec codec, boolean hasHi) throws IOException,
             Pack200Exception {
@@ -209,11 +209,11 @@
         int[] lo;
         if(hiCodec != null) {
             hi = decodeBandLong(name, in, hiCodec, sum);
-            lo = decodeBandInt(name, in, loCodec, sum);        
+            lo = decodeBandInt(name, in, loCodec, sum);
         } else {
             lo = decodeBandInt(name, in, loCodec, sum);
         }
-        
+
         int index = 0;
         for (int i = 0; i < result.length; i++) {
             for (int j = 0; j < result[i].length; j++) {
@@ -228,16 +228,16 @@
 
         // TODO Remove debugging code
         debug("Parsed *" + name + " (" + result.length + ")");
-        return result;        
+        return result;
     }
-    
+
     /**
      * Helper method to parse <i>count</i> references from <code>in</code>,
      * using <code>codec</code> to decode the values as indexes into
      * <code>reference</code> (which is populated prior to this call). An
      * exception is thrown if a decoded index falls outside the range
      * [0..reference.length-1].
-     * 
+     *
      * @param name
      *            the band name
      * @param in
@@ -249,7 +249,7 @@
      * @param reference
      *            the array of values to use for the indexes; often
      *            {@link #cpUTF8}
-     * 
+     *
      * @throws IOException
      *             if a problem occurs during reading from the underlying stream
      * @throws Pack200Exception
@@ -262,7 +262,7 @@
         return parseReferences(name, in, codec, new int[] { count },
                 reference)[0];
     }
-    
+
     /**
      * Helper method to parse <i>count</i> references from <code>in</code>,
      * using <code>codec</code> to decode the values as indexes into
@@ -270,7 +270,7 @@
      * exception is thrown if a decoded index falls outside the range
      * [0..reference.length-1]. Unlike the other parseReferences, this
      * post-processes the result into an array of results.
-     * 
+     *
      * @param name
      *            TODO
      * @param in
@@ -282,7 +282,7 @@
      * @param reference
      *            the array of values to use for the indexes; often
      *            {@link #cpUTF8}
-     * 
+     *
      * @throws IOException
      *             if a problem occurs during reading from the underlying stream
      * @throws Pack200Exception
@@ -328,7 +328,7 @@
         long[] band;
         Codec codecUsed = codec;
         if (codec.getB() == 1 || count == 0) {
-            band = codec.decode(count, in);           
+            band = codec.decode(count, in);
         } else {
             long[] getFirst = codec.decode(1, in);
             if (getFirst.length == 0) {
@@ -339,7 +339,7 @@
                 // Non-default codec should be used
                 codecUsed = CodecEncoding.getCodec((int) (-1 - first),
                         header.getBandHeadersInputStream(), codec);
-                band = codecUsed.decode(count, in);          
+                band = codecUsed.decode(count, in);
             } else if (!codec.isSigned() && first >= codec.getL()
                     && first <= codec.getL() + 255) {
                 // Non-default codec should be used
@@ -356,7 +356,7 @@
         for (int i = 0; i < returnBand.length; i++) {
             returnBand[i] = (int)band[i];
         }
-        
+
         /*
          * Note - this is not in the spec, but seems to be used as an
          * optimization by the RI for bands where the minimum and maximum values
@@ -392,7 +392,7 @@
                 }
             }
         }
-        
+
         return returnBand;
     }
 
@@ -401,7 +401,7 @@
      * class. It will be removed before going into production. If the property
      * 'debug.pack200' is set, this will generate messages to stderr; otherwise,
      * it will be silent.
-     * 
+     *
      * @param message
      * @deprecated this should be removed from production code
      */
@@ -410,7 +410,7 @@
     }
 
     public CPInteger[] parseCPIntReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        int[] reference = segment.getCpBands().getCpInt();        
+        int[] reference = segment.getCpBands().getCpInt();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPInteger[] result = new CPInteger[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -424,7 +424,7 @@
     }
 
     public CPDouble[] parseCPDoubleReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        double[] reference = segment.getCpBands().getCpDouble();        
+        double[] reference = segment.getCpBands().getCpDouble();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPDouble[] result = new CPDouble[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -438,7 +438,7 @@
     }
 
     public CPFloat[] parseCPFloatReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        float[] reference = segment.getCpBands().getCpFloat();       
+        float[] reference = segment.getCpBands().getCpFloat();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPFloat[] result = new CPFloat[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -452,7 +452,7 @@
     }
 
     public CPLong[] parseCPLongReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        long[] reference = segment.getCpBands().getCpLong();        
+        long[] reference = segment.getCpBands().getCpLong();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPLong[] result = new CPLong[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -464,9 +464,9 @@
         }
         return result;
     }
-    
+
     public CPUTF8[] parseCPUTF8References(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpUTF8();        
+        String[] reference = segment.getCpBands().getCpUTF8();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPUTF8[] result = new CPUTF8[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -481,7 +481,7 @@
 
 
     public CPUTF8[][] parseCPUTF8References(String name, InputStream in, BHSDCodec codec, int[] counts) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpUTF8();        
+        String[] reference = segment.getCpBands().getCpUTF8();
         CPUTF8[][] result = new CPUTF8[counts.length][];
         int sum = 0;
         for (int i = 0; i < counts.length; i++) {
@@ -509,7 +509,7 @@
     }
 
     public CPString[] parseCPStringReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpString();        
+        String[] reference = segment.getCpBands().getCpString();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPString[] result = new CPString[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -538,7 +538,7 @@
     }
 
     public CPMethodRef[] parseCPMethodRefReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpMethodClass();        
+        String[] reference = segment.getCpBands().getCpMethodClass();
         String[] descriptors = segment.getCpBands().getCpMethodDescriptor();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPMethodRef[] result = new CPMethodRef[indices.length];
@@ -553,7 +553,7 @@
     }
 
     public CPFieldRef[] parseCPFieldRefReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpFieldClass();        
+        String[] reference = segment.getCpBands().getCpFieldClass();
         String[] descriptors = segment.getCpBands().getCpFieldDescriptor();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPFieldRef[] result = new CPFieldRef[indices.length];
@@ -568,7 +568,7 @@
     }
 
     public CPNameAndType[] parseCPDescriptorReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpDescriptor();        
+        String[] reference = segment.getCpBands().getCpDescriptor();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPNameAndType[] result = new CPNameAndType[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -582,7 +582,7 @@
     }
 
     public CPUTF8[] parseCPSignatureReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpSignature();        
+        String[] reference = segment.getCpBands().getCpSignature();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPUTF8[] result = new CPUTF8[indices.length];
         for (int i1 = 0; i1 < count; i1++) {
@@ -596,7 +596,7 @@
     }
 
     public CPClass[] parseCPClassReferences(String name, InputStream in, BHSDCodec codec, int count) throws IOException, Pack200Exception {
-        String[] reference = segment.getCpBands().getCpClass();        
+        String[] reference = segment.getCpBands().getCpClass();
         int[] indices = decodeBandInt(name, in, codec, count, reference.length - 1);
         CPClass[] result = new CPClass[indices.length];
         for (int i1 = 0; i1 < count; i1++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java Thu Jan 31 02:04:05 2008
@@ -37,7 +37,7 @@
 
     // The bytecodes for each method in each class as they come (i.e. in their packed format)
     private byte[][][] methodByteCodePacked;
-    
+
     // The bands
     // TODO:  Haven't resolved references yet.  Do we want to?
     private int[] bcCaseCount;
@@ -77,7 +77,7 @@
      */
     public void unpack(InputStream in) throws IOException,
             Pack200Exception {
-        
+
        AttributeLayoutMap attributeDefinitionMap = segment.getAttrDefinitionBands().getAttributeDefinitionMap();
        int classCount = header.getClassCount();
        long[][] methodFlags = segment.getClassBands().getMethodFlags();
@@ -85,7 +85,7 @@
        int[] codeMaxStack = segment.getClassBands().getCodeMaxStack();
        ArrayList[][] methodAttributes = segment.getClassBands().getMethodAttributes();
        String[][] methodDescr = segment.getClassBands().getMethodDescr();
-       
+
        int bcCaseCountCount = 0;
        int bcByteCount = 0;
        int bcShortCount = 0;
@@ -96,14 +96,14 @@
        int bcLongRefCount = 0;
        int bcDoubleRefCount = 0;
        int bcStringRefCount = 0;
-       int bcClassRefCount = 0;       
+       int bcClassRefCount = 0;
        int bcFieldRefCount = 0;
        int bcMethodRefCount = 0;
        int bcIMethodRefCount = 0;
        int bcThisFieldCount = 0;
        int bcSuperFieldCount = 0;
        int bcThisMethodCount = 0;
-       int bcSuperMethodCount = 0;       
+       int bcSuperMethodCount = 0;
        int bcInitRefCount = 0;
        int bcEscCount = 0;
        int bcEscRefCount = 0;
@@ -119,7 +119,7 @@
                        AttributeLayout.CONTEXT_METHOD);
        methodByteCodePacked = new byte[classCount][][];
        int bcParsed = 0;
-       
+
        List switchIsTableSwitch = new ArrayList();
        List wideByteCodes = new ArrayList();
        for (int c = 0; c < classCount; c++) {
@@ -367,7 +367,7 @@
 
         int i = 0;
         ArrayList orderedCodeAttributes = segment.getClassBands().getOrderedCodeAttributes();
-        
+
         // Exception table fields
         int[] handlerCount = segment.getClassBands().getCodeHandlerCount();
         int[][] handlerStartPCs = segment.getClassBands().getCodeHandlerStartP();
@@ -421,7 +421,7 @@
            }
        }
     }
-    
+
     private boolean startsWithIf(int codePacked) {
         return (codePacked >= 153 && codePacked <= 166)
         || (codePacked == 198)

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java Thu Jan 31 02:04:05 2008
@@ -22,7 +22,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.harmony.pack200.IcBands.ICTuple;
 import org.apache.harmony.pack200.bytecode.Attribute;
 import org.apache.harmony.pack200.bytecode.CPClass;
 import org.apache.harmony.pack200.bytecode.CPNameAndType;
@@ -60,7 +59,7 @@
 
     private int[] classVersionMinor;
 
-    private IcBands.ICTuple[][] icLocal;
+    private IcTuple[][] icLocal;
 
     private ArrayList[] codeAttributes;
 
@@ -115,7 +114,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.harmony.pack200.BandSet#unpack(java.io.InputStream)
      */
     public void unpack(InputStream in) throws IOException, Pack200Exception {
@@ -158,7 +157,7 @@
                 AttributeLayout.CONTEXT_FIELD);
         int[] fieldAttrCalls = decodeBandInt("field_attr_calls", in,
                 Codec.UNSIGNED5, callCount);
-        
+
         // Assign empty field attributes
         fieldAttributes = new ArrayList[classCount][];
         for (int i = 0; i < classCount; i++) {
@@ -186,7 +185,7 @@
         int signatureIndex = 0;
 
         int backwardsCallsUsed = parseFieldMetadataBands(in, fieldAttrCalls);
-        
+
         // Parse non-predefined attribute bands
         int backwardsCallIndex = backwardsCallsUsed;
         int limit = options.hasFieldFlagsHi() ? 62 : 31;
@@ -203,7 +202,7 @@
         }
         for (int i = 0; i < counts.length; i++) {
             if(counts[i] > 0) {
-                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);                
+                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);
                 otherAttributes[i] = bands.parseAttributes(in, counts[i]);
                 int numBackwardsCallables = otherLayouts[i].numBackwardsCallables();
                 if(numBackwardsCallables > 0) {
@@ -260,7 +259,7 @@
     private void parseMethodBands(InputStream in) throws IOException,
             Pack200Exception {
         methodDescr = parseReferences("method_descr", in, Codec.MDELTA5,
-                classMethodCount, cpBands.getCpDescriptor());        
+                classMethodCount, cpBands.getCpDescriptor());
         parseMethodAttrBands(in);
     }
 
@@ -276,7 +275,7 @@
                 AttributeLayout.CONTEXT_METHOD);
         methodAttrCalls = decodeBandInt("code_attr_calls", in, Codec.UNSIGNED5,
                 callCount);
-        
+
         // assign empty method attributes
         methodAttributes = new ArrayList[classCount][];
         for (int i = 0; i < classCount; i++) {
@@ -294,7 +293,7 @@
                 Codec.UNSIGNED5, count);
         String[][] methodExceptionsRS = parseReferences("method_Exceptions_RC",
                 in, Codec.UNSIGNED5, numExceptions, cpBands.getCpClass());
-        
+
         // Parse method signature attributes
         AttributeLayout methodSignatureLayout = attrMap.getAttributeLayout(
                 AttributeLayout.ATTRIBUTE_SIGNATURE,
@@ -302,10 +301,10 @@
         int count1 = SegmentUtils.countMatches(methodFlags, methodSignatureLayout);
         long[] methodSignatureRS = decodeBandLong("method_signature_RS", in,
                 Codec.UNSIGNED5, count1);
-        
+
         // Parse method metadata bands
-        int backwardsCallsUsed = parseMethodMetadataBands(in, methodAttrCalls);        
-        
+        int backwardsCallsUsed = parseMethodMetadataBands(in, methodAttrCalls);
+
         // Parse non-predefined attribute bands
         int backwardsCallIndex = backwardsCallsUsed;
         int limit = options.hasMethodFlagsHi() ? 62 : 31;
@@ -322,7 +321,7 @@
         }
         for (int i = 0; i < counts.length; i++) {
             if(counts[i] > 0) {
-                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);                
+                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);
                 otherAttributes[i] = bands.parseAttributes(in, counts[i]);
                 int numBackwardsCallables = otherLayouts[i].numBackwardsCallables();
                 if(numBackwardsCallables > 0) {
@@ -415,7 +414,7 @@
         for (int i = 0; i < classCount; i++) {
             classAttributes[i] = new ArrayList();
         }
-        
+
         classFlags = parseFlags("class_flags", in, classCount, Codec.UNSIGNED5,
                 options.hasClassFlagsHi());
         int classAttrCount = SegmentUtils.countBit16(classFlags);
@@ -513,7 +512,7 @@
         }
         for (int i = 0; i < counts.length; i++) {
             if(counts[i] > 0) {
-                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);                
+                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);
                 otherAttributes[i] = bands.parseAttributes(in, counts[i]);
                 int numBackwardsCallables = otherLayouts[i].numBackwardsCallables();
                 if(numBackwardsCallables > 0) {
@@ -532,7 +531,7 @@
         int innerClassIndex = 0;
         int innerClassC2NIndex = 0;
         int versionIndex = 0;
-        icLocal = new IcBands.ICTuple[classCount][];
+        icLocal = new IcTuple[classCount][];
         for (int i = 0; i < classCount; i++) {
             long flag = classFlags[i];
 
@@ -581,9 +580,9 @@
             if (innerClassLayout.matches(flag)) {
                 // Just create the tuples for now because the attributes are
                 // decided at the end when creating class constant pools
-                icLocal[i] = new IcBands.ICTuple[classInnerClassesN[innerClassIndex]];
+                icLocal[i] = new IcTuple[classInnerClassesN[innerClassIndex]];
                 for (int j = 0; j < icLocal[i].length; j++) {
-                    IcBands.ICTuple icTuple = new IcBands.ICTuple();
+                    IcTuple icTuple = new IcTuple();
                     icTuple.C = cpClass[classInnerClassesRC[innerClassIndex][j]];
                     icTuple.F = classInnerClassesF[innerClassIndex][j];
                     if (icTuple.F != 0) {
@@ -593,7 +592,7 @@
                     } else {
                         // Get from icBands
                         IcBands icBands = segment.getIcBands();
-                        ICTuple[] icAll = icBands.getIcTuples();
+                        IcTuple[] icAll = icBands.getIcTuples();
                         for (int k = 0; k < icAll.length; k++) {
                             if (icAll[k].C.equals(icTuple.C)) {
                                 icTuple.C2 = icAll[k].C2;
@@ -751,7 +750,7 @@
                 .getAttributeLayout(
                         AttributeLayout.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE,
                         AttributeLayout.CONTEXT_CODE);
-        
+
         int lengthLocalVariableNBand = SegmentUtils.countMatches(codeFlags,
                 localVariableTableLayout);
         int[] localVariableTableN = decodeBandInt("code_LocalVariableTable_N",
@@ -787,7 +786,7 @@
                 }
             }
         }
-        
+
         int lengthLocalVariableTypeTableNBand = SegmentUtils.countMatches(
                 codeFlags, localVariableTypeTableLayout);
         int[] localVariableTypeTableN = decodeBandInt(
@@ -825,7 +824,7 @@
         }
         for (int i = 0; i < counts.length; i++) {
             if(counts[i] > 0) {
-                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);                
+                NewAttributeBands bands = attrMap.getAttributeBands(otherLayouts[i]);
                 otherAttributes[i] = bands.parseAttributes(in, counts[i]);
                 int numBackwardsCallables = otherLayouts[i].numBackwardsCallables();
                 if(numBackwardsCallables > 0) {
@@ -835,7 +834,7 @@
                     backwardsCallIndex+= numBackwardsCallables;
                 }
             }
-        }     
+        }
 
         int lineNumberIndex = 0;
         int lvtIndex = 0;
@@ -880,7 +879,7 @@
                 }
             }
         }
-        
+
     }
 
     private CPUTF8[][] stringsToCPUTF8(String[][] strings) {
@@ -893,7 +892,7 @@
         }
         return cpUTF8s;
     }
-    
+
 
 
     private CPUTF8[] stringsToCPUTF8(String[] strings) {
@@ -935,7 +934,7 @@
         Iterator rvaAttributesIterator = mb[0].getAttributes().iterator();
         Iterator riaAttributesIterator = mb[1].getAttributes().iterator();
         for (int i = 0; i < fieldFlags.length; i++) {
-            for (int j = 0; j < fieldFlags[i].length; j++) {                
+            for (int j = 0; j < fieldFlags[i].length; j++) {
                 if(rvaLayout.matches(fieldFlags[i][j])) {
                     fieldAttributes[i][j].add(rvaAttributesIterator.next());
                 }
@@ -970,7 +969,7 @@
                         pairCount += mbg[i].pair_N[j][k];
                     }
                 }
-                
+
                 mbg[i].name_RU = stringsToCPUTF8(parseReferences(contextName + "_" + rxa
                         + "_name_RU", in, Codec.UNSIGNED5, pairCount, cpBands.getCpUTF8()));
             }
@@ -1196,7 +1195,7 @@
     /**
      * Answer an ArrayList of ArrayLists which hold the the code attributes
      * corresponding to all classes in order.
-     * 
+     *
      * If a class doesn't have any attributes, the corresponding element in this
      * list will be an empty ArrayList.
      * @return ArrayList
@@ -1230,7 +1229,7 @@
      * Returns null if all classes should use the default major and minor
      * version or an array of integers containing the major version numberss to
      * use for each class in the segment
-     * 
+     *
      * @return Class file major version numbers, or null if none specified
      */
     public int[] getClassVersionMajor() {
@@ -1241,7 +1240,7 @@
      * Returns null if all classes should use the default major and minor
      * version or an array of integers containing the minor version numberss to
      * use for each class in the segment
-     * 
+     *
      * @return Class file minor version numbers, or null if none specified
      */
     public int[] getClassVersionMinor() {
@@ -1266,6 +1265,10 @@
 
     public int[][] getCodeHandlerStartP() {
         return codeHandlerStartP;
+    }
+
+    public IcTuple[][] getIcLocal() {
+        return icLocal;
     }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java Thu Jan 31 02:04:05 2008
@@ -31,7 +31,7 @@
  * as a sequence of 10x1s. This allows the absolute value of a coded integer to
  * fall outside of the 'small number' range, whilst still being encoded as a
  * single byte.
- * 
+ *
  * A codec is configured with four parameters:
  * <dl>
  * <dt>B</dt>
@@ -65,7 +65,7 @@
  * instance of the Codec to be cloned for each use.)
  * <dt>
  * </dl>
- * 
+ *
  * Codecs are notated as (B,H,S,D) and either D or S,D may be omitted if zero.
  * Thus {@link #BYTE1} is denoted (1,256,0,0) or (1,256). The
  * {@link #toString()} method prints out the condensed form of the encoding.
@@ -74,24 +74,24 @@
  * {@link #UNSIGNED5}) are unsigned; otherwise, in most cases, they are signed.
  * The presence of the word Delta ({@link #DELTA5}, {@link #UDELTA5})
  * indicates a delta encoding is used.
- * 
+ *
  * This codec is really quite cool for storing compressed information, and could
  * be used entirely separately from the Pack200 implementation for efficient
  * transfer of integer data if required.
- * 
+ *
  * Note that all information is byte-oriented; for decoding float/double
  * information, the bit values are converted (not cast) into a long type. Note
  * that long values are used throughout even though most may be cast to ints;
  * this is primarily to avoid having to worry about signed values, even if it
  * would be more efficient to do so.
- * 
+ *
  * There are a number of standard codecs ({@link #UDELTA5}, {@link #UNSIGNED5},
  * {@link #BYTE1}, {@link #CHAR3}) that are used in the implementation of many
  * bands; but there are a variety of other ones, and indeed the specification
  * assumes that other combinations of values can result in more specific and
  * efficient formats. There are also a sequence of canonical encodings defined
  * by the Pack200 specification, which allow a codec to be referred to by
- * canonical number. {@link CodecEncoding#canonicalCodec}) 
+ * canonical number. {@link CodecEncoding#canonicalCodec})
  */
 public abstract class Codec {
 	/**
@@ -149,7 +149,7 @@
 	 * Decode a sequence of bytes from the given input stream, returning the
 	 * value as a long. Note that this method can only be applied for non-delta
 	 * encodings.
-	 * 
+	 *
 	 * @param in
 	 *            the input stream to read from
 	 * @return the value as a long
@@ -168,7 +168,7 @@
 	 * previous value must be passed in as a parameter. If it is a non-delta
 	 * encoding, then it does not matter what value is passed in, so it makes
 	 * sense for the value to be passed in by default using code similar to:
-	 * 
+	 *
 	 * <pre>
 	 * long last = 0;
 	 * while (condition) {
@@ -176,7 +176,7 @@
 	 * 	// do something with last
 	 * }
 	 * </pre>
-	 * 
+	 *
 	 * @param in
 	 *            the input stream to read from
 	 * @param last
@@ -198,7 +198,7 @@
 	 * This should probably be used in most cases, since some codecs
 	 * (such as @{link PopCodec}) only work when the number of values
 	 * to be read is known.
-	 * 
+	 *
 	 * @param n
 	 *            the number of values to decode
 	 * @param in
@@ -221,10 +221,10 @@
 		}
 		return result;
 	}
-    
+
     /**
      * Decodes a sequence of <code>n</code> values from <code>in</code>.
-     * 
+     *
      * @param n
      *            the number of values to decode
      * @param in

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CodecEncoding.java Thu Jan 31 02:04:05 2008
@@ -40,7 +40,7 @@
 			new BHSDCodec(5, 16, 2), new BHSDCodec(5, 32), new BHSDCodec(5, 32, 1),
 			new BHSDCodec(5, 32, 2), new BHSDCodec(5, 64), new BHSDCodec(5, 64, 1),
 			new BHSDCodec(5, 64, 2), new BHSDCodec(5, 128), new BHSDCodec(5, 128, 1),
-			new BHSDCodec(5, 128, 2), new BHSDCodec(5, 4, 0, 1), 
+			new BHSDCodec(5, 128, 2), new BHSDCodec(5, 4, 0, 1),
 			new BHSDCodec(5, 4, 1, 1), new BHSDCodec(5, 4, 2, 1),
 			new BHSDCodec(5, 16, 0, 1), new BHSDCodec(5, 16, 1, 1),
 			new BHSDCodec(5, 16, 2, 1), new BHSDCodec(5, 32, 0, 1),
@@ -80,7 +80,7 @@
 			new BHSDCodec(4, 240, 0, 1), new BHSDCodec(4, 240, 1, 1),
 			new BHSDCodec(4, 248, 0, 1), new BHSDCodec(4, 248, 1, 1) };
 
-	/** 
+	/**
 	 * Returns the codec specified by the given value byte and optional byte header.
 	 * If the value is >=116, then bytes may be consumed from the secondary input
 	 * stream, which is taken to be the contents of the band_headers byte array.
@@ -91,17 +91,17 @@
 	 * @param in the input stream to read additional byte headers from
 	 * @param defaultCodec TODO
 	 * @return the corresponding codec, or <code>null</code> if the default should be used
-	 * @throws IOException 
+	 * @throws IOException
 	 * @throws IOException if there is a problem reading from the input stream (which
 	 * in reality, is never, since the band_headers are likely stored in a byte array
 	 * and accessed via a ByteArrayInputStream. However, an EOFException could occur
 	 * if things go wrong)
-	 * @throws Pack200Exception 
+	 * @throws Pack200Exception
 	 */
 	public static Codec getCodec(int value, InputStream in, Codec defaultCodec) throws IOException, Pack200Exception {
 		// Sanity check to make sure that no-one has changed
 		// the canonical codecs, which would really cause havoc
-		if (canonicalCodec.length != 116) 
+		if (canonicalCodec.length != 116)
 			throw new Error("Canonical encodings have been incorrectly modified");
 		if (value < 0) {
 			throw new IllegalArgumentException(
@@ -122,7 +122,7 @@
 				throw new EOFException("End of buffer read whilst trying to decode codec");
 			int h = code + 1;
 			// This handles the special cases for invalid combinations of data.
-			return new BHSDCodec(b,h,s,d);			
+			return new BHSDCodec(b,h,s,d);
 		} else if (value >= 117 && value <= 140) { // Run codec
 			int offset = value - 117;
 			int kx = offset & 3;
@@ -138,17 +138,17 @@
 			if (adef) {
 				aCodec = defaultCodec;
 			} else {
-				aCodec = getCodec(in.read(),in,defaultCodec); 
+				aCodec = getCodec(in.read(),in,defaultCodec);
 			}
 			if (bdef) {
 				bCodec = defaultCodec;
 			} else {
-				bCodec = getCodec(in.read(),in,defaultCodec); 
+				bCodec = getCodec(in.read(),in,defaultCodec);
 			}
 			return new RunCodec(k,aCodec,bCodec);
 		} else if (value >= 141 && value <= 188) { // Population Codec
 			int offset = value - 141;
-			boolean fdef = (offset & 1) == 1; 
+			boolean fdef = (offset & 1) == 1;
 			boolean udef = (offset >> 1 & 1) == 1;
 			int tdefl = offset >> 2;
 			boolean tdef = tdefl != 0;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java Thu Jan 31 02:04:05 2008
@@ -21,11 +21,11 @@
 import java.util.ArrayList;
 
 public class CpBands extends BandSet {
-    
+
     public SegmentConstantPool getConstantPool() {
         return pool;
     }
-    
+
 
     private final SegmentConstantPool pool = new SegmentConstantPool(this);
 
@@ -59,11 +59,11 @@
 
     private String[] cpUTF8;
 
-    
+
     public CpBands(Segment segment) {
         super(segment);
     }
-    
+
     public void unpack(InputStream in) throws IOException, Pack200Exception {
         parseCpUtf8(in);
         parseCpInt(in);
@@ -78,11 +78,11 @@
         parseCpMethod(in);
         parseCpIMethod(in);
     }
-    
+
     /**
      * Parses the constant pool class names, using {@link #cpClassCount} to
      * populate {@link #cpClass} from {@link #cpUTF8}.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -106,7 +106,7 @@
      * largely to make it easier for representing field and method descriptors
      * (e.g. <code>out:java.lang.PrintStream</code>) in a way that is
      * compatible with passing String arrays.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -144,7 +144,7 @@
     /**
      * Parses the constant pool field definitions, using {@link #cpFieldCount}
      * to populate {@link #cpFieldClass} and {@link #cpFieldDescriptor}.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -177,7 +177,7 @@
      * Parses the constant pool interface method definitions, using
      * {@link #cpIMethodCount} to populate {@link #cpIMethodClass} and
      * {@link #cpIMethodDescriptor}.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -211,7 +211,7 @@
     /**
      * Parses the constant pool method definitions, using {@link #cpMethodCount}
      * to populate {@link #cpMethodClass} and {@link #cpMethodDescriptor}.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -242,7 +242,7 @@
      * representation identical to the bytecode equivalent
      * <code>[Ljava/lang/String;(V)</code> TODO Check that the form is as
      * above and update other types e.g. J
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -291,7 +291,7 @@
     /**
      * Parses the constant pool strings, using {@link #cpStringCount} to
      * populate {@link #cpString} from indexes into {@link #cpUTF8}.
-     * 
+     *
      * @param in
      *            the input stream to read from
      * @throws IOException
@@ -308,7 +308,7 @@
 
     private void parseCpUtf8(InputStream in) throws IOException,
             Pack200Exception {
-        int cpUTF8Count = header.getCpUTF8Count();        
+        int cpUTF8Count = header.getCpUTF8Count();
         cpUTF8 = new String[cpUTF8Count];
         cpUTF8[0] = ""; //$NON-NLS-1$
         int[] prefix = decodeBandInt("cpUTF8Prefix", in, Codec.DELTA5, cpUTF8Count-2);
@@ -327,14 +327,14 @@
         int[] dataBand = decodeBandInt("cp_Utf8_chars", in, Codec.CHAR3, charCount);
         for (int i = 0; i < data.length; i++) {
             data[i] = (char) dataBand[i];
-        } 
-        
+        }
+
         // Read in the big suffix data
         int[] bigSuffixCounts = decodeBandInt("cp_Utf8_big_suffix", in, Codec.DELTA5, bigSuffixCount);
         int[][] bigSuffixDataBand = decodeBandInt("cp_Utf8_big_chars", in, Codec.DELTA5, bigSuffixCounts);
-        
+
         // Convert big suffix data to characters
-        char bigSuffixData[][] = new char[bigSuffixCount][];        
+        char bigSuffixData[][] = new char[bigSuffixCount][];
         for (int i = 0; i < bigSuffixDataBand.length; i++) {
             bigSuffixData[i] = new char[bigSuffixDataBand[i].length];
             for (int j = 0; j < bigSuffixDataBand[i].length; j++) {
@@ -358,7 +358,7 @@
             }
         }
     }
-    
+
     public String[] getCpClass() {
         return cpClass;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java Thu Jan 31 02:04:05 2008
@@ -42,7 +42,7 @@
     private String[] cpUTF8;
 
     private InputStream in;
-    
+
     /**
      * @param header
      */
@@ -77,7 +77,7 @@
         }
         this.in = in; // store for use by processFileBits(), which is called later
     }
-    
+
     // TODO: stream the file bits directly somehow
     public void processFileBits() throws IOException,
             Pack200Exception {