harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r500999 - in /harmony/enhanced/classlib/trunk/modules: luni/src/main/java/java/net/ luni/src/main/java/org/apache/harmony/luni/platform/ luni/src/main/native/luni/shared/ luni/src/main/native/luni/unix/ nio/src/main/java/java/nio/channels/
Date Mon, 29 Jan 2007 10:26:47 GMT
Author: pyang
Date: Mon Jan 29 02:26:46 2007
New Revision: 500999

URL: http://svn.apache.org/viewvc?view=rev&rev=500999
Log:
Apply patch for HARMONY-3043 ([classlib][luni][nio]enable reflect id-cache in luni and nio)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/libhyluni.exp
    harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/DatagramChannel.java
    harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/SocketChannel.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
Mon Jan 29 02:26:46 2007
@@ -21,6 +21,7 @@
 import java.nio.channels.DatagramChannel;
 
 import org.apache.harmony.luni.net.SocketImplProvider;
+import org.apache.harmony.luni.platform.Platform;
 
 import org.apache.harmony.luni.util.Msg;
 
@@ -48,6 +49,10 @@
     private static class Lock {
     }
 
+    static {
+        Platform.getNetworkSystem().oneTimeInitialization(true);
+    }
+    
     private Object lock = new Lock();
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java Mon Jan
29 02:26:46 2007
@@ -65,15 +65,10 @@
     static final int TCP_NODELAY = 4;
 
     static final int FLAG_SHUTDOWN = 8;
-
-    // This is used in cache get/set
-    //
-    // private static native void oneTimeInitialization(boolean
-    // jcl_supports_ipv6);
-    //
-    // static {
-    // oneTimeInitialization(true);
-    // }
+   
+    static {
+        Platform.getNetworkSystem().oneTimeInitialization(true);
+    }
 
     /**
      * Construct a connection-oriented Socket. The Socket is created in the

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
Mon Jan 29 02:26:46 2007
@@ -204,4 +204,6 @@
 	public boolean isReachableByICMP(InetAddress dest,InetAddress source,int ttl,int timeout);
 	
 	public Channel inheritedChannel();
+    
+    public void oneTimeInitialization(boolean jcl_supports_ipv6);
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
Mon Jan 29 02:26:46 2007
@@ -44,6 +44,9 @@
 	private static OSNetworkSystem ref = new OSNetworkSystem();
     
     private static final int INETADDR_REACHABLE = 0;
+    
+    private static boolean isNetworkInited = false;
+    
 
 	// ----------------------------------------------------
 	// Class Constructor
@@ -679,4 +682,14 @@
 	public Channel inheritedChannel() {
 		return inheritedChannelImpl();
 	}
+    
+    public void oneTimeInitialization(boolean jcl_supports_ipv6){
+        if (!isNetworkInited){
+            oneTimeInitializationImpl(jcl_supports_ipv6);
+        } else {
+            isNetworkInited = true;
+        }
+    }
+    
+    native void oneTimeInitializationImpl (boolean jcl_supports_ipv6);
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
Mon Jan 29 02:26:46 2007
@@ -57,10 +57,8 @@
 setDatagramPacketAddress (JNIEnv * env,	jobject	datagramPacket,	
 	jobject	anInetAddress)
 {
-  /*----------------------former cache get/set ----------------------------
-  //jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_address);
-  */
-  jfieldID fid = getJavaNetDatagramPacketAddress(env);
+  jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_address);
+  //jfieldID fid = getJavaNetDatagramPacketAddress(env);
   (*env)->SetObjectField (env, datagramPacket, fid, anInetAddress);
 }
 
@@ -75,10 +73,8 @@
 void
 setDatagramPacketPort (JNIEnv *	env, jobject datagramPacket, U_16 hPort)
 {
-  /*----------------------former cache get/set ----------------------------
-  //jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_port);
-  */
-  jfieldID fid = getJavaNetDatagramPacketPort(env);
+  jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_port);  
+  //jfieldID fid = getJavaNetDatagramPacketPort(env);
   (*env)->SetIntField (env, datagramPacket, fid, hPort);
 }
 
@@ -93,10 +89,8 @@
 void
 setDatagramPacketLength	(JNIEnv	* env, jobject datagramPacket, I_32 length)
 {
-  /*----------------------former cache get/set ----------------------------
-  //jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_length);
-  */
-  jfieldID fid = getJavaNetDatagramPacketLength(env);
+  jfieldID fid = JCL_CACHE_GET (env, FID_java_net_DatagramPacket_length);
+  //jfieldID fid = getJavaNetDatagramPacketLength(env);
   (*env)->SetIntField (env, datagramPacket, fid, length);
 }
 
