Throw IllegalArgumentException if Currency.getInstance is given an invalid currency code.

This fixes an existing harmony DecimalFormatSymbolsTest failure, but I've added
an explicit test for clarity (and to reduce the likelihood of regression).
diff --git a/libcore/luni/src/main/java/java/util/Currency.java b/libcore/luni/src/main/java/java/util/Currency.java
index 6aa295a..6b6e902 100644
--- a/libcore/luni/src/main/java/java/util/Currency.java
+++ b/libcore/luni/src/main/java/java/util/Currency.java
@@ -58,8 +58,17 @@
             return;
         }
 
+        // Ensure that we throw if the our currency code isn't an ISO currency code.
+        String symbol = Resources.getCurrencySymbolNative(Locale.US.toString(), currencyCode);
+        if (symbol == null) {
+            throw new IllegalArgumentException(Msg.getString("K0322", currencyCode));
+        }
+
         this.defaultFractionDigits = Resources.getCurrencyFractionDigitsNative(currencyCode);
         if (defaultFractionDigits < 0) {
+            // In practice, I don't think this can fail because ICU doesn't care whether you give
+            // it a valid country code, and will just return a sensible default for the default
+            // locale's currency.
             throw new IllegalArgumentException(Msg.getString("K0322", currencyCode));
         }
         // END android-changed
diff --git a/libcore/luni/src/test/java/java/util/CurrencyTest.java b/libcore/luni/src/test/java/java/util/CurrencyTest.java
index 16111d5..66354f5 100644
--- a/libcore/luni/src/test/java/java/util/CurrencyTest.java
+++ b/libcore/luni/src/test/java/java/util/CurrencyTest.java
@@ -31,4 +31,15 @@
         // Canada that Canadians give it a localized (to Canada) symbol.
         assertEquals("AED", Currency.getInstance("AED").getSymbol(Locale.CANADA));
     }
+
+    // Regression test to ensure that Currency.getInstance(String) throws if
+    // given an invalid ISO currency code.
+    public void test_getInstance_illegal_currency_code() throws Exception {
+        Currency.getInstance("USD");
+        try {
+            Currency.getInstance("BOGO-DOLLARS");
+            fail("expected IllegalArgumentException for invalid ISO currency code");
+        } catch (IllegalArgumentException expected) {
+        }
+    }
 }