You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/10/06 16:57:51 UTC

svn commit: r822302 [3/5] - in /harmony/enhanced/classlib/branches/java6: ./ depends/build/ depends/build/platform/ depends/files/ depends/libs/windows.x86/ depends/oss/ make/ modules/accessibility/ modules/annotation/ modules/annotation/make/ modules/...

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Tue Oct  6 14:57:42 2009
@@ -712,3 +712,81 @@
 
   return result;
 }
+
+JNIEXPORT jint JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writev
+(JNIEnv *env, jobject thiz, jobject fd, jobjectArray buffers, jintArray offset, jintArray counts, jint length) {
+
+  PORT_ACCESS_FROM_ENV(env);
+
+  jobject buffer;
+  jobject* toBeReleasedBuffers;
+  jint *noffset;
+  jboolean isDirectBuffer = JNI_FALSE;
+  jint result;
+  jclass byteBufferClass;
+  struct iovec* vect;
+  int i;
+
+  hysocket_t socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
+
+  if (!hysock_socketIsValid(socketP)) {
+    throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
+    return (jint) 0;
+  }
+
+  vect = (struct iovec*) hymem_allocate_memory(sizeof(struct iovec) * length);
+  if (vect == NULL) {
+    throwNewOutOfMemoryError(env, "");
+    return 0;
+  }
+
+  toBeReleasedBuffers = (jobject*) hymem_allocate_memory(sizeof(jobject) * length);
+  if (toBeReleasedBuffers == NULL) {
+    throwNewOutOfMemoryError(env, "");
+    return 0;
+  }
+
+  byteBufferClass = HARMONY_CACHE_GET (env, CLS_java_nio_DirectByteBuffer);
+  noffset = (*env)->GetIntArrayElements(env, offset, NULL);
+
+  for (i = 0; i < length; ++i) {
+    jint *cts;
+    buffer = (*env)->GetObjectArrayElement(env, buffers, i);
+    isDirectBuffer = (*env)->IsInstanceOf(env, buffer, byteBufferClass);
+    if (isDirectBuffer) {
+      vect[i].iov_base =  (U_8 *)(jbyte *)(IDATA) (*env)->GetDirectBufferAddress(env, buffer) + noffset[i];
+      toBeReleasedBuffers[i] = NULL;
+    } else {
+      vect[i].iov_base = (U_8 *)(jbyte *)(IDATA) (*env)->GetByteArrayElements(env, buffer, NULL) + noffset[i];
+      toBeReleasedBuffers[i] = buffer;
+    }
+    cts = (*env)->GetPrimitiveArrayCritical(env, counts, NULL);
+    vect[i].iov_len = cts[i];
+    (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
+  }
+
+
+  result = writev(SOCKET_CAST (socketP), vect, length);
+
+  for (i = 0; i < length; ++i) {
+    if (toBeReleasedBuffers[i] != NULL) {
+      (*env)->ReleaseByteArrayElements(env, toBeReleasedBuffers[i], vect[i].iov_base - noffset[i], JNI_ABORT);
+    }
+  }
+
+  (*env)->ReleaseIntArrayElements(env, offset, noffset, JNI_ABORT);
+
+  hymem_free_memory(toBeReleasedBuffers);
+  hymem_free_memory(vect);
+
+  if (0 > result) {
+      if (errno == EAGAIN) {
+          return 0;
+      }
+    throwJavaNetSocketException(env, result);
+    return (jint) 0;  // Ignored, exception takes precedence
+  }
+
+  return (jint) result;
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/exports.txt?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/exports.txt (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/exports.txt Tue Oct  6 14:57:42 2009
@@ -32,7 +32,6 @@
 Java_java_io_File_getLinkImpl
 Java_java_io_File_getUsableSpaceImpl
 Java_java_io_File_getTotalSpaceImpl
-Java_java_io_File_isAbsoluteImpl
 Java_java_io_File_isCaseSensitiveImpl
 Java_java_io_File_isDirectoryImpl
 Java_java_io_File_isFileImpl
@@ -163,7 +162,7 @@
 Java_org_apache_harmony_luni_platform_OSMemory_getPointerSizeImpl
 Java_org_apache_harmony_luni_platform_OSMemory_getAddress
 Java_org_apache_harmony_luni_platform_OSMemory_setAddress
-Java_org_apache_harmony_luni_platform_OSMemory_mallocNative
+Java_org_apache_harmony_luni_platform_OSMemory_malloc
 Java_org_apache_harmony_luni_platform_OSMemory_free
 Java_org_apache_harmony_luni_platform_OSMemory_memmove
 Java_org_apache_harmony_luni_platform_OSMemory_memset
@@ -186,6 +185,7 @@
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_readDirect
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_write
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writev
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlocking
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_connect
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeout
@@ -226,7 +226,6 @@
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannel
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationImpl
-Java_org_apache_harmony_luni_platform_OSResourcesMonitor_isSystemPhysicalMemoryLow
 Java_org_apache_harmony_luni_platform_Environment_getEnvBytes
 Java_org_apache_harmony_luni_platform_Environment_getEnvByName
 Java_java_io_File_setExecutableImpl

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c Tue Oct  6 14:57:42 2009
@@ -212,12 +212,6 @@
 
 }
 
-jbyteArray
-getPlatformPath (JNIEnv * env, jbyteArray path)
-{
-  return NULL;
-}
-
 void
 setPlatformBindOptions (JNIEnv * env, hysocket_t socketP)
 {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h Tue Oct  6 14:57:42 2009
@@ -38,7 +38,6 @@
 } interfaceAddressArray_struct;
 
 int platformReadLink (char *link);
-jbyteArray getPlatformPath (JNIEnv * env, jbyteArray path);
 void setDefaultServerSocketOptions (JNIEnv * env, hysocket_t socketP);
 I_32 getPlatformRoots (char *rootStrings);
 char *getCommports (JNIEnv * env);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/makefile Tue Oct  6 14:57:42 2009
@@ -38,7 +38,7 @@
 	$(SHAREDSUB)filedesc.o $(SHAREDSUB)timezone.o \
 	$(SHAREDSUB)OSFileSystem.o OSFileSystemLinux32.o \
 	$(SHAREDSUB)OSMemory.o OSMemoryLinux32.o $(SHAREDSUB)OSNetworkSystem.o \
-	OSNetworkSystemLinux.o $(HY_OS)/OSResourcesMonitor.o hyenv.o consoleimpl.o
+	OSNetworkSystemLinux.o hyenv.o consoleimpl.o
 
 ifneq ($(HY_ZIP_API),true)
 MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
@@ -47,7 +47,7 @@
 MDLLIBFILES += $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a \
 	$(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
-DLLNAME = ../libhyluni$(HY_SHLIB_SUFFIX)
+DLLNAME = $(DLLPATH)libhyluni$(HY_SHLIB_SUFFIX)
 EXPNAME = HYLUNI_0.1
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c Tue Oct  6 14:57:42 2009
@@ -434,3 +434,88 @@
   return result;
 }
 
+JNIEXPORT jint JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writev
+  (JNIEnv *env, jobject thiz, jobject fd, jobjectArray buffers, jintArray offsets, jintArray counts, jint length) {
+
+  PORT_ACCESS_FROM_ENV(env);
+
+  jobject buffer;
+  jobject* toBeReleasedBuffers;
+  jint *noffset;
+  jboolean isDirectBuffer = JNI_FALSE;
+  jint result;
+  LPWSABUF vect;
+  int i;
+  jint sentBytes;
+  jint rc;
+  jclass byteBufferClass;
+
+  hysocket_t socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
+
+  if (!hysock_socketIsValid(socketP)) {
+    throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
+    return (jint) 0;
+  }
+
+  vect = (LPWSABUF) hymem_allocate_memory(sizeof(WSABUF) * length);
+  if (vect == NULL) {
+    throwNewOutOfMemoryError(env, "");
+    return 0;
+  }
+
+  toBeReleasedBuffers = (jobject*) hymem_allocate_memory(sizeof(jobject) * length);
+  if (toBeReleasedBuffers == NULL) {
+    throwNewOutOfMemoryError(env, "");
+    return 0;
+  }
+
+  byteBufferClass = HARMONY_CACHE_GET (env, CLS_java_nio_DirectByteBuffer);
+  noffset = (*env)->GetIntArrayElements(env, offsets, NULL);
+
+  for (i = 0; i < length; ++i) {
+    jint *cts;
+    buffer = (*env)->GetObjectArrayElement(env, buffers, i);
+    isDirectBuffer = (*env)->IsInstanceOf(env, buffer, byteBufferClass);
+    if (isDirectBuffer) {
+      vect[i].buf =  (U_8 *)(jbyte *)(IDATA) (*env)->GetDirectBufferAddress(env, buffer) + noffset[i];
+      toBeReleasedBuffers[i] = NULL;
+    } else {
+      vect[i].buf = (U_8 *)(jbyte *)(IDATA) (*env)->GetByteArrayElements(env, buffer, NULL) + noffset[i];
+      toBeReleasedBuffers[i] = buffer;
+    }
+
+    cts = (*env)->GetPrimitiveArrayCritical(env, counts, NULL);
+    vect[i].len = cts[i];
+    (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
+
+  }
+
+  if (socketP->flags & SOCKET_USE_IPV4_MASK)
+    {
+      result = WSASend(socketP->ipv4, vect, length, &sentBytes, HYSOCK_NOFLAGS, NULL, NULL);
+    }
+  else
+    {
+      result = WSASend(socketP->ipv6, vect, length, &sentBytes, HYSOCK_NOFLAGS, NULL, NULL);
+    }
+
+  for (i = 0; i < length; ++i) {
+    if (toBeReleasedBuffers[i] != NULL) {
+      (*env)->ReleaseByteArrayElements(env, toBeReleasedBuffers[i], vect[i].buf - noffset[i], JNI_ABORT);
+    }
+  }
+
+  (*env)->ReleaseIntArrayElements(env, offsets, noffset, JNI_ABORT);
+
+  hymem_free_memory(toBeReleasedBuffers);
+  hymem_free_memory(vect);
+
+  if (SOCKET_ERROR == result) {
+    rc = WSAGetLastError ();
+    throwJavaNetSocketException(env, rc);
+    return (jint) 0;  // Ignored, exception takes precedence
+  }
+
+  return sentBytes;
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.c?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.c Tue Oct  6 14:57:42 2009
@@ -38,7 +38,6 @@
 #include <iphlpapi.h>
 
 int platformReadLink (char *link);
-jbyteArray getPlatformPath (JNIEnv * env, jbyteArray path);
 void setDefaultServerSocketOptions (JNIEnv * env, hysocket_t socketP);
 jint getPlatformDatagramNominalSize (JNIEnv * env, hysocket_t socketP);
 I_32 getPlatformRoots (char *rootStrings);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.h?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/helpers.h Tue Oct  6 14:57:42 2009
@@ -35,7 +35,6 @@
 } interfaceAddressArray_struct;
 
 int platformReadLink (char *link);
-jbyteArray getPlatformPath (JNIEnv * env, jbyteArray path);
 void setDefaultServerSocketOptions (JNIEnv * env, hysocket_t socketP);
 jint getPlatformDatagramNominalSize (JNIEnv * env, hysocket_t socketP);
 I_32 getPlatformRoots (char *rootStrings);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/makefile Tue Oct  6 14:57:42 2009
@@ -20,7 +20,7 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hyluni
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
@@ -37,7 +37,7 @@
   OSFileSystemWin32.obj hyenv.obj\
   $(SHAREDSUB)OSFileSystem.obj OSMemoryWin32.obj $(SHAREDSUB)OSMemory.obj \
   $(SHAREDSUB)OSNetworkSystem.obj OSNetworkSystemWin32.obj \
-  OSResourcesMonitorWin32.obj consoleimpl.obj
+  consoleimpl.obj
 
 VIRTFILES = hyluni.res
 

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/vmi/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/vmi/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/vmi/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/vmi/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/vmi/unix/makefile Tue Oct  6 14:57:42 2009
@@ -24,5 +24,6 @@
 
 DLLNAME = ../libvmi$(HY_SHLIB_SUFFIX)
 EXPNAME = VMI_0.1
+HY_CAN_LINK_DEBUG=no
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileTest.java Tue Oct  6 14:57:42 2009
@@ -1073,11 +1073,29 @@
             assertTrue("Absolute returned false", (f.isAbsolute() && !f1
                     .isAbsolute())
                     || (!f.isAbsolute() && f1.isAbsolute()));
+
+            assertTrue(new File("C:/").isAbsolute());
+            assertTrue(new File("f:/").isAbsolute());
+            assertTrue(new File("f:\\").isAbsolute());
+            assertFalse(new File("f:").isAbsolute());
+            assertFalse(new File("K:").isAbsolute());
+            assertTrue(new File("\\\\").isAbsolute());
+            assertTrue(new File("\\\\\\").isAbsolute());
+            assertTrue(new File("\\\\hello").isAbsolute());
+            assertFalse(new File("\\").isAbsolute());
+            assertFalse(new File("/").isAbsolute());
         } else {
             File f = new File("/test");
             File f1 = new File("\\test");
             assertTrue("Absolute returned false", f.isAbsolute());
             assertFalse("Absolute returned true", f1.isAbsolute());
+            assertTrue(new File("//test").isAbsolute());
+            assertFalse(new File("test").isAbsolute());
+            assertFalse(new File("c:/").isAbsolute());
+            assertFalse(new File("c:\\").isAbsolute());
+            assertFalse(new File("c:").isAbsolute());
+            assertFalse(new File("\\").isAbsolute());
+            assertFalse(new File("\\\\").isAbsolute());
         }
         assertTrue("Non-Absolute returned true", !new File("../test")
                 .isAbsolute());

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/MathTest.java Tue Oct  6 14:57:42 2009
@@ -388,13 +388,30 @@
     /**
      * @tests java.lang.Math#floor(double)
      */
-	public void test_floorD() {
-		// Test for method double java.lang.Math.floor(double)
-                assertEquals("Incorrect floor for double",
-                             78, Math.floor(78.89), 0);
-		assertEquals("Incorrect floor for double",
-                             -79, Math.floor(-78.89), 0);
-	}
+    public void test_floorD() {
+        assertEquals("Incorrect floor for int", 42, Math.floor(42), 0);
+        assertEquals("Incorrect floor for -int", -2, Math.floor(-2), 0);
+        assertEquals("Incorrect floor for zero", 0d, Math.floor(0d), 0);
+
+        assertEquals("Incorrect floor for +double", 78, Math.floor(78.89), 0);
+        assertEquals("Incorrect floor for -double", -79, Math.floor(-78.89), 0);
+        assertEquals("floor large +double", 3.7314645675925406E19, Math.floor(3.7314645675925406E19), 0);
+        assertEquals("floor large -double", -8.173521839218E12, Math.floor(-8.173521839218E12), 0);
+        assertEquals("floor small double", 0.0d, Math.floor(1.11895241315E-102), 0);
+
+        // Compare toString representations here since -0.0 = +0.0, and
+        // NaN != NaN and we need to distinguish
+        assertEquals("Floor failed for NaN",
+                Double.toString(Double.NaN), Double.toString(Math.floor(Double.NaN)));
+        assertEquals("Floor failed for +0.0",
+                Double.toString(+0.0d), Double.toString(Math.floor(+0.0d)));
+        assertEquals("Floor failed for -0.0",
+                Double.toString(-0.0d), Double.toString(Math.floor(-0.0d)));
+        assertEquals("Floor failed for +infinity",
+                Double.toString(Double.POSITIVE_INFINITY), Double.toString(Math.floor(Double.POSITIVE_INFINITY)));
+        assertEquals("Floor failed for -infinity",
+                Double.toString(Double.NEGATIVE_INFINITY), Double.toString(Math.floor(Double.NEGATIVE_INFINITY)));
+    }
 	
 	/**
      * cases for test_getExponent_D in MathTest/StrictMathTest

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/resources/net.resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct  6 14:57:42 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-814402
+/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/net.resources:790472-822279

Modified: harmony/enhanced/classlib/branches/java6/modules/math/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/build.xml Tue Oct  6 14:57:42 2009
@@ -81,6 +81,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/math.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/math.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/math.jar"
              manifest="META-INF/MANIFEST.MF"

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/build.xml Tue Oct  6 14:57:42 2009
@@ -84,6 +84,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/misc.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/misc.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/misc.jar"
              manifest="META-INF/MANIFEST.MF"
@@ -110,21 +117,6 @@
     <target name="build-native" depends="build-native-all" />
     <target name="build-native-all" >
         <make dir="src/main/native/accessors/${hy.os.family}" />
-
-        <!-- Copy the built shared libs over to the jre/bin dir -->
-        <copy todir="${hy.jdk}/jre/bin" preservelastmodified="true">
-            <fileset dir="src/main/native/accessors">
-                <include name="*${shlib.suffix}*"/>
-                <include name="*${progdb.suffix}*" if="is.windows" />
-                <exclude name="*${manifest.suffix}"/>
-            </fileset>
-        </copy>
-        <!-- Copy link exports file on z/OS -->
-        <copy todir="${hy.hdk}/lib" preservelastmodified="true">
-            <fileset dir="src/main/native/accessors/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
     
     <target name="test-jar" depends="svn-info,compile-tests">

Propchange: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ArrayAccessorImpl.c Tue Oct  6 14:57:42 2009
@@ -63,29 +63,29 @@
  * Method:    staticUnpin<Type>ArrayNoCopy
  * Signature: (Ljava/lang/Object;J)V
  */
-#define pinFunctions(TypeArray, TypeArrayNoCopy, TypeArrayElements, typeArray, t) \
-JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticPin##TypeArray \
+#define pinFunctions(Type, t) \
+JNIEXPORT jlong JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticPin##Type##Array \
 (JNIEnv *env, jclass clss, jobject array) { \
     jboolean isCopy; \
-    return addr2jlong((*env)->Get##TypeArrayElements(env, (typeArray)array, &isCopy)); \
+    return addr2jlong((*env)->Get##Type##ArrayElements(env, (t##Array)array, &isCopy)); \
 } \
-JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##TypeArray \
+JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##Type##Array \
 (JNIEnv *env, jclass clss, jobject array, jlong addr) { \
-  (*env)->Release##TypeArrayElements(env, (typeArray)array, jlong2addr(t, addr), 0); \
+  (*env)->Release##Type##ArrayElements(env, (t##Array)array, jlong2addr(t, addr), 0); \
 } \
-JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##TypeArrayNoCopy \
+JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_staticUnpin##Type##ArrayNoCopy \
 (JNIEnv *env, jclass clss, jobject array, jlong addr) { \
-  (*env)->Release##TypeArrayElements(env, (typeArray)array, jlong2addr(t, addr), JNI_ABORT); \
+  (*env)->Release##Type##ArrayElements(env, (t##Array)array, jlong2addr(t, addr), JNI_ABORT); \
 }
 
-pinFunctions(ByteArray, ByteArrayNoCopy, ByteArrayElements, jbyteArray, jbyte)
-pinFunctions(CharArray, CharArrayNoCopy, CharArrayElements, jcharArray, jchar)
-pinFunctions(ShortArray, ShortArrayNoCopy, ShortArrayElements, jshortArray, jshort)
-pinFunctions(IntArray, IntArrayNoCopy, IntArrayElements, jintArray, jint)
-pinFunctions(LongArray, LongArrayNoCopy, LongArrayElements, jlongArray, jlong)
-pinFunctions(BooleanArray, BooleanArrayNoCopy, BooleanArrayElements, jbooleanArray, jboolean)
-pinFunctions(FloatArray, FloatArrayNoCopy, FloatArrayElements, jfloatArray, jfloat)
-pinFunctions(DoubleArray, DoubleArrayNoCopy, DoubleArrayElements, jdoubleArray, jdouble)
+pinFunctions(Byte, jbyte)
+pinFunctions(Char, jchar)
+pinFunctions(Short, jshort)
+pinFunctions(Int, jint)
+pinFunctions(Long, jlong)
+pinFunctions(Boolean, jboolean)
+pinFunctions(Float, jfloat)
+pinFunctions(Double, jdouble)
 
 
 
@@ -96,29 +96,29 @@
  * Method:    setElement
  * Signature: ([TIT)V
  */
-#define setGetFunctions(TI, TIT, t, typeArray) \
- JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_getElement___3##TI \
-  (JNIEnv *env, jobject obj, typeArray array, jint index) { \
+#define setGetFunctions(T, t) \
+ JNIEXPORT t JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_getElement___3##T##I \
+  (JNIEnv *env, jobject obj, t##Array array, jint index) { \
     t* ptr = (t*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, NULL); \
     t res = ptr[index]; \
     (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, ptr, 0); \
     return res; \
   } \
- JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_setElement___3##TIT \
-(JNIEnv *env, jobject obj, typeArray array, jint index, t value) { \
+ JNIEXPORT void JNICALL Java_org_apache_harmony_misc_accessors_ArrayAccessor_setElement___3##T##I##T \
+(JNIEnv *env, jobject obj, t##Array array, jint index, t value) { \
     t* ptr = (t*)(*env)->GetPrimitiveArrayCritical(env, (jarray)array, NULL); \
     ptr[index] = value; \
     (*env)->ReleasePrimitiveArrayCritical(env, (jarray)array, ptr, 0); \
 }
 
-setGetFunctions(BI, BIB, jbyte, jbyteArray);
-setGetFunctions(ZI, ZIZ, jboolean, jbooleanArray);
-setGetFunctions(SI, SIS, jshort, jshortArray);
-setGetFunctions(CI, CIC, jchar, jcharArray);
-setGetFunctions(II, III, jint, jintArray);
-setGetFunctions(JI, JIJ, jlong, jlongArray);
-setGetFunctions(FI, FIF, jfloat, jfloatArray);
-setGetFunctions(DI, DID, jdouble, jdoubleArray);
+setGetFunctions(B, jbyte);
+setGetFunctions(Z, jboolean);
+setGetFunctions(S, jshort);
+setGetFunctions(C, jchar);
+setGetFunctions(I, jint);
+setGetFunctions(J, jlong);
+setGetFunctions(F, jfloat);
+setGetFunctions(D, jdouble);
 
 /*
  * Class:     org_apache_harmony_misc_accessors_ArrayAccessor

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/unix/makefile Tue Oct  6 14:57:42 2009
@@ -31,7 +31,7 @@
 MDLLIBFILES += $(LIBPATH)libhypool.a \
 	$(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
-DLLNAME=../libaccessors$(HY_SHLIB_SUFFIX)
+DLLNAME=$(DLLPATH)libaccessors$(HY_SHLIB_SUFFIX)
 EXPNAME=HYMISC_0.1
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/makefile Tue Oct  6 14:57:42 2009
@@ -16,7 +16,7 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=accessors
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/build.xml Tue Oct  6 14:57:42 2009
@@ -47,21 +47,6 @@
     <target name="build-native" depends="build-native-all" />
     <target name="build-native-all" >
         <make dir="src/main/native/nio/${hy.os.family}" />
-
-        <!-- Copy the built shared libs over to the jre/bin dir -->
-        <copy todir="${hy.jdk}/jre/bin" preservelastmodified="true">
-            <fileset dir="src/main/native/nio">
-                <include name="*${shlib.suffix}*" />
-                <include name="*${progdb.suffix}*" if="is.windows" />
-                <exclude name="*${manifest.suffix}" />
-            </fileset>
-        </copy>
-        <!-- Copy link exports file on z/OS -->
-        <copy todir="${hy.hdk}/lib" preservelastmodified="true">
-            <fileset dir="src/main/native/nio/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
 
     <target name="clean-java" depends="class-patternset">
@@ -110,6 +95,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/nio.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/nio.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/nio.jar"
              manifest="META-INF/MANIFEST.MF"

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectionKeyImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectionKeyImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectionKeyImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectionKeyImpl.java Tue Oct  6 14:57:42 2009
@@ -40,37 +40,21 @@
 
     private int index;
 
-    private int hashCode;
-
-    public int hashCode() {
-        return hashCode;
-    }
-
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        final SelectionKeyImpl other = (SelectionKeyImpl) obj;
-        return hashCode == other.hashCode;
-    }
-
     public SelectionKeyImpl(AbstractSelectableChannel channel, int operations,
             Object attachment, SelectorImpl selector) {
         super();
         this.channel = channel;
         interestOps = operations;
         this.selector = selector;
-        this.hashCode = stHash++;
         attach(attachment);
     }
 
+    @Override
     public SelectableChannel channel() {
         return channel;
     }
 
+    @Override
     public int interestOps() {
         checkValid();
         synchronized (selector.keysLock) {
@@ -78,6 +62,7 @@
         }
     }
 
+    @Override
     public SelectionKey interestOps(int operations) {
         checkValid();
         if ((operations & ~(channel().validOps())) != 0) {
@@ -90,11 +75,13 @@
         return this;
     }
 
+    @Override
     public int readyOps() {
         checkValid();
         return readyOps;
     }
 
+    @Override
     public Selector selector() {
         return selector;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java Tue Oct  6 14:57:42 2009
@@ -140,7 +140,7 @@
     protected void implCloseSelector() throws IOException {
         wakeup();
         synchronized (this) {
-            synchronized (keysSet) {
+            synchronized (unmodifiableKeys) {
                 synchronized (selectedKeys) {
                     doCancel();
                     for (SelectionKey sk : keys) {
@@ -369,7 +369,7 @@
     void modKey(SelectionKey sk) {
         // TODO: update indexes rather than recreate the key
         synchronized (this) {
-            synchronized (keysSet) {
+            synchronized (unmodifiableKeys) {
                 synchronized (selectedKeys) {
                     delKey(sk);
                     int newIndex = addKey(sk);
@@ -390,7 +390,7 @@
             throw new IllegalSelectorException();
         }
         synchronized (this) {
-            synchronized (keysSet) {
+            synchronized (unmodifiableKeys) {
 
                 // create the key
                 SelectionKey sk = new SelectionKeyImpl(channel, operations,
@@ -464,7 +464,7 @@
     private int selectInternal(long timeout) throws IOException {
         closeCheck();
         synchronized (this) {
-            synchronized (keysSet) {
+            synchronized (unmodifiableKeys) {
                 synchronized (selectedKeys) {
                     doCancel();
                     int[] readyChannels = null;

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Tue Oct  6 14:57:42 2009
@@ -299,11 +299,11 @@
         // set the connected address.
         connectAddress = inetSocketAddress;
         synchronized (this) {
-            if (isBlocking()) {
-                status = (finished ? SOCKET_STATUS_CONNECTED
-                        : SOCKET_STATUS_UNCONNECTED);
+            if (finished) {
+                status = SOCKET_STATUS_CONNECTED;
             } else {
-                status = SOCKET_STATUS_PENDING;
+                status = isBlocking() ? SOCKET_STATUS_UNCONNECTED
+                        : SOCKET_STATUS_PENDING;
             }
         }
         return finished;
@@ -495,19 +495,39 @@
         }
 
         checkOpenConnected();
-        int count = calculateByteBufferArray(sources, offset, length);
-        if (0 == count) {
-            return 0;
+
+        Object[] src = new Object[length];
+        int[] offsets = new int[length];
+        int[] counts = new int[length];
+        for (int i = 0; i < length; ++i) {
+            ByteBuffer buffer = sources[i + offset];
+            if (!buffer.isDirect()) {
+                if (buffer.hasArray()) {
+                    src[i] = buffer.array();
+                    counts[i] = buffer.remaining();
+                    offsets[i] = buffer.position();
+                } else {
+                    ByteBuffer db = ByteBuffer.allocateDirect(buffer.remaining());
+                    int oldPosition = buffer.position();
+                    db.put(buffer);
+                    buffer.position(oldPosition);
+                    db.flip();
+                    src[i] = db;
+                    counts[i] = buffer.remaining();
+                    offsets[i] = 0;
+                }
+            } else {
+                src[i] = buffer;
+                counts[i] = buffer.remaining();
+                offsets[i] = buffer.position();
+            }
         }
-        ByteBuffer writeBuf = ByteBuffer.allocate(count);
-        for (int val = offset; val < length + offset; val++) {
-            ByteBuffer source = sources[val];
-            int oldPosition = source.position();
-            writeBuf.put(source);
-            source.position(oldPosition);
+
+        if (length == 0) {
+            return 0;
         }
-        writeBuf.flip();
-        int result = writeImpl(writeBuf);
+
+        int result = writevImpl(src, offsets, counts);
         int val = offset;
         int written = result;
         while (result > 0) {
@@ -520,6 +540,35 @@
         return written;
     }
 
+    /*
+     * Write the source. return the count of bytes written.
+     */
+    private int writevImpl(Object[] sources, int[] offsets, int[] counts) throws IOException {
+        int writeCount = 0;
+        try {
+            if (isBlocking()) {
+                begin();
+            }
+
+            synchronized (writeLock) {
+                writeCount = networkSystem.writev(fd, sources, offsets, counts, sources.length);
+            }
+        } catch (SocketException e) {
+            if (e.getCause() instanceof ErrorCodeException) {
+                if (ERRCODE_SOCKET_NONBLOCKING_WOULD_BLOCK == ((ErrorCodeException) e
+                        .getCause()).getErrorCode()) {
+                    return writeCount;
+                }
+            }
+            throw e;
+        } finally {
+            if (isBlocking()) {
+                end(writeCount >= 0);
+            }
+        }
+        return writeCount;
+    }
+
     private int calculateByteBufferArray(ByteBuffer[] sources, int offset,
             int length) {
         int sum = 0;

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/makefile Tue Oct  6 14:57:42 2009
@@ -33,7 +33,7 @@
 	$(LIBPATH)libhycommon.a \
 	$(LIBPATH)libhypool.a
 
-DLLNAME = ../libhynio$(HY_SHLIB_SUFFIX)
+DLLNAME = $(DLLPATH)libhynio$(HY_SHLIB_SUFFIX)
 EXPNAME = HYNIO_0.1
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/windows/makefile Tue Oct  6 14:57:42 2009
@@ -20,7 +20,7 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hynio
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(SHARED)common /I$(SHARED)fdlibm
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java Tue Oct  6 14:57:42 2009
@@ -22,17 +22,19 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.RandomAccessFile;
+import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 import java.nio.IntBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
+import java.nio.channels.NonWritableChannelException;
 import java.nio.channels.FileChannel.MapMode;
 
 import junit.framework.TestCase;
 
 public class MappedByteBufferTest extends TestCase {
 
-    File tmpFile;
+    File tmpFile, emptyFile;
     
     /**
      * A regression test for failing to correctly set capacity of underlying
@@ -63,6 +65,62 @@
     }
     
     /**
+     * Regression for HARMONY-6315 - FileChannel.map throws IOException
+     * when called with size 0
+     * 
+     * @throws IOException
+     */
+    public void testEmptyBuffer() throws IOException {
+    	// Map empty file
+        FileInputStream fis = new FileInputStream(emptyFile);
+        FileChannel fc = fis.getChannel();
+        MappedByteBuffer mmb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+        
+        // check non-null
+        assertNotNull("MappedByteBuffer created from empty file should not be null", 
+        		mmb);
+        
+        // check capacity is 0
+        int len = mmb.capacity();
+        assertEquals("MappedByteBuffer created from empty file should have 0 capacity", 
+        		0, len);
+        
+        assertFalse("MappedByteBuffer from empty file shouldn't be backed by an array ", 
+        		mmb.hasArray());
+        
+        try
+        {
+        	byte b = mmb.get();
+        	fail("Calling MappedByteBuffer.get() on empty buffer should throw a BufferUnderflowException");
+        }
+        catch (BufferUnderflowException e)
+        {
+        	// expected behaviour
+        }
+        
+        // test expected exceptions thrown
+        try 
+        {
+        	mmb = fc.map(FileChannel.MapMode.READ_WRITE, 0, fc.size());
+        	fail("Expected NonWritableChannelException to be thrown");
+        }
+        catch (NonWritableChannelException e)
+        {
+        	// expected behaviour
+        }
+        try
+        {
+        	mmb = fc.map(FileChannel.MapMode.PRIVATE, 0, fc.size());
+        	fail("Expected NonWritableChannelException to be thrown");
+        }
+        catch (NonWritableChannelException e)
+        {
+        	// expected behaviour
+        }
+        fc.close();
+    }
+    
+    /**
      * @tests {@link java.nio.MappedByteBuffer#force()}
      */
     public void test_force() throws IOException {
@@ -146,5 +204,8 @@
         fileChannel.write(byteBuffer);
         fileChannel.close();
         fileOutputStream.close();
+        
+        emptyFile = File.createTempFile("harmony", "test");  //$NON-NLS-1$//$NON-NLS-2$
+        emptyFile.deleteOnExit();
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Tue Oct  6 14:57:42 2009
@@ -28,6 +28,7 @@
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.SocketException;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.channels.AlreadyConnectedException;
 import java.nio.channels.ClosedChannelException;
@@ -298,15 +299,19 @@
     public void testSocket_NonBlock_BasicStatusAfterConnect() throws Exception {
         assertFalse(this.channel1.isConnected());// not connected
         this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        Socket s1 = this.channel1.socket();
-        // status of not connected
-        assertSocketBeforeConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
+        boolean connected = channel1.connect(localAddr1);
+        Socket s1 = null;
+        Socket s2 = null;
+        if (!connected) {
+            assertFalse(this.channel1.isConnected());
+            assertTrue(this.channel1.isConnectionPending());
+            s1 = this.channel1.socket();
+            // status of not connected
+            assertSocketBeforeConnect(s1);
+            s2 = this.channel1.socket();
+            // same
+            assertSame(s1, s2);
+        }
 
         if (tryFinish()) {
             assertTrue(this.channel1.isConnected());
@@ -337,22 +342,24 @@
             throws IOException {
         assertFalse(this.channel1.isConnected());// not connected
         this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        Socket s1 = this.channel1.socket();
-        // Action of not connected
-        assertSocketAction_NonBlock_BeforeConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isConnected());
+            assertTrue(this.channel1.isConnectionPending());
+            Socket s1 = this.channel1.socket();
+            // Action of not connected
+            assertSocketAction_NonBlock_BeforeConnect(s1);
+            Socket s2 = this.channel1.socket();
+            // same
+            assertSame(s1, s2);
+        }
     }
 
     public void testSocket_NonBlock_ActionsAfterConnectAfterFinish()
             throws Exception {
         assertFalse(this.channel1.isConnected());// not connected
         this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
+        channel1.connect(localAddr1);
         if (tryFinish()) {
             Socket s1 = this.channel1.socket();
             assertSocketAction_NonBlock_AfterConnect(s1);
@@ -640,9 +647,10 @@
         this.channel1.configureBlocking(false);
         statusNotConnected_NotPending();
         // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            statusNotConnected_Pending();
+        }
         ensureServerClosed();
 
         tryFinish();
@@ -1050,37 +1058,38 @@
         this.channel1.configureBlocking(false);
         statusNotConnected_NotPending();
         // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            statusNotConnected_Pending();
 
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
+            try {
+                this.channel1.connect(localAddr1);
+                fail("Should throw a ConnectionPendingException here.");
+            } catch (ConnectionPendingException e) {
+                // OK.
+            }
+            statusNotConnected_Pending();
 
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
+            // connect another addr
+            try {
+                this.channel1.connect(localAddr2);
+                fail("Should throw a ConnectionPendingException here.");
+            } catch (ConnectionPendingException e) {
+                // OK.
+            }
+            statusNotConnected_Pending();
 
-        // connect if server closed
-        ensureServerClosed();
+            // connect if server closed
+            ensureServerClosed();
 
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
+            try {
+                this.channel1.connect(localAddr1);
+                fail("Should throw a ConnectionPendingException here.");
+            } catch (ConnectionPendingException e) {
+                // OK.
+            }
+            statusNotConnected_Pending();
         }
-        statusNotConnected_Pending();
-
         tryFinish();
 
         this.channel1.close();
@@ -1195,9 +1204,10 @@
         }
         statusNotConnected_NotPending();
         // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            statusNotConnected_Pending();
+        }
         tryFinish();
 
         this.channel1.close();
@@ -1375,9 +1385,10 @@
         this.channel1.configureBlocking(false);
         statusNotConnected_NotPending();
         // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            statusNotConnected_Pending();
+        }
         tryFinish();
     }
 
@@ -1486,9 +1497,11 @@
         this.channel1.connect(localAddr1);
 
         assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
+        boolean connected = channel1.isConnected();
+        if (!connected) {
+            assertTrue(this.channel1.isConnectionPending());
+            assertTrue(this.channel1.isOpen());
+        }
         if (tryFinish()) {
             assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
             assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBufArr, 0, 1));
@@ -1524,11 +1537,13 @@
         } catch (NoConnectionPendingException e) {
             // correct
         }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
+        boolean connected = channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isBlocking());
+            assertFalse(this.channel1.isConnected());
+            assertTrue(this.channel1.isConnectionPending());
+            assertTrue(this.channel1.isOpen());
+        }
         this.server1.accept();
         if (tryFinish()) {
             assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
@@ -1840,7 +1855,7 @@
     /**
      * @tests java.nio.channels.SocketChannel#write(ByteBuffer)
      */
-    public void test_wrtieLjava_nio_ByteBuffer_Blocking() throws IOException {
+    public void test_writeLjava_nio_ByteBuffer_Blocking() throws IOException {
         // initialize write content
         ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_NORMAL);
         for (int i = 0; i < CAPACITY_NORMAL; i++) {
@@ -1890,7 +1905,7 @@
     /**
      * @tests java.nio.channels.SocketChannel#write(ByteBuffer)
      */
-    public void test_wrtieLjava_nio_ByteBuffer_NonBlocking() throws Exception {
+    public void test_writeLjava_nio_ByteBuffer_NonBlocking() throws Exception {
         // initialize write content
         ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_NORMAL);
         for (int i = 0; i < CAPACITY_NORMAL; i++) {
@@ -1978,10 +1993,12 @@
         } catch (NotYetConnectedException e) {
             // correct
         }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
+        boolean connected = this.channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isBlocking());
+            assertTrue(this.channel1.isConnectionPending());
+            assertFalse(this.channel1.isConnected());
+        }
         if (tryFinish()) {
             assertEquals(0, this.channel1.read(readBuf));
         }
@@ -2012,10 +2029,12 @@
         } catch (NotYetConnectedException e) {
             // correct
         }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
+        boolean connected = this.channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isBlocking());
+            assertTrue(this.channel1.isConnectionPending());
+            assertFalse(this.channel1.isConnected());
+        }
         if (tryFinish()) {
             assertEquals(0, this.channel1.read(readBuf));
         }
@@ -2116,10 +2135,12 @@
         } catch (NotYetConnectedException e) {
             // correct
         }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