@@ -148,16 +142,15 @@
   U_32 length;
   U_32 scope_id	= 0;
   hysock_sockaddr_address6 (sockaddrP, (U_8 *) ipv4Addr, &length, &scope_id);
-  /*-------------- Here is the cache get/set,remain for next change  ---------------
-  
-  //(*env)->SetObjectField (env, senderAddress,	
-  //	  JCL_CACHE_GET	(env,
-  //	     FID_java_net_InetAddress_address),	
-  //	  newJavaByteArray (env, ipv4Addr, length));
-  */
-  (*env)->SetObjectField (env, senderAddress,
+  (*env)->SetObjectField (env, senderAddress,	
+  	  JCL_CACHE_GET	(env,
+  	     FID_java_net_InetAddress_address),	
+  	  newJavaByteArray (env, ipv4Addr, length));
+  /* 
+    (*env)->SetObjectField (env, senderAddress,
 	getJavaNetInetAddressIpaddress(env),
 	newJavaByteArray (env, ipv4Addr, length));
+  */
   if (jcl_supports_ipv6	(env) && (scope_id != 0))
     {
       jclass tempClass = getJavaNetInetAddressClass(env);
@@ -216,10 +209,8 @@
 void
 setSocketImplAddress (JNIEnv * env, jobject socketImpl,	jobject	anInetAddress)
 {
-  /*-------------- Here is the cache get/set,remain for next change  ---------------
-  //jfieldID fid = JCL_CACHE_GET (env, FID_java_net_SocketImpl_address);
-  */
-  jfieldID fid = getJavaNetSocketImplAddress(env);
+  jfieldID fid = JCL_CACHE_GET (env, FID_java_net_SocketImpl_address);  
+  //jfieldID fid = getJavaNetSocketImplAddress(env);
   (*env)->SetObjectField (env, socketImpl, fid,	anInetAddress);	
 }
 
@@ -234,10 +225,8 @@
 void
 setSocketImplPort (JNIEnv * env, jobject socketImpl, U_16 hPort)
 {
-  /*----------------------former cache get/set ---------------
-  //jfieldID fid = JCL_CACHE_GET (env, FID_java_net_SocketImpl_port);
-  */
-  jfieldID fid = getJavaNetSocketImplPort( env);
+  jfieldID fid = JCL_CACHE_GET (env, FID_java_net_SocketImpl_port);  
+  //jfieldID fid = getJavaNetSocketImplPort( env);
   (*env)->SetIntField (env, socketImpl,	fid, hPort);
 }
 
@@ -276,13 +265,11 @@
   setSocketImplPort (env, socketImpl, hysock_ntohs (nPort));
 }
 
-/*----------------------former cache get/set ------------------------------------*/
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    oneTimeInitializationDatagram
  * Signature: (Z)V
  */
- /*
 JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationDatagram(JNIEnv
* env,
 		   jclass clazz,
 		   jboolean
@@ -314,19 +301,18 @@
     return;
   JCL_CACHE_SET	(env, FID_java_net_DatagramPacket_port,	fid);
 }
-*/
+
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    oneTimeInitializationSocket
+ * Method:    oneTimeInitializationImpl
  * Signature: (Z)V
  */
- /*
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationSocket(JNIEnv
* env, jclass clazz,
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationImpl(JNIEnv
* env, jclass clazz,
 	    jboolean jcl_supports_ipv6)	
 {
   jfieldID fid;	
   jclass lookupClass;
-  //netInitializeIDCaches (env,	jcl_supports_ipv6);
+  netInitializeIDCaches (env,	jcl_supports_ipv6);
 
   lookupClass =	(*env)->FindClass (env,	"java/net/SocketImpl");	
   if (!lookupClass)
@@ -335,14 +321,34 @@
   fid =	(*env)->GetFieldID (env, lookupClass, "address", "Ljava/net/InetAddress;");
   if (!fid)
     return;
-  //JCL_CACHE_SET (env,	FID_java_net_SocketImpl_address, fid);
+  JCL_CACHE_SET (env,	FID_java_net_SocketImpl_address, fid);
 
   fid =	(*env)->GetFieldID (env, lookupClass, "port", "I");
   if (!fid)
     return;
-  //JCL_CACHE_SET (env,	FID_java_net_SocketImpl_port, fid);
+  JCL_CACHE_SET (env,	FID_java_net_SocketImpl_port, fid);
+  
+    lookupClass =	(*env)->FindClass (env,	"java/net/DatagramPacket");
+  if (!lookupClass)
+    return;
+
+  fid =	
+    (*env)->GetFieldID (env, lookupClass, "address",
+      "Ljava/net/InetAddress;");
+  if (!fid)
+    return;
+  JCL_CACHE_SET	(env, FID_java_net_DatagramPacket_address, fid);
+
+  fid =	(*env)->GetFieldID (env, lookupClass, "length",	"I");
+  if (!fid)
+    return;
+  JCL_CACHE_SET	(env, FID_java_net_DatagramPacket_length, fid);	
+
+  fid =	(*env)->GetFieldID (env, lookupClass, "port", "I");
+  if (!fid)
+    return;
+  JCL_CACHE_SET	(env, FID_java_net_DatagramPacket_port,	fid);
 }
-*/
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -548,7 +554,7 @@
 	socketP	=getJavaIoFileDescriptorContentsAsAPointer (env, afd);
 	if (!hysock_socketIsValid (socketP))
     	{
-                // return silently, leave validation in real I/O operation
+            // return silently, leave validation in real I/O operation
       		return ;
     	}
 	result = hysock_set_nonblocking(socketP,nonblocking);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c Mon
Jan 29 02:26:46 2007
@@ -440,10 +440,10 @@
   jclass tempClass;
   jmethodID tempMethod;
 
-  /*former: tempClass = JCL_CACHE_GET (env, CLS_java_lang_Boolean);*/
-  tempClass = getJavaLangBooleanClass(env);
-  /*fromer: tempMethod = JCL_CACHE_GET (env, MID_java_lang_Boolean_init);*/
-  tempMethod = getJavaLangBooleanInit(env);
+  tempClass = JCL_CACHE_GET (env, CLS_java_lang_Boolean);
+  //tempClass = getJavaLangBooleanClass(env);
+  tempMethod = JCL_CACHE_GET (env, MID_java_lang_Boolean_init);
+  //tempMethod = getJavaLangBooleanInit(env);
   return (*env)->NewObject (env, tempClass, tempMethod, (jboolean) aBool);
 }
 
