harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r481272 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes: javasrc/java/lang/System.java javasrc/java/lang/VMExecutionEngine.java native/java_lang_VMExecutionEngine.cpp native/java_lang_VMExecutionEngine.h
Date Fri, 01 Dec 2006 16:13:18 GMT
Author: geirm
Date: Fri Dec  1 08:13:17 2006
New Revision: 481272

URL: http://svn.apache.org/viewvc?view=rev&rev=481272
Log:
HARMONY-2390

Replace usage of internal env map to that from luni to
incidentally fix : 

 The classlib unit test org.apache.harmony.luni.tests.java.lang.SystemTest fails on DRLVM:

junit.framework.AssertionFailedError: Should throw NullPointerExcepiton.
at org.apache.harmony.luni.tests.java.lang.SystemTest.testEnvUnmodifiable(SystemTest.java:309)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
 

Tested on Ubuntu 6, all tests - will now go look back to see if test was in fact
excluded



Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/System.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/System.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/System.java?view=diff&rev=481272&r1=481271&r2=481272
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/System.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/System.java
Fri Dec  1 08:13:17 2006
@@ -25,7 +25,6 @@
 import java.io.PrintStream;
 import java.io.IOException;
 import java.security.SecurityPermission;
-import java.util.Collections;
 import java.util.Map;
 import java.util.Properties;
 import java.util.PropertyPermission;
@@ -34,6 +33,7 @@
 
 import org.apache.harmony.lang.RuntimePermissionCollection;
 import org.apache.harmony.vm.VMStack;
+import org.apache.harmony.luni.platform.Environment;
 
 /**
  * @com.intel.drl.spec_ref 
@@ -114,7 +114,7 @@
         if (sm != null) {
             sm.checkPermission(new RuntimePermission("getenv." + name));
         }
-        return VMExecutionEngine.getenv(name);
+        return Environment.getenv(name);
     }
 
     /**
@@ -125,7 +125,7 @@
         if (sm != null) {
             sm.checkPermission(RuntimePermissionCollection.GETENV_PERMISSION);
         }
-        return Collections.unmodifiableMap(VMExecutionEngine.getenv());
+        return Environment.getenv();
     }
 
     /**

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java?view=diff&rev=481272&r1=481271&r2=481272
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMExecutionEngine.java
Fri Dec  1 08:13:17 2006
@@ -191,20 +191,6 @@
     static native long nanoTime();
     
     /**
-     * Returns the value of the environment variable specified by
-     * <code>name</code> argument or <code>null</code> if it is not
set.
-     * @api2vm
-     */
-    static native String getenv(String name);
-    
-    /**
-     * Returns the whole environment as a name-value mapping.
-     * May return empty map.
-     * @api2vm
-     */
-    static native Map<String, String> getenv();
-    
-    /**
      * Returns platform-specific name of the specified library.
      * @api2vm
      */

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp?view=diff&rev=481272&r1=481271&r2=481272
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.cpp
Fri Dec  1 08:13:17 2006
@@ -215,60 +215,6 @@
 
 /*
 * Class:     java_lang_VMExecutionEngine
-* Method:    getenv
-* Signature: (Ljava/lang/String;)Ljava/lang/String;
-*/
-JNIEXPORT jstring JNICALL Java_java_lang_VMExecutionEngine_getenv__Ljava_lang_String_2
-(JNIEnv *jenv, jclass, jstring jname) {
-    jstring res = NULL;
-    if(jname) {
-        const char* key = GetStringUTFChars(jenv, jname, NULL);
-        apr_pool_t *pp;
-        char* value;
-        if (APR_SUCCESS == apr_pool_create(&pp, 0) 
-            && APR_SUCCESS == apr_env_get(&value, key, pp)) {
-            res = NewStringUTF(jenv, value);
-            apr_pool_destroy(pp);
-        }
-        ReleaseStringUTFChars(jenv, jname, key);
-    }
-    return res;
-}
-
-/*
-* Class:     java_lang_VMExecutionEngine
-* Method:    getenv
-* Signature: ()Ljava/util/Map;
-*/
-JNIEXPORT jobject JNICALL Java_java_lang_VMExecutionEngine_getenv__
-(JNIEnv *jenv, jclass) {
-    Global_Env * genv = VM_Global_State::loader_env;
-    Class* mapClass = genv->LoadCoreClass("java/util/HashMap");
-    jmethodID put = (jmethodID)class_lookup_method_recursive(mapClass, "put", 
-        "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-    jobject jmap = create_default_instance(mapClass);
-    if (jmap) {
-        apr_pool_t *pp;
-        if (APR_SUCCESS == apr_pool_create(&pp, 0)) {
-            for (char **e = port_env_all(pp) ; *e; ++e){
-                size_t idx = strcspn(*e, "=");
-                char* key = apr_pstrndup(pp, *e, idx);
-                jobject jkey = NewStringUTF(jenv, key);
-                if (!jkey) break;
-                jobject jval = NewStringUTF(jenv, *e+idx+1);
-                if (!jval) break;
-                CallObjectMethod(jenv, jmap, put, jkey, jval); 
-                assert(!exn_raised());
-            }
-            apr_pool_destroy(pp);
-        }
-    }
-
-    return jmap;
-}
-
-/*
-* Class:     java_lang_VMExecutionEngine
 * Method:    mapLibraryName
 * Signature: (Ljava/lang/String;)Ljava/lang/String;
 */

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h?view=diff&rev=481272&r1=481271&r2=481272
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMExecutionEngine.h
Fri Dec  1 08:13:17 2006
@@ -104,22 +104,6 @@
 
 /*
 * Class:     java_lang_VMExecutionEngine
-* Method:    getenv
-* Signature: (Ljava/lang/String;)Ljava/lang/String;
-*/
-JNIEXPORT jstring JNICALL Java_java_lang_VMExecutionEngine_getenv__Ljava_lang_String_2
-(JNIEnv *, jclass, jstring);
-
-/*
-* Class:     java_lang_VMExecutionEngine
-* Method:    getenv
-* Signature: ()Ljava/util/Map;
-*/
-JNIEXPORT jobject JNICALL Java_java_lang_VMExecutionEngine_getenv__
-(JNIEnv *, jclass);
-
-/*
-* Class:     java_lang_VMExecutionEngine
 * Method:    mapLibraryName
 * Signature: (Ljava/lang/String;)Ljava/lang/String;
 */



Mime
View raw message