+        boolean connected = this.channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isBlocking());
+            assertTrue(this.channel1.isConnectionPending());
+            assertFalse(this.channel1.isConnected());
+        }
         if (tryFinish()) {
             assertEquals(0, this.channel1.read(readBuf, 0, 1));
             assertEquals(0, this.channel1.read(readBuf, 0, 2));
@@ -2155,10 +2176,12 @@
         } catch (NotYetConnectedException e) {
             // correct
         }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
+        boolean connected = this.channel1.connect(localAddr1);
+        if (!connected) {
+            assertFalse(this.channel1.isBlocking());
+            assertTrue(this.channel1.isConnectionPending());
+            assertFalse(this.channel1.isConnected());
+        }
         if (tryFinish()) {
             assertEquals(0, this.channel1.read(readBuf, 0, 1));
             assertEquals(0, this.channel1.read(readBuf, 0, 2));
@@ -2657,7 +2680,234 @@
         sc.write(byteBufferArray);
         assertTrue(sc.isWriteCalled);
     }
-    
+
+    /**
+     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
+     */
+    public void test_writev() throws Exception {
+        ServerSocketChannel ssc = ServerSocketChannel.open();
+        ssc.socket().bind(localAddr2);
+        SocketChannel sc = SocketChannel.open();
+        sc.connect(localAddr2);
+        SocketChannel sock = ssc.accept();
+        ByteBuffer[] buf = { ByteBuffer.allocate(10), ByteBuffer.allocateDirect(20) };
+
+        while (buf[0].remaining() != 0 && buf[1].remaining() !=0) {
+            assertTrue(sc.write(buf, 0, 2) >= 0);
+        }
+
+        ByteBuffer target = ByteBuffer.allocate(30);
+
+        while (target.remaining() != 0) {
+            assertTrue(sock.read(target) >=0);
+        }
+
+        ssc.close();
+        sc.close();
+        sock.close();
+    }
+
+    /**
+     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
+     */
+    public void test_write$LByteBuffer2() throws IOException {
+        // Set-up
+        ServerSocketChannel server = ServerSocketChannel.open();
+        server.socket().bind(null);
+        SocketChannel client = SocketChannel.open();
+        client.connect(server.socket().getLocalSocketAddress());
+        SocketChannel worker = server.accept();
+
+        // Test overlapping buffers
+        byte[] data = "Hello world!".getBytes("UTF-8");
+        ByteBuffer[] buffers = new ByteBuffer[3];
+        buffers[0] = ByteBuffer.wrap(data, 0, 6);
+        buffers[1] = ByteBuffer.wrap(data, 6, data.length - 6);
+        buffers[2] = ByteBuffer.wrap(data);
+
+        // Write them out, read what we wrote and check it
+        client.write(buffers);
+        ByteBuffer readBuffer = ByteBuffer.allocate(1024);
+        worker.read(readBuffer);
+        readBuffer.flip();
+        Buffer expected = ByteBuffer.allocate(1024).put(data).put(data).flip();
+        assertEquals(expected, readBuffer);
+
+        // Tidy-up
+        worker.close();
+        client.close();
+        server.close();
+    }
+
+    /**
+     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
+     */
+    public void test_write$LByteBuffer_buffers() throws IOException {
+        // Set-up
+        ServerSocketChannel server = ServerSocketChannel.open();
+        server.socket().bind(null);
+        SocketChannel client = SocketChannel.open();
+        client.connect(server.socket().getLocalSocketAddress());
+        SocketChannel worker = server.accept();
+
+        // A variety of buffer types to write
+        byte[] data = "Hello world!".getBytes("UTF-8");
+        ByteBuffer[] buffers = new ByteBuffer[3];
+        buffers[0] = ByteBuffer.wrap(data, 0, 2);
+        assertFalse(buffers[0].isDirect());
+        assertTrue(buffers[0].hasArray());
+
+        buffers[1] = ByteBuffer.wrap(data, 2, 4).asReadOnlyBuffer();
+        assertFalse(buffers[1].isDirect());
+        assertFalse(buffers[1].hasArray());
+
+        buffers[2] = ByteBuffer.allocateDirect(42);
+        buffers[2].put(data, 6, data.length - 6);
+        buffers[2].flip();
+        assertTrue(buffers[2].isDirect());
+        assertFalse(buffers[2].hasArray());
+
+        // Write them out, read what we wrote and check it
+        client.write(buffers);
+        ByteBuffer readBuffer = ByteBuffer.allocate(1024);
+        worker.read(readBuffer);
+        readBuffer.flip();
+        assertEquals(ByteBuffer.wrap(data), readBuffer);
+
+        // Tidy-up
+        worker.close();
+        client.close();
+        server.close();
+    }
+
+    /**
+     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
+     */
+    public void test_write$LByteBuffer_writes() throws IOException {
+        // Set-up
+        ServerSocketChannel server = ServerSocketChannel.open();
+        server.socket().bind(null);
+        SocketChannel client = SocketChannel.open();
+        client.connect(server.socket().getLocalSocketAddress());
+        SocketChannel worker = server.accept();
+
+        // Data to write
+        byte[] data = "Hello world!".getBytes("UTF-8");
+        ByteBuffer[] buffers = new ByteBuffer[3];
+        buffers[0] = ByteBuffer.wrap(data, 0, 6);
+        buffers[1] = ByteBuffer.wrap("world!".getBytes("UTF-8"));
+        buffers[2] = buffers[0];
+        assertTrue(buffers[0].hasArray());
+
+        // Test a sequence of write calls
+        client.write(buffers, 0, 0); // write nothing
+        client.write(buffers, 1, 0); // write nothing
+        client.write(buffers, 0, 1); // write "Hello "
+        assertEquals("Failed to drain buffer 0", 0, buffers[0].remaining());
+        assertEquals("Shouldn't touch buffer 1", buffers[1].limit(), buffers[1]
+                .remaining());
+        client.write(buffers, 0, 2); // writes "world!"
+        assertEquals("Failed to drain buffer 1", 0, buffers[1].remaining());
+        client.write(buffers, 0, 3); // write nothing
+
+        // Read what we wrote and check it
+        ByteBuffer readBuffer = ByteBuffer.allocate(1024);
+        worker.read(readBuffer);
+        readBuffer.flip();
+        assertEquals(ByteBuffer.wrap(data), readBuffer);
+
+        // Tidy-up
+        worker.close();
+        client.close();
+        server.close();
+    }
+
+    /**
+     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
+     */
+    public void test_write$LByteBuffer_invalid() throws IOException {
+        // Set-up
+        ServerSocketChannel server = ServerSocketChannel.open();
+        server.socket().bind(null);
+
+        SocketChannel client = SocketChannel.open();
+        client.connect(server.socket().getLocalSocketAddress());
+
+        SocketChannel worker = server.accept();
+
+        // Do some stuff
+        try {
+            client.write((ByteBuffer[]) null);
+            fail("Should throw a NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        try {
+            client.write((ByteBuffer[]) null, 0, 0);
+            fail("Should throw a NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        try {
+            client.write((ByteBuffer[]) null, 1, 0);
+            fail("Should throw a NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        try {
+            client.write((ByteBuffer[]) null, 0, 1);
+            fail("Should throw a NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        try {
+            client.write((ByteBuffer[]) null, 1, 1);
+            fail("Should throw a NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        ByteBuffer[] buffers = new ByteBuffer[2];
+        buffers[0] = ByteBuffer.wrap("Hello ".getBytes("UTF-8"));
+        buffers[1] = ByteBuffer.wrap("world!".getBytes("UTF-8"));
+
+        try {
+            client.write((ByteBuffer[]) null, -1, 0);
+            fail("Should throw a IOBE");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            client.write((ByteBuffer[]) null, 0, -1);
+            fail("Should throw a IOBE");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            client.write(buffers, 0, 42);
+            fail("Should throw a IOBE");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            client.write(buffers, 42, 0);
+            fail("Should throw a IOBE");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            client.write(buffers, 1, 2);
+            fail("Should throw a IOBE");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+
+        // Tidy-up
+        worker.close();
+        client.close();
+        server.close();
+    }
+
     public void testSocket_configureblocking() throws IOException {
         byte[] serverWBuf = new byte[CAPACITY_NORMAL];
         for (int i = 0; i < serverWBuf.length; i++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml Tue Oct  6 14:57:42 2009
@@ -32,15 +32,7 @@
     <!-- Build natives.-->
     <target name="build-native" depends="build-native-all" />
     <target name="build-native-all" >
-
         <make dir="src/main/native/niochar/${hy.os.family}" />
-
-        <!-- Copy the built shared libs over to the jre/bin dir -->
-        <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
-            <fileset dir="src/main/native/niochar">
-                <patternset includes="*${shlib.suffix}*" />
-            </fileset>
-        </copy>
     </target>
 
     <target name="test" depends="-test-module">
@@ -102,6 +94,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/nio_char.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/nio_char.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/nio_char.jar"
              manifest="META-INF/MANIFEST.MF"

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile Tue Oct  6 14:57:42 2009
@@ -114,9 +114,7 @@
   ../shared/additional/x_MS950_HKSCS.o \
   ../shared/additional/x_windows_949.o 
 
-
-DLLNAME = ../libhyniochar$(HY_SHLIB_SUFFIX)
-
+DLLNAME = $(DLLPATH)libhyniochar$(HY_SHLIB_SUFFIX)
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile Tue Oct  6 14:57:42 2009
@@ -20,7 +20,7 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hyniochar
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(SHARED)common /I$(SHARED)fdlibm
 HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def 

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/build.xml Tue Oct  6 14:57:42 2009
@@ -119,6 +119,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/pack200.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/pack200.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/pack200.jar"
              manifest="META-INF/MANIFEST.MF"

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/depends/manifests/asm-3.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct  6 14:57:42 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-814402
+/harmony/enhanced/classlib/trunk/modules/pack200/depends/manifests/asm-3.1:785554-822279

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java Tue Oct  6 14:57:42 2009
@@ -91,7 +91,13 @@
     }
 
     public String toString() {
-        return "Exceptions: " + exceptions;
+        StringBuffer sb = new StringBuffer();
+        sb.append("Exceptions: ");
+        for (int i = 0; i < exceptions.length; i++) {
+            sb.append(exceptions[i]);
+            sb.append(' ');
+        }
+        return sb.toString();
     }
 
     protected void writeBody(DataOutputStream dos) throws IOException {

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct  6 14:57:42 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-814402
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200Adapter.java:782694-822279

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct  6 14:57:42 2009
@@ -1 +1 @@
-/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-814402
+/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java5/org/apache/harmony/pack200/Pack200PackerAdapter.java:782694-822279

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/build.xml Tue Oct  6 14:57:42 2009
@@ -135,18 +135,6 @@
     <target name="-build-ascii-ebcdic" if="is.zos" >
         <!-- Build a2e lib for zOS platforms -->
         <make dir="src/main/native/a2e/${hy.os.family}" />
-
-        <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
-            <fileset dir="src/main/native/a2e">
-                <include name="*${shlib.suffix}*" />
-                <exclude name="*${manifest.suffix}"/>
-            </fileset>
-        </copy>
-        <copy todir="${hy.hdk}/lib" overwrite="yes">
-            <fileset dir="src/main/native/a2e/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
 
     <target name="-build-native-thread" unless="hy.skip.thr">
@@ -176,37 +164,11 @@
     <target name="-build-native-thrstub" if="hy.skip.thr">
         <!-- Build thread dll -->
         <make dir="src/main/native/thrstub/${hy.os.family}" />
-
-        <copy todir="${hy.hdk}/lib" preservelastmodified="true">
-            <fileset dir="src/main/native/thrstub">
-                <include name="*${shlib.suffix}*" />
-                <include name="*${progdb.suffix}*" if="is.windows" />
-                <exclude name="*${manifest.suffix}"/>
-            </fileset>
-            <!-- Copy link exports file on z/OS -->
-            <fileset dir="src/main/native/thrstub/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
 
     <target name="-build-native-port">
         <!-- Build port dll -->
         <make dir="src/main/native/port/${hy.os.family}" />
-
-        <copy todir="${hy.jdk}/jre/bin" preservelastmodified="true">
-            <fileset dir="src/main/native/port">
-                <include name="*${shlib.suffix}*" />
-                <include name="*${progdb.suffix}*" if="is.windows" />
-                <exclude name="*${manifest.suffix}"/>
-            </fileset>
-        </copy>
-        <!-- Copy link exports file on z/OS -->
-        <copy todir="${hy.hdk}/lib" preservelastmodified="true">
-            <fileset dir="src/main/native/port/${hy.os.family}">
-                <include name="*${linklib.suffix}" if="is.zos" />
-            </fileset>
-        </copy>
     </target>
 
     <!-- Clean natives -->
@@ -322,7 +284,7 @@
         </copy>
 
         <delete>
-            <fileset dir="${hy.portlib}" includes="TEST-*.xml" />
+            <fileset dir="." includes="TEST-*.xml" />
         </delete>
 
         <antcall target="touch-errors-file" />

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/headers/stdio.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/headers/stdio.h?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/headers/stdio.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/headers/stdio.h Tue Oct  6 14:57:42 2009
@@ -17,41 +17,90 @@
 
 /*
  * DESCRIPTION:
- * Replace the system header file "pwd.h" so that we can redefine
+ * Replace the system header file "stdio.h" so that we can redefine
  * the i/o functions that take/produce character strings
  * with our own ATOE functions.
  *
  * The compiler will find this header file in preference to the system one.
+ * ===========================================================================
  */
 
-#if __TARGET_LIB__ == 0X22080000                           
-#include <//'PP.ADLE370.OS39028.SCEEH.H(pwd)'>             
-#else                                                      
-#include </usr/include/pwd.h>                              
-#endif                                                     
+#if __TARGET_LIB__ == 0X22080000                  
+#include <//'PP.ADLE370.OS39028.SCEEH.H(stdio)'>  
+#else                                             
+#include </usr/include/stdio.h>                   
+#endif                                            
 
 #if defined(HY_ATOE)
 
-	#if !defined(HY_ATOE_PWD)
-		#define HY_ATOE_PWD
+	#if !defined(HY_ATOE_STDIO)
+		#define HY_ATOE_STDIO
 
 		#ifdef __cplusplus
             extern "C" {
 		#endif
 
-        struct passwd* atoe_getpwuid(uid_t);
-        struct passwd* atoe_getpwnam(const char *);
+        FILE *     atoe_fopen     (const char*, const char*);
+        int        atoe_fprintf   (FILE*, const char*, ...);
+        size_t     atoe_fread     (void*, size_t, size_t, FILE*);
+        FILE *     atoe_freopen   (const char*, const char*, FILE*);
+        size_t     atoe_fwrite    (const void*, size_t, size_t, FILE*);
+        char      *atoe_fgets (char *, int, FILE *);
+        char *     atoe_gets      (char *);
+        void       atoe_perror    (const char*);
+        int        atoe_printf    (const char*, ...);
+        int        atoe_putchar   (int);
+        int        atoe_rename    (const char*, char*);
+        int        atoe_sprintf   (const char*, char*, ...);
+        int        std_sprintf    (const char*, char*, ...);
+        int        atoe_sscanf    (const char*, const char*, ...); 
+        char *     atoe_tempnam   (const char *, char *);
+        int        atoe_vprintf   (const char *, va_list);
+        int        atoe_vfprintf  (FILE *, const char *, va_list);
+        int        atoe_vsprintf  (char *, const char *, va_list); 
+	int        atoe_vsnprintf (char *, size_t, const char *, va_list);
 
 		#ifdef __cplusplus
             }
 		#endif
 
-		#undef getpwuid
-		#undef getpwnam
-
-		#define getpwuid        atoe_getpwuid
-		#define getpwnam        atoe_getpwnam
-
+		#undef fopen
+		#undef fprintf
+		#undef fread
+		#undef freopen
+		#undef fwrite
+		#undef fgets
+		#undef gets
+		#undef perror
+		#undef printf
+		#undef putchar
+		#undef rename
+		#undef sprintf
+		#undef sscanf                                 
+		#undef tempnam
+		#undef vfprintf
+		#undef vsprintf                               
+		#undef vsnprintf
+
+
+		#define fopen           atoe_fopen
+		#define fprintf         atoe_fprintf
+		#define fread           atoe_fread
+		#define freopen         atoe_freopen
+		#define fwrite          atoe_fwrite
+		#define fgets           atoe_fgets
+		#define gets            atoe_gets
+		#define perror          atoe_perror
+		#define printf          atoe_printf
+		#define putchar         atoe_putchar
+		#define rename          atoe_rename
+		#define sprintf         atoe_sprintf
+		#define sscanf          atoe_sscanf           
+		#define tempnam         atoe_tempnam
+		#define vfprintf        atoe_vfprintf
+		#define vprintf         atoe_vprintf
+		#define vsprintf        atoe_vsprintf         
+		#define vsnprintf	atoe_vsnprintf
 	#endif
 
 #endif

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/a2e/unix/makefile Tue Oct  6 14:57:42 2009
@@ -25,7 +25,7 @@
 
 MDLLIBFILES =
 
-DLLNAME = ../libhya2e$(HY_SHLIB_SUFFIX)
+DLLNAME = $(DLLPATH)libhya2e$(HY_SHLIB_SUFFIX)
 LIBNAME = $(LIBPATH)libhya2e.a
 
 include $(HY_HDK)/build/make/rules.mk

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/makefile Tue Oct  6 14:57:42 2009
@@ -41,7 +41,7 @@
 ifeq ($(HY_NO_THR),true)
 MDLLIBFILES += $(LIBPATH)libhythr$(HY_LINKLIB_SUFFIX)
 endif
-DLLNAME = ../libhyprt$(HY_SHLIB_SUFFIX)
+DLLNAME = $(DLLPATH)libhyprt$(HY_SHLIB_SUFFIX)
 EXPNAME = HYPRT_0.1
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile Tue Oct  6 14:57:42 2009
@@ -20,7 +20,7 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hyprt
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 
 HYCFLAGS = $(HYCFLAGS) -DHYPORT_LIBRARY_DEFINE /I$(SHAREDSUB)

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/unix/makefile Tue Oct  6 14:57:42 2009
@@ -28,5 +28,6 @@
 MDLLIBFILES = $(LIBPATH)libhypool.a $(LIBPATH)libhycommon.a
 DLLNAME = ../libhythr$(HY_SHLIB_SUFFIX)
 EXPNAME = HYTHR_0.2
+HY_CAN_LINK_DEBUG=no
 
 include $(HY_HDK)/build/make/rules.mk

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/
            ('svn:ignore' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/unix/makefile Tue Oct  6 14:57:42 2009
@@ -21,7 +21,8 @@
 
 BUILDFILES = $(SHAREDSUB)hythread.o
 
-DLLNAME = ../libhythr$(HY_SHLIB_SUFFIX)
+DLLNAME = $(LIBPATH)libhythr$(HY_SHLIB_SUFFIX)
+DBGPATH = $(LIBPATH)
 EXPNAME = HYTHR_0.2
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/makefile Tue Oct  6 14:57:42 2009
@@ -20,8 +20,9 @@
 !include <$(HY_HDK)\build\make\defines.mak>
 
 LIBBASE=hythr
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(LIBPATH)$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
+DBGPATH=$(LIBPATH)
 
 BUILDFILES = $(SHAREDSUB)hythread.obj
 

Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/build.xml Tue Oct  6 14:57:42 2009
@@ -50,15 +50,6 @@
     <target name="build-native" depends="build-native-all" />
     <target name="build-native-all" if="is.windows">
         <make dir="src/main/native/prefs/${hy.os.family}" />
-
-        <!-- Copy the built shared libs over to the jre/bin dir -->
-        <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
-            <fileset dir="src/main/native/prefs">
-                <include name="*${shlib.suffix}*"/>
-                <include name="*${progdb.suffix}*" if="is.windows" />
-                <exclude name="*${manifest.suffix}"/>
-            </fileset>
-        </copy>
     </target>
 
     <target name="clean-java" depends="class-patternset">
@@ -105,6 +96,13 @@
         </javac>
     </target>
 
+    <target name="findbugs" depends="build-jar">
+        <run-findBugs
+            jarFile="${hy.jdk}/jre/lib/boot/prefs.jar"
+            excludeFilter="make/findbugs-exclude-filter.xml"
+            outputFile="${findBugs.report}/prefs.xml"/>
+    </target>
+
     <target name="build-jar" depends="svn-info,class-patternset">
         <jar destfile="${hy.jdk}/jre/lib/boot/prefs.jar"
              manifest="META-INF/MANIFEST.MF"