@@ -462,10 +462,10 @@
   jclass tempClass;
   jmethodID tempMethod;
 
-  /*tempClass = JCL_CACHE_GET (env, CLS_java_lang_Byte);*/
-  tempClass = getJavaLangByteClass(env);
-  tempMethod = getJavaLangByteInit(env);
-  /*tempMethod = JCL_CACHE_GET (env, MID_java_lang_Byte_init);*/
+  tempClass = JCL_CACHE_GET (env, CLS_java_lang_Byte);
+  tempMethod = JCL_CACHE_GET (env, MID_java_lang_Byte_init);
+  //tempClass = getJavaLangByteClass(env);
+  //tempMethod = getJavaLangByteInit(env);
   return (*env)->NewObject (env, tempClass, tempMethod, (jbyte) aByte);
 }
 
@@ -484,10 +484,10 @@
   jclass tempClass;
   jmethodID tempMethod;
 
-  /*tempClass = JCL_CACHE_GET (env, CLS_java_lang_Integer);
-  //tempMethod = JCL_CACHE_GET (env, MID_java_lang_Integer_init);*/
-  tempClass = getJavaLangIntegerClass(env);
-  tempMethod = getJavaLangIntegerInit(env);
+  tempClass = JCL_CACHE_GET (env, CLS_java_lang_Integer);
+  tempMethod = JCL_CACHE_GET (env, MID_java_lang_Integer_init);
+  //tempClass = getJavaLangIntegerClass(env);
+  //tempMethod = getJavaLangIntegerInit(env);
   return (*env)->NewObject (env, tempClass, tempMethod, (jint) anInt);
 }
 
