[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: fix for Currency

Kaffe CVS cvs-commits at kaffe.org
Tue Jan 18 06:56:55 PST 2005


PatchSet 5868 
Date: 2005/01/18 14:52:19
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fix for Currency

2005-01-18  Dalibor Topic  <robilad at kaffe.org>

Resynced with GNU Classpath.

2005-01-17  Andrew John Hughes  <gnu_andrew at member.fsf.org>

* java/util/Currency.java:
(getInstance(String)): catch IllegalArgumentException
for locales without countries

Members: 
	ChangeLog:1.3410->1.3411 
	libraries/javalib/java/util/Currency.java:1.11->1.12 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3410 kaffe/ChangeLog:1.3411
--- kaffe/ChangeLog:1.3410	Tue Jan 18 13:50:35 2005
+++ kaffe/ChangeLog	Tue Jan 18 14:52:19 2005
@@ -1,6 +1,26 @@
 2005-01-18  Dalibor Topic  <robilad at kaffe.org>
 
 	Resynced with GNU Classpath.
+	
+	2005-01-17  Andrew John Hughes  <gnu_andrew at member.fsf.org>
+
+	* java/util/Currency.java:
+	(getInstance(String)): catch IllegalArgumentException
+	for locales without countries
+	
+2005-01-18  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
+	2005-01-16  Mark Wielaard  <mark at klomp.org>
+
+	Reported by Christian Thalinger <twisti at complang.tuwien.ac.at>
+	* java/lang/ClassLoader.java (getExtClassLoaderUrls): Add check for
+	null returned from getFiles().
+	
+2005-01-18  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
 
 	2005-01-15  Andrew John Hughes  <gnu_andrew at member.fsf.org>
 
Index: kaffe/libraries/javalib/java/util/Currency.java
diff -u kaffe/libraries/javalib/java/util/Currency.java:1.11 kaffe/libraries/javalib/java/util/Currency.java:1.12
--- kaffe/libraries/javalib/java/util/Currency.java:1.11	Thu Jan 13 05:55:25 2005
+++ kaffe/libraries/javalib/java/util/Currency.java	Tue Jan 18 14:52:22 2005
@@ -41,7 +41,6 @@
 import gnu.java.locale.LocaleInformation;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 
@@ -129,8 +128,7 @@
     /* Try and load the properties from our iso4217.properties resource */
     try 
       {
-	InputStream propertyStream = Currency.class.getResourceAsStream("iso4217.properties");
-        properties.load(propertyStream);
+        properties.load(Currency.class.getResourceAsStream("iso4217.properties"));
       }
     catch (IOException exception)
       {
@@ -170,7 +168,8 @@
     /* If there is no country code, return */
     if (countryCode.equals(""))
       {
-        return;
+        throw new
+	  IllegalArgumentException("The specified country code is invalid");
       }
     /* Construct the key for the currency */
     currencyKey = countryCode + ".currency";
@@ -250,6 +249,11 @@
      */
     Currency newCurrency;
 
+    if (locale == null || locale.getCountry() == null)
+      {
+	throw new
+	  NullPointerException("The locale or its country is null.");
+      }
     /* Attempt to get the currency from the cache */
     newCurrency = (Currency) cache.get(locale);
     if (newCurrency == null)
@@ -300,11 +304,19 @@
     /* Loop through each locale, looking for the code */
     for (int i = 0;i < allLocales.length; i++)
       {
-	Currency testCurrency = getInstance (allLocales[i]);
-	
-	if (testCurrency != null &&
-	    testCurrency.getCurrencyCode().equals(currencyCode))
-	  return testCurrency;
+	try
+	  {
+	    Currency testCurrency = getInstance (allLocales[i]);
+	    if (testCurrency != null &&
+		testCurrency.getCurrencyCode().equals(currencyCode))
+	      {
+		return testCurrency;
+	      }
+	  }
+	catch (IllegalArgumentException exception)
+	  {
+	    /* Ignore locales without valid countries */
+	  }
       }
     /* 
      * If we get this far, the code is not supported by any of




More information about the kaffe mailing list