harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arc...@apache.org
Subject svn commit: r413341 - in /incubator/harmony/enhanced/classlibadapter/trunk: modules/kernel/src/main/java/java/lang/System.java vmi/vmi.cpp
Date Sat, 10 Jun 2006 18:09:01 GMT
Author: archie
Date: Sat Jun 10 11:09:00 2006
New Revision: 413341

URL: http://svn.apache.org/viewvc?rev=413341&view=rev
Log:
Apply patch from HARMONY-569.

Modified:
    incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java
    incubator/harmony/enhanced/classlibadapter/trunk/vmi/vmi.cpp

Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java?rev=413341&r1=413340&r2=413341&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java
(original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/System.java
Sat Jun 10 11:09:00 2006
@@ -100,7 +100,7 @@
 	 *            the new value for out.
 	 */
 	public static void setOut(java.io.PrintStream newOut) {
-        throw new RuntimeException("not implemented");
+            setPrintStream("out", newOut);
 	}
 
 	/**
@@ -111,8 +111,11 @@
 	 *            the new value for err.
 	 */
 	public static void setErr(java.io.PrintStream newErr) {
-        throw new RuntimeException("not implemented");
+            setPrintStream("err", newErr);
 	}
+
+        private static native void setPrintStream(String field,
+                                                  java.io.PrintStream stream);
 
 	/**
 	 * Prevents this class from being instantiated.

Modified: incubator/harmony/enhanced/classlibadapter/trunk/vmi/vmi.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/vmi/vmi.cpp?rev=413341&r1=413340&r2=413341&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/vmi/vmi.cpp (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/vmi/vmi.cpp Sat Jun 10 11:09:00 2006
@@ -273,16 +273,38 @@
     }
 
     /*
-     *  * Class:     java_lang_System
-     *   * Method:    currentTimeMillis
-     *    * Signature: ()J
-     *     */
+     * Class:     java_lang_System
+     * Method:    currentTimeMillis
+     * Signature: ()J
+     */
     JNIEXPORT jlong JNICALL Java_java_lang_System_currentTimeMillis
         (JNIEnv *, jclass)
     {
         struct timeval tv;
         gettimeofday(&tv, NULL);
         return tv.tv_sec * (jlong)1000 + tv.tv_usec / 1000;
+    }
+
+    /*
+     * Class:     java_lang_System
+     * Method:    setPrintStream
+     * Signature: (Ljava/lang/String;Ljava/io/PrintStream;)V
+     */
+    JNIEXPORT void JNICALL Java_java_lang_System_setPrintStream
+        (JNIEnv *env, jclass c, jstring field, jobject stream)
+    {
+        jfieldID fid;
+        const char *field_name = env->GetStringUTFChars(field, 0);
+        if (!field_name) {
+            return;
+        }
+        fid = env->GetStaticFieldID(c, field_name, "Ljava/io/PrintStream;");
+        env->ReleaseStringUTFChars(field, field_name);
+        if (!fid) {
+            return;
+        }
+        env->SetStaticObjectField(c, fid, stream);
+        return;
     }
 
     JNIEXPORT void JNICALL Java_java_lang_VMThread_attach



Mime
View raw message