@@ -549,13 +549,13 @@
 BOOLEAN
 booleanValue (JNIEnv * env, jobject aBoolean)
 {
-  /*return (BOOLEAN) ((*env)->
-  //      GetBooleanField (env, aBoolean,
-  //           JCL_CACHE_GET (env,
-  //              FID_java_lang_Boolean_value)));*/
   return (BOOLEAN) ((*env)->
         GetBooleanField (env, aBoolean,
-             getJavaLangBooleanValue(env)));
+             JCL_CACHE_GET (env,
+                FID_java_lang_Boolean_value)));
+  /*return (BOOLEAN) ((*env)->
+        GetBooleanField (env, aBoolean,
+             getJavaLangBooleanValue(env)));*/
 }
 
 /**
@@ -570,12 +570,12 @@
 U_8
 byteValue (JNIEnv * env, jobject aByte)
 {
-  /*return (U_8) ((*env)->
-  //  GetByteField (env, aByte,
-  //          JCL_CACHE_GET (env, FID_java_lang_Byte_value)));*/
   return (U_8) ((*env)->
     GetByteField (env, aByte,
-            getJavaLangByteValue(env)));
+            JCL_CACHE_GET (env, FID_java_lang_Byte_value)));
+  /*return (U_8) ((*env)->
+    GetByteField (env, aByte,
+            getJavaLangByteValue(env)));*/
 }
 
 /**
@@ -590,14 +590,13 @@
 I_32
 intValue (JNIEnv * env, jobject anInteger)
 {
-  /*return (I_32) ((*env)->
-  //   GetIntField (env, anInteger,
-  //          JCL_CACHE_GET (env,
-  //             FID_java_lang_Integer_value)));
-  */
   return (I_32) ((*env)->
      GetIntField (env, anInteger,
-            getJavaLangIntegerValue(env)));
+            JCL_CACHE_GET (env,
+               FID_java_lang_Integer_value)));
+  /*return (I_32) ((*env)->
+     GetIntField (env, anInteger,
+            getJavaLangIntegerValue(env)));*/
 }
 
 /**
@@ -736,14 +735,13 @@
 netGetJavaNetInetAddressValue (JNIEnv * env, jobject anInetAddress,
              U_8 * buffer, U_32 * length)
 {
-  /*jbyteArray byte_array =
-  //  (jbyteArray) ((*env)->GetObjectField (env, anInetAddress,
-  //          JCL_CACHE_GET (env,
-  //             FID_java_net_InetAddress_address)));
-  */
   jbyteArray byte_array =
     (jbyteArray) ((*env)->GetObjectField (env, anInetAddress,
-            getJavaNetInetAddressIpaddress(env)));
+            JCL_CACHE_GET (env,
+               FID_java_net_InetAddress_address)));
+  /*jbyteArray byte_array =
+    (jbyteArray) ((*env)->GetObjectField (env, anInetAddress,
+            getJavaNetInetAddressIpaddress(env)));*/
   *length = (*env)->GetArrayLength (env, byte_array);
   (*env)->GetByteArrayRegion (env, byte_array, 0, *length, (jbyte *)buffer);
 }
@@ -762,11 +760,11 @@
   jclass tempClass;
   jobject globalRef;
 
-  /*tempClass = JCL_CACHE_GET (env, CLS_java_lang_Thread);
-  //tempMethod = JCL_CACHE_GET (env, MID_java_lang_Thread_yield);
-  */
-  tempClass = getJavaLangThreadClass(env);
-  tempMethod = getJavaLangThreadYield(env);
+  tempClass = JCL_CACHE_GET (env, CLS_java_lang_Thread);
+  tempMethod = JCL_CACHE_GET (env, MID_java_lang_Thread_yield);
+  
+  //tempClass = getJavaLangThreadClass(env);
+  //tempMethod = getJavaLangThreadYield(env);
   if (tempClass == 0)
     {
       tempClass = (*env)->FindClass (env, "java/lang/Thread");
@@ -778,9 +776,8 @@
       tempMethod = (*env)->GetStaticMethodID (env, tempClass, "yield", "()V");
       if (!tempMethod)
         return;
-      /*JCL_CACHE_SET (env, CLS_java_lang_Thread, globalRef);
-      //JCL_CACHE_SET (env, MID_java_lang_Thread_yield, tempMethod);
-      */
+      JCL_CACHE_SET (env, CLS_java_lang_Thread, globalRef);
+      JCL_CACHE_SET (env, MID_java_lang_Thread_yield, tempMethod);      
     }
   (*env)->CallStaticVoidMethod (env, tempClass, tempMethod);
 }
