This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.util mergelet
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Tue, 29 Apr 2003 13:37:46 +0200
- Subject: FYI: Patch: java.util mergelet
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to trunk to do a little merging with
classpath in java.util.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+rmQKWSOgCCdjSDsRAivNAJ9V+hmXjf4+oTpxPyp1FsAyLbBOwwCdFK1g
zmG6JNnaLb/lbTmT+4bnkXU=
=FGYW
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1860
diff -u -r1.1860 ChangeLog
--- ChangeLog 29 Apr 2003 09:26:29 -0000 1.1860
+++ ChangeLog 29 Apr 2003 11:30:35 -0000
@@ -1,5 +1,14 @@
2003-04-29 Michael Koch <konqueror at gmx dot de>
+ * java/util/PropertyPermission.java:
+ New version from classpath
+ * java/util/ResourceBundle.java:
+ Partly merged from classpath
+ (getObject): Reformated.
+ (tryBundle): Set foundBundle = null if no bundle found.
+
+2003-04-29 Michael Koch <konqueror at gmx dot de>
+
* javax/swing/AbstractListModel.java,
javax/swing/DefaultBoundedRangeModel.java,
javax/swing/DefaultSingleSelectionModel.java:
Index: java/util/PropertyPermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/PropertyPermission.java,v
retrieving revision 1.4
diff -u -r1.4 PropertyPermission.java
--- java/util/PropertyPermission.java 18 Jun 2002 15:39:58 -0000 1.4
+++ java/util/PropertyPermission.java 29 Apr 2003 11:30:35 -0000
@@ -121,7 +121,7 @@
super(name);
if (actions == null)
throw new IllegalArgumentException();
- setActions(actions.toLowerCase());
+ setActions(actions);
}
/**
@@ -134,14 +134,37 @@
*/
private void setActions(String str)
{
+ // Initialising the class java.util.Locale ...
+ // tries to initialise the Locale.defaultLocale static
+ // which calls System.getProperty,
+ // which calls SecurityManager.checkPropertiesAccess,
+ // which creates a PropertyPermission with action "read,write",
+ // which calls setActions("read,write").
+ // If we now were to call toLowerCase on 'str',
+ // this would call Locale.getDefault() which returns null
+ // because Locale.defaultLocale hasn't been set yet
+ // then toLowerCase will fail with a null pointer exception.
+ //
+ // The solution is to take a punt on 'str' being lower case, and
+ // test accordingly. If that fails, we convert 'str' to lower case
+ // and try the tests again.
if ("read".equals(str))
actions = READ;
else if ("write".equals(str))
actions = WRITE;
else if ("read,write".equals(str) || "write,read".equals(str))
actions = READ | WRITE;
- else
- throw new IllegalArgumentException("illegal action " + str);
+ else {
+ String lstr = str.toLowerCase();
+ if ("read".equals(lstr))
+ actions = READ;
+ else if ("write".equals(lstr))
+ actions = WRITE;
+ else if ("read,write".equals(lstr) || "write,read".equals(lstr))
+ actions = READ | WRITE;
+ else
+ throw new IllegalArgumentException("illegal action " + str);
+ }
}
/**
Index: java/util/ResourceBundle.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/ResourceBundle.java,v
retrieving revision 1.22
diff -u -r1.22 ResourceBundle.java
--- java/util/ResourceBundle.java 8 Dec 2002 23:38:02 -0000 1.22
+++ java/util/ResourceBundle.java 29 Apr 2003 11:30:35 -0000
@@ -1,5 +1,5 @@
/* ResourceBundle -- aids in loading resource bundles
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -182,8 +182,9 @@
catch (MissingResourceException ex)
{
}
- throw new MissingResourceException("Key not found",
- getClass().getName(), key);
+
+ throw new MissingResourceException("Key not found", getClass().getName(),
+ key);
}
/**
@@ -470,6 +471,7 @@
catch (Exception ex)
{
// ignore them all
+ foundBundle = null;
}
if (foundBundle == null)
{