[kaffe] CVS kaffe (guilhem): Fix for bad locale environment.

Kaffe CVS cvs-commits at kaffe.org
Sat Jan 1 08:00:21 PST 2005


PatchSet 5740 
Date: 2005/01/01 15:55:51
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fix for bad locale environment.

        * libraries/javalib/gnu/classpath/VMSystemProperties.java
        (preInit): Check if LOCALE is null.

        * kaffe/kaffevm/jni/jni-string.c
        (KaffeJNI_NewStringUTF): Use the right return path so that exceptions
        are handled correctly.

Members: 
	ChangeLog:1.3284->1.3285 
	kaffe/kaffevm/jni/jni-string.c:1.7->1.8 
	libraries/javalib/gnu/classpath/VMSystemProperties.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3284 kaffe/ChangeLog:1.3285
--- kaffe/ChangeLog:1.3284	Sat Jan  1 11:35:41 2005
+++ kaffe/ChangeLog	Sat Jan  1 15:55:51 2005
@@ -1,5 +1,14 @@
 2005-01-01  Guilhem Lavaux  <guilhem at kaffe.org>
 
+	* libraries/javalib/gnu/classpath/VMSystemProperties.java
+	(preInit): Check if LOCALE is null.
+
+	* kaffe/kaffevm/jni/jni-string.c
+	(KaffeJNI_NewStringUTF): Use the right return path so that exceptions
+	are handled correctly.
+
+2005-01-01  Guilhem Lavaux  <guilhem at kaffe.org>
+
 	* kaffe/kaffevm/classMethod.h
 	(protectionDomain): Changed declaration to use the right type.
 
Index: kaffe/kaffe/kaffevm/jni/jni-string.c
diff -u kaffe/kaffe/kaffevm/jni/jni-string.c:1.7 kaffe/kaffe/kaffevm/jni/jni-string.c:1.8
--- kaffe/kaffe/kaffevm/jni/jni-string.c:1.7	Fri Dec 31 11:07:15 2004
+++ kaffe/kaffe/kaffevm/jni/jni-string.c	Sat Jan  1 15:55:54 2005
@@ -81,27 +81,28 @@
   Utf8Const* utf8;
   size_t len;
 
-  BEGIN_EXCEPTION_HANDLING(NULL);
-
   /* We cannot construct the string if data is NULL. So as JNI says
    * we return NULL.
    */
-  if (data == NULL)
-    return NULL;
 
-  len = strlen(data);
-  if (!utf8ConstIsValidUtf8(data, len)) {
-    str = NULL;
-  } else {
-    utf8 = checkPtr(utf8ConstNew(data, (int)len));
-    str = utf8Const2Java(utf8);
-    utf8ConstRelease(utf8);
-    if (!str) {
-      errorInfo info;
-      postOutOfMemory(&info);
-      throwError(&info);
+  BEGIN_EXCEPTION_HANDLING(NULL);
+
+  if (data != NULL) {
+    len = strlen(data);
+    if (!utf8ConstIsValidUtf8(data, len)) {
+      str = NULL;
+    } else {
+      utf8 = checkPtr(utf8ConstNew(data, (int)len));
+      str = utf8Const2Java(utf8);
+      utf8ConstRelease(utf8);
+      if (!str) {
+        errorInfo info;
+        postOutOfMemory(&info);
+        throwError(&info);
+      }
     }
-  }
+  } else
+   str = NULL;
 
   END_EXCEPTION_HANDLING();
   return (str);
Index: kaffe/libraries/javalib/gnu/classpath/VMSystemProperties.java
diff -u kaffe/libraries/javalib/gnu/classpath/VMSystemProperties.java:1.1 kaffe/libraries/javalib/gnu/classpath/VMSystemProperties.java:1.2
--- kaffe/libraries/javalib/gnu/classpath/VMSystemProperties.java:1.1	Wed Dec  8 07:22:31 2004
+++ kaffe/libraries/javalib/gnu/classpath/VMSystemProperties.java	Sat Jan  1 15:55:55 2005
@@ -170,7 +170,7 @@
       properties.setProperty("sun.boot.class.path", SUN_BOOT_CLASS_PATH);
 
       final String LOCALE = getLocale();
-      if (LOCALE.length() > 2)
+      if (LOCALE != null && LOCALE.length() > 2)
 	{
 	  properties.setProperty("user.language", LOCALE.substring(0, 2));
 	  if (LOCALE.charAt(2) == '_')




More information about the kaffe mailing list