@@ -929,11 +926,8 @@
 BOOLEAN
 jcl_supports_ipv6 (JNIEnv * env)
 {
-  static int support = 1;
-  /*return (BOOLEAN) JCL_CACHE_GET (env, jcl_supports_ipv6);
-  //TODO check support
-  */
-  return (BOOLEAN) support;
+  return (BOOLEAN) JCL_CACHE_GET (env, jcl_supports_ipv6);
+  //return (BOOLEAN) support;
 }
 
 /**
@@ -1039,18 +1033,18 @@
       tempMethodWithScope = NULL;
       if (scope_id != 0)
         {
-          /*tempMethodWithScope =
-          //  (*env)->GetStaticMethodID (env,
-          //  JCL_CACHE_GET (env,
-          //  CLS_java_net_InetAddress),
-          //  "getByAddress",
-          //  "([BI)Ljava/net/InetAddress;");
-          */
           tempMethodWithScope =
             (*env)->GetStaticMethodID (env,
-            getJavaNetInetAddressClass(env),
+            JCL_CACHE_GET (env,
+            CLS_java_net_InetAddress),
             "getByAddress",
             "([BI)Ljava/net/InetAddress;");
+          
+          /*tempMethodWithScope =
+            (*env)->GetStaticMethodID (env,
+            getJavaNetInetAddressClass(env),
+            "getByAddress",
+            "([BI)Ljava/net/InetAddress;");*/
           if ((*env)->ExceptionCheck (env))
             {
               (*env)->ExceptionClear (env);
@@ -1061,33 +1055,31 @@
       if (tempMethodWithScope != NULL)
         {
           /* create using the scope id */
-          /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);*/
-          tempClass = getJavaNetInetAddressClass(env);
+          tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+          //tempClass = getJavaNetInetAddressClass(env);
           return (*env)->CallStaticObjectMethod (env, tempClass,
             tempMethodWithScope,
             byte_array, scope_id);
         }
       else
         {
-          /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);*/
-          tempClass = getJavaNetInetAddressClass(env);
-          /*tempMethod =
-          //  JCL_CACHE_GET (env,
-          //  MID_java_net_InetAddress_getByAddress_byteArray);
-          */
-          tempMethod = getJavaNetInetAddressGetByAddressByteArray(env);
+          tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+          //tempClass = getJavaNetInetAddressClass(env);
+          tempMethod =
+            JCL_CACHE_GET (env,
+            MID_java_net_InetAddress_getByAddress_byteArray);
+          //tempMethod = getJavaNetInetAddressGetByAddressByteArray(env);
           return (*env)->CallStaticObjectMethod (env, tempClass, tempMethod,
             byte_array);
         }
     }
   else
     {
-      /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
-      //tempMethod =
-      //  JCL_CACHE_GET (env, MID_java_net_InetAddress_init_byteArray);
-      */
-      tempClass = getJavaNetInetAddressClass(env);
-      tempMethod = getJavaNetInetAddressInitByteArray(env);
+      tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+      tempMethod =
+        JCL_CACHE_GET (env, MID_java_net_InetAddress_init_byteArray);
+      //tempClass = getJavaNetInetAddressClass(env);
+      //tempMethod = getJavaNetInetAddressInitByteArray(env);
       return (*env)->NewObject (env, tempClass, tempMethod, byte_array);
     }
 }
@@ -1177,18 +1169,18 @@
       tempMethodWithScope = NULL;
       if (scope_id != 0)
         {
-          /* tempMethodWithScope =
+          tempMethodWithScope =
             (*env)->GetStaticMethodID (env,
             JCL_CACHE_GET (env,
             CLS_java_net_InetAddress),
             "getByAddress",
             "(Ljava/lang/String;[BI)Ljava/net/InetAddress;");
-          */
-          tempMethodWithScope =
+          
+          /*tempMethodWithScope =
             (*env)->GetStaticMethodID (env,
             getJavaNetInetAddressClass(env),
             "getByAddress",
-            "(Ljava/lang/String;[BI)Ljava/net/InetAddress;");
+            "(Ljava/lang/String;[BI)Ljava/net/InetAddress;");*/
           if ((*env)->ExceptionCheck (env))
             {
               (*env)->ExceptionClear (env);
@@ -1199,34 +1191,34 @@
       if (tempMethodWithScope != NULL)
         {
           /* create using the scope id */
-          /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);*/
-          tempClass = getJavaNetInetAddressClass(env);
+          tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+          //tempClass = getJavaNetInetAddressClass(env);
           return (*env)->CallStaticObjectMethod (env, tempClass,
             tempMethodWithScope, aString,
             byte_array, scope_id);
         }
       else
         {
-          /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+          tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
           tempMethod =
             JCL_CACHE_GET (env,
             MID_java_net_InetAddress_getByAddress_Ljava_lang_String_byteArray);
-          */
-          tempClass = getJavaNetInetAddressClass(env);
-          tempMethod = getJavaNetInetAddressGetByAddressStringByte(env);
+          
+          //tempClass = getJavaNetInetAddressClass(env);
+          //tempMethod = getJavaNetInetAddressGetByAddressStringByte(env);
           return (*env)->CallStaticObjectMethod (env, tempClass, tempMethod,
             aString, byte_array);
         }
       }
     else
       {
-        /*tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+        tempClass = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
         tempMethod =
           JCL_CACHE_GET (env,
           MID_java_net_InetAddress_init_byteArrayLjava_lang_String);
-        */
-        tempClass = getJavaNetInetAddressClass(env);
-        tempMethod = getJavaNetInetAddressInitByteString(env);        
+        
+        //tempClass = getJavaNetInetAddressClass(env);
+        //tempMethod = getJavaNetInetAddressInitByteString(env);        
         return (*env)->NewObject (env, tempClass, tempMethod, byte_array,
           aString);
     }
