[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: System.getenv

Kaffe CVS cvs-commits at kaffe.org
Fri Sep 10 08:50:56 PDT 2004


PatchSet 5151 
Date: 2004/09/10 15:46:56
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: System.getenv

2004-09-10  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/lang/System.java (getenv): Implemented
        by adapting the implementation from GNU Classpath.
        (getenv0): New native method.

        * libraries/clib/native/System.c (java_lang_System_getenv0):
        New method. Adapted from GNU Classpath.

        2004-08-28  Mark Wielaard  <mark at klomp.org>

        * java/lang/System.java (getenv): Do security checks and call
        VMSystem.getenv().
        * vm/reference/java/lang/VMSystem.java (getenv): New static native
        method.
        * native/jni/java-lang/java_lang_VMSystem.c (getenv): New function.

Members: 
	ChangeLog:1.2707->1.2708 
	libraries/clib/native/System.c:1.52->1.53 
	libraries/javalib/java/lang/System.java:1.38->1.39 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2707 kaffe/ChangeLog:1.2708
--- kaffe/ChangeLog:1.2707	Fri Sep 10 00:34:21 2004
+++ kaffe/ChangeLog	Fri Sep 10 15:46:56 2004
@@ -1,3 +1,20 @@
+2004-09-10  Dalibor Topic  <topic at mpiat2313>
+
+	* libraries/javalib/java/lang/System.java (getenv): Implemented
+	by adapting the implementation from GNU Classpath.
+	(getenv0): New native method.
+
+	* libraries/clib/native/System.c (java_lang_System_getenv0): 
+	New method. Adapted from GNU Classpath.
+
+	2004-08-28  Mark Wielaard  <mark at klomp.org>
+
+        * java/lang/System.java (getenv): Do security checks and call
+        VMSystem.getenv().
+        * vm/reference/java/lang/VMSystem.java (getenv): New static native
+        method.
+        * native/jni/java-lang/java_lang_VMSystem.c (getenv): New function.
+
 2004-09-09  Noa Resare  <noa at resare.com>
 
 	* kaffe/kaffevm/systems/unix-pthreads/syscalls.c:
Index: kaffe/libraries/clib/native/System.c
diff -u kaffe/libraries/clib/native/System.c:1.52 kaffe/libraries/clib/native/System.c:1.53
--- kaffe/libraries/clib/native/System.c:1.52	Thu Jul 29 14:24:54 2004
+++ kaffe/libraries/clib/native/System.c	Fri Sep 10 15:46:59 2004
@@ -160,6 +160,25 @@
 	KFREE(start);
 }
 
+
+/* Adapted from GNU Classpath */
+void
+java_lang_System_getenv0(struct Hjava_lang_String *str) 
+{
+  const char *cname;
+  const char *envname;
+
+  cname = checkPtr(stringJava2C(str));
+  if (cname == NULL)
+    return NULL;
+
+  envname = getenv(cname);
+  if (envname == NULL)
+    return NULL;
+
+  return stringC2Java(envname);
+}
+
 /*
  * Initialise system properties to their defaults.
  */
Index: kaffe/libraries/javalib/java/lang/System.java
diff -u kaffe/libraries/javalib/java/lang/System.java:1.38 kaffe/libraries/javalib/java/lang/System.java:1.39
--- kaffe/libraries/javalib/java/lang/System.java:1.38	Thu Jul 29 14:25:17 2004
+++ kaffe/libraries/javalib/java/lang/System.java	Fri Sep 10 15:46:59 2004
@@ -103,9 +103,16 @@
 	return Runtime.securityManager;
 }
 
+/* Adapted from GNU Classpath */
 public static String getenv(String name) {
-	throw new Error("System.getenv no longer supported");
+    if (name == null)
+      throw new NullPointerException();
+    SecurityManager sm = Runtime.securityManager; // Be thread-safe.
+    if (sm != null)
+      sm.checkPermission(new RuntimePermission("getenv." + name));
+    return getenv0(name);
 }
+native private static String getenv0(String name);
 
 native public static int identityHashCode(Object x);
 




More information about the kaffe mailing list