@@ -1288,16 +1280,16 @@
       return TRUE;
     }
 
-  /*result =
+  result =
     (*env)->CallStaticBooleanMethod (env,
              JCL_CACHE_GET (env, CLS_java_net_Socket),
              JCL_CACHE_GET (env,
                 MID_java_net_Socket_preferIPv4Stack));
-  */
-  result =
+  
+  /*result =
     (*env)->CallStaticBooleanMethod (env,
              getJavaNetSocketClass(env),
-             getJavaNetSocketPreferIPv4Stack(env));
+             getJavaNetSocketPreferIPv4Stack(env));*/
   if ((*env)->ExceptionCheck (env))
     {
       /* older JCLs do not have the right code for security checks so this may fail with
an exception
@@ -1330,17 +1322,17 @@
       return FALSE;
     }
 
-  /*result =
+  result =
     (*env)->CallStaticBooleanMethod (env,
              JCL_CACHE_GET (env,
                 CLS_java_net_InetAddress),
              JCL_CACHE_GET (env,
                 MID_java_net_InetAddress_preferIPv6Addresses));
-  */
+  /*
   result =
     (*env)->CallStaticBooleanMethod (env,
              getJavaNetInetAddressClass(env),
-             getJavaNetInetAddressPreferIPv6Addresses(env)); 
+             getJavaNetInetAddressPreferIPv6Addresses(env));*/ 
   if ((*env)->ExceptionCheck (env))
     {
       /* older JCLs do not have the right code for security checks so this may fail with
an exception

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/libhyluni.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/libhyluni.exp?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/libhyluni.exp (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/libhyluni.exp Mon
Jan 29 02:26:46 2007
@@ -242,6 +242,7 @@
 		Java_org_apache_harmony_luni_platform_OSNetworkSystem_setInetAddressImpl;
         Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl;
         Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl;
+        Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationImpl;
 	Java_org_apache_harmony_luni_platform_Environment_getEnvBytes;
 	Java_org_apache_harmony_luni_platform_Environment_getEnvByName;
 	local : *;

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/DatagramChannel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/DatagramChannel.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/DatagramChannel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/DatagramChannel.java
Mon Jan 29 02:26:46 2007
@@ -24,6 +24,8 @@
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+import org.apache.harmony.luni.platform.Platform;
+
 /**
  * A DatagramChannel is a selectable channel for part abstraction of datagram
  * socket. The <code>socket</code> method of this class can return the related
@@ -45,6 +47,10 @@
 public abstract class DatagramChannel extends AbstractSelectableChannel
 		implements ByteChannel, ScatteringByteChannel, GatheringByteChannel {
 
+    static {
+        Platform.getNetworkSystem().oneTimeInitialization(true);
+    }
+    
 	/**
 	 * Constructor for this class.
 	 * 

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/SocketChannel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/SocketChannel.java?view=diff&rev=500999&r1=500998&r2=500999
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/SocketChannel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/SocketChannel.java
Mon Jan 29 02:26:46 2007
@@ -24,6 +24,8 @@
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
+import org.apache.harmony.luni.platform.Platform;
+
 /**
  * A SocketChannel is a selectable channel for part abstraction of stream
  * connecting socket. The <code>socket</code> method of this class can return
@@ -59,6 +61,10 @@
 public abstract class SocketChannel extends AbstractSelectableChannel implements
 		ByteChannel, ScatteringByteChannel, GatheringByteChannel {
 
+    static {
+        Platform.getNetworkSystem().oneTimeInitialization(true);
+    }
+    
 	/**
 	 * Constructor for this class.
 	 * 



Mime
View raw message