harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r588245 [6/10] - in /harmony/enhanced/classlib/branches/java6: depends/build/ depends/files/ make/ modules/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ modules/archive/ modules/archive/src/main/java/jav...
Date Thu, 25 Oct 2007 14:45:48 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/filedesc.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/filedesc.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/filedesc.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/filedesc.c Thu Oct 25 07:44:56 2007
@@ -16,6 +16,7 @@
  */
 
 #include "iohelp.h"
+#include "nethelp.h"
 #include "exceptions.h"
 #include "harmonyglob.h"
 
@@ -26,7 +27,7 @@
     * Currently only answer false if the descriptor is -1.  Possibly there 
     * could be an OS check to see if the handle has been invalidated 
     */
-  void *descriptor = getJavaIoFileDescriptorContentsAsPointer (env, recv);
+  void *descriptor = getJavaIoFileDescriptorContentsAsAPointer (env, recv);
   return (IDATA) descriptor != -1;
 }
 
@@ -38,7 +39,7 @@
   I_32 syncfailed = 0;
   PORT_ACCESS_FROM_ENV (env);
 
-  descriptor = (IDATA) getJavaIoFileDescriptorContentsAsPointer (env, recv);
+  descriptor = (IDATA) getJavaIoFileDescriptorContentsAsAPointer (env, recv);
   if (descriptor == -1)
     {
       syncfailed = 1;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c Thu Oct 25 07:44:56 2007
@@ -1427,3 +1427,236 @@
 	addrarray_field = HARMONY_CACHE_GET (env, FID_java_net_InetAddress_address);
 	(*env)->SetObjectField(env, localAddr_object, addrarray_field, addr_array);
 }
+
+/**
+  * This will write count bytes from buffer starting at offset
+  */
+void
+ioh_writebytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer,
+                    jint offset, jint count, IDATA descriptor)
+{
+  I_32 result = 0;
+  jbyte *buf;
+  PORT_ACCESS_FROM_ENV (env);
+  jsize len;
+  char *errorMessage = NULL;
+
+/* TODO: ARRAY PINNING */
+#define INTERNAL_MAX 512
+  jbyte internalBuffer[INTERNAL_MAX];
+
+  if (buffer == NULL)
+    {
+      throwNPException (env, "buffer is null");
+      return;
+    }
+
+  len = (*env)->GetArrayLength (env, buffer);
+
+    /**
+	 * If offset is negative, or count is negative, or offset+count is greater
+	 * than the length of the array b, then an IndexOutOfBoundsException is thrown.
+	 * Must test offset > len, or len - offset < count to avoid int overflow caused
+	 * by offset + count
+	 */
+  if (offset < 0 || count < 0 || offset > len || (len - offset) < count)
+    {
+      throwIndexOutOfBoundsException (env);
+      return;
+    }
+
+  /* If len or count is zero, just return 0 */
+  if (len == 0 || count == 0)
+    return;
+
+  if (descriptor == -1)
+    {
+      throwJavaIoIOExceptionClosed (env);
+      return;
+    }
+  if (count > INTERNAL_MAX)
+    {
+      buf = hymem_allocate_memory (count);
+    }
+  else
+    {
+      buf = internalBuffer;
+    }
+
+  if (buf == NULL)
+    {
+      throwNewOutOfMemoryError (env, "");
+      return;
+    }
+  ((*env)->GetByteArrayRegion (env, buffer, offset, count, buf));
+
+  result = hyfile_write (descriptor, buf, count);
+
+  /**
+   * if there is an error, find the error message before calling free in case 
+   * hymem_free_memory changes the error code 
+   */
+  if (result < 0)
+    errorMessage = ioLookupErrorString (env, result);
+
+  if (buf != internalBuffer)
+    {
+      hymem_free_memory (buf);
+    }
+#undef INTERNAL_MAX
+
+  if (result < 0)
+    throwJavaIoIOException (env, errorMessage);
+}
+
+/**
+ * This will read a up to count bytes into buffer starting at offset
+ */
+jint
+ioh_readbytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer, jint offset,
+                   jint count, IDATA descriptor)
+{
+  I_32 result;
+  jsize len;
+  jbyte *buf;
+
+/* TODO: ARRAY PINNING */
+#define INTERNAL_MAX 2048
+  jbyte internalBuffer[INTERNAL_MAX];
+
+  PORT_ACCESS_FROM_ENV (env);
+
+  if (buffer == NULL)
+    {
+      throwNPException (env, "buffer is null");
+      return 0;
+    }
+
+  len = (*env)->GetArrayLength (env, buffer);
+  /** 
+   * Throw IndexOutOfBoundsException according to spec. 
+   * Must test offset > len, or len - offset < count to avoid 
+   * int overflow caused by offset + count 
+   */
+  if (offset < 0 || count < 0 || offset > len || (len - offset) < count)
+    {
+      throwIndexOutOfBoundsException (env);
+      return 0;
+    }
+  /* If len is 0, simply return 0 (even if it is closed) */
+  if (len == 0 || count == 0)
+    return 0;
+
+  if (descriptor == -1)
+    {
+      throwJavaIoIOExceptionClosed (env);
+      return 0;
+    }
+  if (len >= INTERNAL_MAX)
+    {
+      buf = hymem_allocate_memory (len);
+    }
+  else
+    {
+      buf = internalBuffer;
+    }
+
+  if (buf == NULL)
+    {
+      throwNewOutOfMemoryError (env, "");
+      return 0;
+    }
+  /* Must FREE buffer before returning */
+
+  if (descriptor == 0)
+    {
+      /* hytty_get_chars() returns zero on EOF */
+      if ((result = hytty_get_chars (buf, count)) == 0)
+        result = -1;
+    }
+  else
+    {
+      result = hyfile_read (descriptor, buf, count);
+    }
+  if (result > 0)
+    (*env)->SetByteArrayRegion (env, buffer, offset, result, buf);
+
+  if (buf != internalBuffer)
+    {
+      hymem_free_memory (buf);
+    }
+#undef INTERNAL_MAX
+
+  return result;
+}
+
+/**
+  * This will close a file descriptor
+  */
+void
+new_ioh_close (JNIEnv * env, jobject recv, jfieldID fdFID)
+{
+  jobject fd;
+  IDATA descriptor;
+  PORT_ACCESS_FROM_ENV (env);
+
+  /* fetch the fd field from the object */
+  fd = (*env)->GetObjectField (env, recv, fdFID);
+
+  /* dereference the C pointer from the wrapper object */
+  descriptor = (IDATA) getJavaIoFileDescriptorContentsAsAPointer (env, fd);
+
+  /* Check for closed file, in, out, and err */
+  if (descriptor >= -1 && descriptor <= 2)
+    {
+    return;
+    }
+
+  hyfile_close (descriptor);
+  setJavaIoFileDescriptorContents (env, fd, (void *) -1);
+  return;
+}
+
+/**
+ * Answer the errorString corresponding to the errorNumber, if available.
+ * This function will answer a default error string, if the errorNumber is not
+ * recognized.
+ *
+ * This function will have to be reworked to handle internationalization properly, removing
+ * the explicit strings.
+ *
+ * @param	anErrorNum		the error code to resolve to a human readable string
+ *
+ * @return	a human readable error string
+ */
+
+char *
+ioLookupErrorString (JNIEnv * env, I_32 anErrorNum)
+{
+  PORT_ACCESS_FROM_ENV (env);
+  switch (anErrorNum)
+    {
+    case HYPORT_ERROR_FILE_NOTFOUND:
+      return "File not found";
+    case HYPORT_ERROR_FILE_NOPERMISSION:
+      return "Lacking proper permissions to perform the operation";
+    case HYPORT_ERROR_FILE_DISKFULL:
+      return "Disk is full";
+    case HYPORT_ERROR_FILE_NOENT:
+      return "A component of the path name does not exist";
+    case HYPORT_ERROR_FILE_NOTDIR:
+      return "A component of the path name is not a directory";
+    case HYPORT_ERROR_FILE_BADF:
+      return "File descriptor invalid";
+    case HYPORT_ERROR_FILE_EXIST:
+      return "File already exists";
+    case HYPORT_ERROR_FILE_INVAL:
+      return "A parameter is invalid";
+    case HYPORT_ERROR_FILE_LOOP:
+      return "Followed too many symbolic links, possibly stuck in loop";
+    case HYPORT_ERROR_FILE_NAMETOOLONG:
+      return "Filename exceeds maximum length";
+    default:
+      return (char *) hyfile_error_message ();
+    }
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h Thu Oct 25 07:44:56 2007
@@ -101,4 +101,11 @@
 
 void setSocketLocalAddressContent(JNIEnv * env, jclass channel_class, jobject channel_object,jbyte * address);
 
+jint ioh_readbytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer,
+                        jint offset, jint count, IDATA descriptor);
+void ioh_writebytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer,
+                         jint offset, jint count, IDATA descriptor);
+void new_ioh_close (JNIEnv * env, jobject recv, jfieldID fdFID);
+char *ioLookupErrorString (JNIEnv * env, I_32 anErrorNum);
+
 #endif /* nethelp_h */

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/ois.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/ois.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/ois.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/ois.c Thu Oct 25 07:44:56 2007
@@ -174,7 +174,7 @@
     }
   else
     {
-      /* Instantiate an object of a given class and constuct it using
+      /* Instantiate an object of a given class and construct it using
          the constructor of the other class. */
       jobject obj;
       obj = (*env)->AllocObject(env, instantiationClass);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/process.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/process.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/process.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/process.c Thu Oct 25 07:44:56 2007
@@ -16,6 +16,7 @@
  */
 
 #include "iohelp.h"
+#include "nethelp.h"
 #include "exceptions.h"
 #include "procimpl.h"
 
@@ -255,7 +256,7 @@
                 jobject recv,
                 jobject arg1, jlong arg2)
 {
-  setJavaIoFileDescriptorContentsAsPointer (env, arg1, (void *) ((IDATA) arg2));
+  setJavaIoFileDescriptorContents (env, arg1, (void *) ((IDATA) arg2));
 }
 
 JNIEXPORT void JNICALL
@@ -263,7 +264,7 @@
                  jobject recv,
                  jobject arg1, jlong arg2)
 {
-  setJavaIoFileDescriptorContentsAsPointer (env, arg1, (void *) ((IDATA) arg2));
+  setJavaIoFileDescriptorContents (env, arg1, (void *) ((IDATA) arg2));
 }
 
 /* Wait for the receiver to finish then return the exit value */

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/socket.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/socket.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/socket.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/socket.c Thu Oct 25 07:44:56 2007
@@ -106,7 +106,7 @@
 
   if (0 == result)
     {
-      setJavaIoFileDescriptorContentsAsPointer (env, thisObjFD, sockdesc);
+      setJavaIoFileDescriptorContents (env, thisObjFD, sockdesc);
     }
 }
 
@@ -273,7 +273,7 @@
   U_32 interfaceIndex;
   U_32 scope_id = 0;
 
-  /* JNI objects needed to access the information in the optVal oject passed in */
+  /* JNI objects needed to access the information in the optVal object passed in */
   /* the object passed in is a GenericIPMreq object */
   jclass cls;
   jfieldID multiaddrID;
@@ -478,7 +478,7 @@
   U_32 interfaceIndex;
   U_32 scope_id = 0;
 
-/* JNI objects needed to access the information in the optVal oject passed in */
+/* JNI objects needed to access the information in the optVal object passed in */
   /* the object passed in is a GenericIPMreq object */
   jclass cls;
   jfieldID multiaddrID;
@@ -817,7 +817,7 @@
 
 #if defined(WIN32)
   PORT_ACCESS_FROM_ENV (env);
-  hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, fileDescriptor);
+  hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, fileDescriptor);
   if (!hysock_socketIsValid (hysocketP))
     {
       throwJavaNetSocketException (env, HYPORT_ERROR_SOCKET_BADSOCKET);
@@ -857,7 +857,7 @@
     
         SELECT_NOPOLL:
               
-        hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, fileDescriptor);
+        hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, fileDescriptor);
       
         if (!hysock_socketIsValid (hysocketP)) {
             throwJavaNetSocketException (env, HYPORT_ERROR_SOCKET_BADSOCKET);
@@ -913,7 +913,7 @@
        */
        
       hysocketP =
-        getJavaIoFileDescriptorContentsAsPointer (env, fileDescriptor);
+        getJavaIoFileDescriptorContentsAsAPointer (env, fileDescriptor);
       
       if (!hysock_socketIsValid (hysocketP))
         {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c Thu Oct 25 07:44:56 2007
@@ -31,12 +31,11 @@
 #endif
 #include "vmi.h"
 #include "iohelp.h"
+#include "nethelp.h"
 
 #include "IFileSystem.h"
 #include "OSFileSystem.h"
 
-void *getJavaIoFileDescriptorContentsAsPointer (JNIEnv * env, jobject fd);
-
 typedef int OSSOCKET;   
 typedef struct hysocket_struct
 {
@@ -203,7 +202,7 @@
   jint *offsets;
   jint *lengths;
   int i = 0;
-  long totalRead = 0;  
+  long totalWritten = 0;  
   struct iovec *vectors = (struct iovec *)hymem_allocate_memory(size * sizeof(struct iovec));
   if(vectors == NULL){
     return -1;
@@ -216,7 +215,7 @@
     vectors[i].iov_len = lengths[i];
     i++;
   }
-  totalRead = writev(fd, vectors, size);
+  totalWritten = writev(fd, vectors, size);
   if(bufsCopied){
     (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
   }
@@ -227,7 +226,7 @@
     (*env)->ReleaseIntArrayElements(env, jlengths, lengths, JNI_ABORT);
   }
   hymem_free_memory(vectors);
-  return totalRead;
+  return totalWritten;
 }
 
 /*
@@ -241,7 +240,7 @@
   OSSOCKET socket;
   //TODO IPV6
   hysocket_t hysocketP =
-    (hysocket_t)getJavaIoFileDescriptorContentsAsPointer (env,sd);
+    (hysocket_t)getJavaIoFileDescriptorContentsAsAPointer (env,sd);
   if(hysocketP == NULL)
     return -1;
   socket = hysocketP->sock;

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -55,18 +55,6 @@
 Java_java_io_FileDescriptor_oneTimeInitialization
 Java_java_io_FileDescriptor_syncImpl
 Java_java_io_FileDescriptor_valid
-Java_java_io_FileInputStream_available
-Java_java_io_FileInputStream_closeImpl
-Java_java_io_FileInputStream_oneTimeInitialization
-Java_java_io_FileInputStream_openImpl
-Java_java_io_FileInputStream_readByteImpl
-Java_java_io_FileInputStream_readImpl
-Java_java_io_FileInputStream_skip
-Java_java_io_FileOutputStream_closeImpl
-Java_java_io_FileOutputStream_oneTimeInitialization
-Java_java_io_FileOutputStream_openImpl
-Java_java_io_FileOutputStream_writeByteImpl
-Java_java_io_FileOutputStream_writeImpl
 Java_java_io_ObjectInputStream_newInstance
 Java_java_io_ObjectInputStream_objSetField
 Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2B

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -82,8 +82,8 @@
 getPlatformRoots (char *rootStrings)
 {
   rootStrings[0] = (char) '/';
-  rootStrings[1] = (char) NULL;
-  rootStrings[2] = (char) NULL;
+  rootStrings[1] = (char) 0;
+  rootStrings[2] = (char) 0;
   return 1;
 }
 

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -37,7 +37,7 @@
 	OSNetworkSystemLinux.o OSResourcesMonitorLinux.o hyenv.o consoleimpl.o
 
 ifneq ($(HY_ZIP_API),true)
-MDLLIBFILES += $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX)
+MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
 endif
 
 MDLLIBFILES += $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a \

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c Thu Oct 25 07:44:56 2007
@@ -236,7 +236,7 @@
         count = 0x7FFFFFFF;
     }
 
-	hysocketP = getJavaIoFileDescriptorContentsAsPointer(env,sd);	
+	hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env,sd);	
 	socket = (SOCKET)hysocketP->ipv4;	
     
 	pos_low  = SetFilePointer(hfile,0,&pos_high,FILE_CURRENT);

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -58,7 +58,7 @@
   FD_ZERO (&fdset_write->handle);
   for (val = 0; val<countReadC; val++){
 	  gotFD	= (*env)->GetObjectArrayElement(env,readFDArray,val);
-	  hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, gotFD);
+	  hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, gotFD);
       (*env)->DeleteLocalRef(env, gotFD);
 
 	  if (!hysock_socketIsValid (hysocketP)){
@@ -79,7 +79,7 @@
 	}
   for (val = 0; val<countWriteC; val++){
 	  gotFD	= (*env)->GetObjectArrayElement(env,writeFDArray,val);
-	  hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, gotFD);
+	  hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, gotFD);
       (*env)->DeleteLocalRef(env, gotFD);
 
 	  if (!hysock_socketIsValid (hysocketP)){
@@ -122,7 +122,7 @@
 	  flagArray = (*env)->GetIntArrayElements(env,outFlags,	&isCopy);
 	  for (val=0;val<countReadC;val++){
 		gotFD =	(*env)->GetObjectArrayElement(env,readFDArray,val);
-		hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, gotFD);
+		hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, gotFD);
         (*env)->DeleteLocalRef(env, gotFD);
 
 		if (!hysock_socketIsValid (hysocketP)){
@@ -146,7 +146,7 @@
 		
 	  for (val=0;val<countWriteC;val++){
 		gotFD =	(*env)->GetObjectArrayElement(env,writeFDArray,val);
-		hysocketP = getJavaIoFileDescriptorContentsAsPointer (env, gotFD);
+		hysocketP = getJavaIoFileDescriptorContentsAsAPointer (env, gotFD);
         (*env)->DeleteLocalRef(env, gotFD);
 
 		if (!hysock_socketIsValid (hysocketP)){

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.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/String2Test.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java Thu Oct 25 07:44:56 2007
@@ -366,7 +366,7 @@
                     assertEquals((byte) i, result[0]);
                 } else {
                     /*
-                     * Substitue character should be 0x1A [1], but may be '?'
+                     * Substitute character should be 0x1A [1], but may be '?'
                      * character. [1]
                      * http://en.wikipedia.org/wiki/Substitute_character
                      */

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.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/ThreadTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java Thu Oct 25 07:44:56 2007
@@ -262,10 +262,13 @@
 	 */
 	public void test_activeCount() {
 		// Test for method int java.lang.Thread.activeCount()
-		Thread t = new Thread(new SimpleThread(1));
-		int active = Thread.activeCount();
-		assertTrue("Incorrect read made: " + active, active > 0);
-		t.start();
+		Thread t = new Thread(new SimpleThread(10));
+		int active = 0;
+		synchronized (t) {
+			t.start();
+			active = Thread.activeCount();
+		}
+		assertTrue("Incorrect activeCount for current group: " + active, active > 1);
 		try {
 			t.join();
 		} catch (InterruptedException e) {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileInputStreamTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileInputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileInputStreamTest.java Thu Oct 25 07:44:56 2007
@@ -351,7 +351,7 @@
 
         try {
             fis.read(new byte[1], 0, 5);
-            fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
+            fail("IndexOutOfBoundsException must be thrown if off+len > b.length");
         } catch (IndexOutOfBoundsException e) {}
 
         try {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileOutputStreamTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FileOutputStreamTest.java Thu Oct 25 07:44:56 2007
@@ -196,7 +196,7 @@
 
         try {
             fos.write(new byte[1], 0, 5);
-            fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
+            fail("IndexOutOfBoundsException must be thrown if off+len > b.length");
         } catch (IndexOutOfBoundsException e) {}
 
         try {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FilePermissionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FilePermissionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FilePermissionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/FilePermissionTest.java Thu Oct 25 07:44:56 2007
@@ -48,7 +48,7 @@
 		assertEquals("action given to the constructor did not correspond - constructor failed",
 				"write", constructFile.getActions());
 		assertTrue(
-				"name given to the construcotr did not correspond - construcotr failed",
+				"name given to the constructor did not correspond - constructor failed",
 				constructFile.getName() == "test constructor");
 
         // Regression test for HARMONY-1050

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/RandomAccessFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/RandomAccessFileTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/RandomAccessFileTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/RandomAccessFileTest.java Thu Oct 25 07:44:56 2007
@@ -774,7 +774,7 @@
 
         try {
             raf.read(new byte[1], 0, 5);
-            fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
+            fail("IndexOutOfBoundsException must be thrown if off+len > b.length");
         } catch (IndexOutOfBoundsException e) {
         }
 
@@ -878,7 +878,7 @@
 
         try {
             raf.write(new byte[1], 0, 5);
-            fail("IndexOutOfBoundsException must be thrown if off+len > b.lengh");
+            fail("IndexOutOfBoundsException must be thrown if off+len > b.length");
         } catch (IndexOutOfBoundsException e) {
         }
 
@@ -936,4 +936,4 @@
         super.tearDown();
     }
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/UTFDataFormatExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/UTFDataFormatExceptionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/UTFDataFormatExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/io/UTFDataFormatExceptionTest.java Thu Oct 25 07:44:56 2007
@@ -41,7 +41,7 @@
 		} catch (UTFDataFormatException e) {
 			return;
 		} catch (Exception e) {
-			fail("Exeption during Constructor test : " + e.getMessage());
+			fail("Exception during Constructor test : " + e.getMessage());
 		}
 	}
 
@@ -63,7 +63,7 @@
 		} catch (UTFDataFormatException e) {
 			return;
 		} catch (Exception e) {
-			fail("Exeption during Constructor test : " + e.getMessage());
+			fail("Exception during Constructor test : " + e.getMessage());
 		}
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ConstructorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ConstructorTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ConstructorTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ConstructorTest.java Thu Oct 25 07:44:56 2007
@@ -63,7 +63,7 @@
 		} catch (Exception e) {
 			fail("Exception during equals test : " + e.getMessage());
 		}
-		assertTrue("Different Contructors returned equal", !ctor1.equals(ctor2));
+		assertTrue("Different Constructors returned equal", !ctor1.equals(ctor2));
 	}
 
 	/**
@@ -160,7 +160,7 @@
 							.equals(
 									"tests.api.java.lang.reflect.ConstructorTest$ConstructorTestHelper"));
 		} catch (Exception e) {
-			fail("Exception obtaining contructor : " + e.getMessage());
+			fail("Exception obtaining constructor : " + e.getMessage());
 		}
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/DatagramSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/DatagramSocketTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/DatagramSocketTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/DatagramSocketTest.java Thu Oct 25 07:44:56 2007
@@ -1139,7 +1139,7 @@
 				int portNumber = Support_PortManager.getNextPortForUDP();
 				ds = new java.net.DatagramSocket(new mySocketAddress());
 				fail(
-						"No exception when constucting datagramSocket with unsupported SocketAddress type");
+						"No exception when constructing datagramSocket with unsupported SocketAddress type");
 			} catch (IllegalArgumentException e) {
 
 			}

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/JarURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/JarURLConnectionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/JarURLConnectionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/JarURLConnectionTest.java Thu Oct 25 07:44:56 2007
@@ -242,7 +242,7 @@
         // equal but not same manifest
         assertEquals(mf,juc.getManifest());
         assertNotSame(mf,juc.getManifest());
-        // same main attrubutes
+        // same main attributes
         assertEquals(juc.getMainAttributes(),mf.getMainAttributes());
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/ProxySelectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/ProxySelectorTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/ProxySelectorTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/ProxySelectorTest.java Thu Oct 25 07:44:56 2007
@@ -74,7 +74,7 @@
 	/*
 	 * Original system properties must be restored after running each test case.
 	 */
-	private Properties orignalSystemProperties;
+	private Properties originalSystemProperties;
 
 	/**
 	 * @tests java.net.ProxySelector#getDefault()
@@ -91,7 +91,7 @@
 	 * @tests java.net.ProxySelector#getDefault()
 	 */
 	public void test_getDefault_Security() {
-		SecurityManager orignalSecurityManager = System.getSecurityManager();
+		SecurityManager originalSecurityManager = System.getSecurityManager();
 		try {
 			System.setSecurityManager(new MockSecurityManager());
 		} catch (SecurityException e) {
@@ -105,7 +105,7 @@
 		} catch (SecurityException e) {
 			// expected
 		} finally {
-			System.setSecurityManager(orignalSecurityManager);
+			System.setSecurityManager(originalSecurityManager);
 		}
 	}
 
@@ -131,7 +131,7 @@
 	 */
 	public void test_setDefaultLjava_net_ProxySelector_Security() {
 		ProxySelector originalSelector = ProxySelector.getDefault();
-		SecurityManager orignalSecurityManager = System.getSecurityManager();
+		SecurityManager originalSecurityManager = System.getSecurityManager();
 		try {
 			System.setSecurityManager(new MockSecurityManager());
 		} catch (SecurityException e) {
@@ -146,7 +146,7 @@
 		} catch (SecurityException e) {
 			// expected
 		} finally {
-			System.setSecurityManager(orignalSecurityManager);
+			System.setSecurityManager(originalSecurityManager);
 			ProxySelector.setDefault(originalSelector);
 		}
 	}
@@ -621,15 +621,15 @@
 	protected void setUp() throws Exception {
 		super.setUp();
 		// save original system properties
-		orignalSystemProperties = (Properties) System.getProperties().clone();
+		originalSystemProperties = (Properties) System.getProperties().clone();
 	}
 
 	/*
 	 * @see junit.framework.TestCase#tearDown()
 	 */
 	protected void tearDown() throws Exception {
-		// restore orignal system properties
-		System.setProperties(orignalSystemProperties);
+		// restore original system properties
+		System.setProperties(originalSystemProperties);
 		super.tearDown();
 	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URITest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URITest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URITest.java Thu Oct 25 07:44:56 2007
@@ -535,7 +535,7 @@
 
                 // hierarchical tests..
 
-                // diffrent authorities
+                // different authorities
                 { "//www.test.com/test", "//www.test2.com/test" },
 
                 { "/nullauth", "//nonnullauth/test" }, // one null authority
@@ -1443,7 +1443,7 @@
 
                 new URI("//fgj234fkgj.jhj.123"),
 
-                // '-' cannot be first or last charcter in a label
+                // '-' cannot be first or last character in a label
                 new URI("//-domain.name"), new URI("//domain.name-"),
                 new URI("//domain-"),
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java Thu Oct 25 07:44:56 2007
@@ -1189,7 +1189,7 @@
 		URL ftpUrl = new URL("ftp://" + Support_Configuration.FTPTestAddress
 				+ "/nettest.txt");
 		URL[] urlList = { httpUrl, ftpUrl };
-		ProxySelector orignalSelector = ProxySelector.getDefault();
+		ProxySelector originalSelector = ProxySelector.getDefault();
 		ProxySelector.setDefault(new MockProxySelector());
 		try {
 			for (int i = 0; i < urlList.length; ++i) {
@@ -1205,8 +1205,7 @@
 								+ urlList[i], isSelectCalled);
 			}
 		} finally {
-			ProxySelector.setDefault(orignalSelector);
-
+			ProxySelector.setDefault(originalSelector);
 		}
 	}
     

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ArrayListTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ArrayListTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ArrayListTest.java Thu Oct 25 07:44:56 2007
@@ -19,11 +19,11 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.ConcurrentModificationException;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import java.util.ConcurrentModificationException;
 import java.util.Vector;
 
 import tests.support.Support_ListTest;
@@ -544,8 +544,35 @@
         list.addAll(0, collection);
         assertEquals(14, list.size());
     }
-    
-    
+
+    public static class ArrayListExtend extends ArrayList {
+
+        private int size = 0;
+
+        public ArrayListExtend() {
+            super(10);
+        }
+
+        public boolean add(Object o) {
+            size++;
+            return super.add(o);
+        }
+
+        public int size() {
+            return size;
+        }
+    }
+
+    public void test_subclassing() {
+        ArrayListExtend a = new ArrayListExtend();
+        /*
+         * Regression test for subclasses that override size() (which used to
+         * cause an exception when growing 'a').
+         */
+        for (int i = 0; i < 100; i++) {
+            a.add(new Object());
+        }
+    }
     
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java Thu Oct 25 07:44:56 2007
@@ -420,7 +420,7 @@
     /**
      * @tests java.util.EnumSet#remove(Object)
      */
-    public void test_remove_LOject() {
+    public void test_remove_LObject() {
         Set<EnumFoo> set = EnumSet.noneOf(EnumFoo.class);
         Enum[] elements = EnumFoo.class.getEnumConstants();
         for(int i = 0; i < elements.length; i++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertyResourceBundleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertyResourceBundleTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertyResourceBundleTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertyResourceBundleTest.java Thu Oct 25 07:44:56 2007
@@ -152,7 +152,7 @@
             prb = new PropertyResourceBundle(propertiesStream);
         } catch (java.io.IOException e) {
 			fail(
-					"Contruction of PropertyResourceBundle threw IOException");
+					"Construction of PropertyResourceBundle threw IOException");
 		}
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ScannerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ScannerTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ScannerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ScannerTest.java Thu Oct 25 07:44:56 2007
@@ -4798,7 +4798,7 @@
         mresult = s.match();
         assertEquals(0, mresult.start());
         assertEquals(2, mresult.end());
-        // Postion is now pointing at the bar. "12|345test1234test next"
+        // Position is now pointing at the bar. "12|345test1234test next"
 
         result = s.findWithinHorizon(Pattern.compile("\\p{Digit}+"), 6);
         assertEquals("345", result);
@@ -4806,7 +4806,7 @@
         mresult = s.match();
         assertEquals(2, mresult.start());
         assertEquals(5, mresult.end());
-        // Postion is now pointing at the bar. "12345|test1234test next"
+        // Position is now pointing at the bar. "12345|test1234test next"
 
         // If no such pattern is detected then the null is returned and the
         // scanner's position remains unchanged.
@@ -4822,7 +4822,7 @@
         assertEquals("345", mresult.group());
         assertEquals(2, mresult.start());
         assertEquals(5, mresult.end());
-        // Postion is now still pointing at the bar. "12345|test1234test next"
+        // Position is now still pointing at the bar. "12345|test1234test next"
 
         // If horizon is 0, then the horizon is ignored and this method
         // continues to search through the input looking for the specified
@@ -4831,7 +4831,7 @@
         mresult = s.match();
         assertEquals(9, mresult.start());
         assertEquals(13, mresult.end());
-        // Postion is now pointing at the bar. "12345test1234|test next"
+        // Position is now pointing at the bar. "12345test1234|test next"
 
         assertEquals("test", s.next());
         mresult = s.match();

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java Thu Oct 25 07:44:56 2007
@@ -18,6 +18,10 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import tests.support.resource.Support_Resources;
 
 import junit.framework.TestCase;
 
@@ -94,6 +98,43 @@
             dir.deleteOnExit();
         }
     }
+
+
+    /**
+     * Regression test for HARMONY-4794
+     */
+    public void testNonASCIIFileName_4794() throws IOException {
+        final String FILENAME="\u30d5\u30a1\u30a4\u30eb1.txt";
+        final String CONTENT = "A pretty predicament";
+        final String CNTNT_CHARSET = "ISO-8859-1"; 
+
+        File folder = Support_Resources.createTempFolder();
+        File f = new File(folder, FILENAME);
+        FileOutputStream fos = new FileOutputStream(f);
+        FileInputStream fis;
+ 
+        f.createNewFile();
+        f.deleteOnExit();
+        fos.write(CONTENT.getBytes(CNTNT_CHARSET));
+        fos.close();
+
+        f = new File(folder, FILENAME);        
+        assertEquals("Invalid file name", FILENAME, f.getName()); 
+        if (f.exists()) {
+            byte tmp[] = new byte[256];
+            String wasRed;
+            int n;
+
+            fis = new FileInputStream(f);
+            n = fis.read(tmp);
+            fis.close();
+            wasRed = new String(tmp, 0, n, CNTNT_CHARSET);
+            assertEquals("Invalid content was red", CONTENT, wasRed);
+        } else {
+            fail("File does not exist");
+        }
+    }
+
 
 	/**
 	 * @tests java.io.File#canExecute()

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java Thu Oct 25 07:44:56 2007
@@ -37,7 +37,7 @@
  */
 class BitLevel {
 
-    /** Just to denote that this class can't be instantied. */
+    /** Just to denote that this class can't be instantiated. */
     private BitLevel() {}
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Conversion.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Conversion.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Conversion.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Conversion.java Thu Oct 25 07:44:56 2007
@@ -26,7 +26,7 @@
  */
 class Conversion {
 
-    /** Just to denote that this class can't be instantied */
+    /** Just to denote that this class can't be instantiated */
     private Conversion() {}
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java Thu Oct 25 07:44:56 2007
@@ -431,7 +431,7 @@
             }
             } else {
                 
-                // Use Knuth's algorithm of sucessive subtract and shifting
+                // Use Knuth's algorithm of successive subtract and shifting
                 do {
                     Elementary.inplaceSubtract(op2, op1); // both are odd
                     BitLevel.inplaceShiftRight(op2, op2.getLowestSetBit()); // op2 is even

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Elementary.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Elementary.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Elementary.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Elementary.java Thu Oct 25 07:44:56 2007
@@ -32,7 +32,7 @@
  */
 class Elementary {
 
-    /** Just to denote that this class can't be instantied */
+    /** Just to denote that this class can't be instantiated */
 	private Elementary() {
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Logical.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Logical.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Logical.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Logical.java Thu Oct 25 07:44:56 2007
@@ -32,7 +32,7 @@
  */
 class Logical {
 
-    /** Just to denote that this class can't be instantied. */
+    /** Just to denote that this class can't be instantiated. */
     
     private Logical() {}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java Thu Oct 25 07:44:56 2007
@@ -27,7 +27,7 @@
  */
 class Multiplication {
 
-    /** Just to denote that this class can't be instantied. */
+    /** Just to denote that this class can't be instantiated. */
     private Multiplication() {}
 
     /**
@@ -355,7 +355,7 @@
     /**
      *  Performs a<sup>2</sup>
      *  @param a The number to square.
-     *  @param length The lenght of the number to square.
+     *  @param length The length of the number to square.
      */ 
     static int[] square(int[] a, int s) {
         int [] t = new int [s<<1];

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Primality.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Primality.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Primality.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Primality.java Thu Oct 25 07:44:56 2007
@@ -27,7 +27,7 @@
  */
 class Primality {
 
-    /** Just to denote that this class can't be instantied. */
+    /** Just to denote that this class can't be instantiated. */
     private Primality() {}
 
     /* Private Fields */

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -26,7 +26,7 @@
   $(SHAREDSUB)org_apache_harmony_misc_accessors_StringAccessorImpl.o
 
 ifneq ($(HY_ZIP_API),true)
-MDLLIBFILES += $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib$(HY_LINKLIB_SUFFIX)
+MDLLIBFILES += $(LIBPATH)libhyzip.a $(MDLLIBZLIB)
 endif
 
 MDLLIBFILES += $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a \

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/.classpath?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/.classpath Thu Oct 25 07:44:56 2007
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry output="bin/main" kind="src" path="src/main/java"/>
-	<classpathentry output="bin/test" kind="src" path="src/test/java/common"/>
-	<classpathentry output="bin/test" kind="src" path="src/test/java/windows"/>
-	<classpathentry output="bin/test" kind="src" path="src/test/java/unix"/>
-	<classpathentry output="bin/test" kind="src" path="src/test/resources"/>
+	<classpathentry kind="src" path="src/main/java/windows"/>
+	<classpathentry kind="src" path="src/main/java/common"/>
+	<classpathentry kind="src" path="src/main/java/unix"/>
+	<classpathentry kind="src" output="bin/test" path="src/test/java/common"/>
+	<classpathentry kind="src" output="bin/test" path="src/test/java/windows"/>
+	<classpathentry kind="src" output="bin/test" path="src/test/java/unix"/>
+	<classpathentry kind="src" output="bin/test" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry sourcepath="JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="JUNIT_SRC_HOME/junitsrc.zip"/>
 	<classpathentry kind="output" path="bin/main"/>
 </classpath>

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=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/build.xml Thu Oct 25 07:44:56 2007
@@ -26,6 +26,9 @@
     <!-- set global properties for this build. -->
     <xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
 
+    <property name="hy.nio.src.main.java.platform"
+              value="${hy.nio.src.main.java}/../${hy.os.family}" />
+
     <property name="hy.nio.src.test.java.platform"
               value="${hy.nio.src.test.java}/../${hy.os.family}" />
 
@@ -100,7 +103,6 @@
         <mkdir dir="${hy.build}" />
 
         <javac sourcepath=""
-            srcdir="${hy.nio.src.main.java}"
             destdir="${hy.build}"
             compiler="${hy.javac.compiler}"
             memoryMaximumSize="${hy.javac.maxmem}"
@@ -109,6 +111,11 @@
             debug="${hy.javac.debug}">
 
             <compilerarg line="${build.compilerarg}" />
+
+            <src>
+                <pathelement location="${hy.nio.src.main.java}"/>
+                <pathelement location="${hy.nio.src.main.java.platform}" />
+            </src>
 
             <bootclasspath>
                 <fileset dir="${hy.jdk}/jre/lib/boot">

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/make/hyproperties.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/make/hyproperties.xml?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/make/hyproperties.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/make/hyproperties.xml Thu Oct 25 07:44:56 2007
@@ -20,7 +20,7 @@
    <nio location=".">
       <src>
          <main>
-            <java location="src/main/java" />
+            <java location="src/main/java/common" />
             <resources location="src/main/resources" />
             <native location="src/main/native" />
          </main>

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/exports.txt?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/exports.txt (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/exports.txt Thu Oct 25 07:44:56 2007
@@ -2,3 +2,8 @@
 GetDirectBufferAddress
 GetDirectBufferCapacity
 Java_org_apache_harmony_nio_AddressUtil_getFDAddress
+Java_org_apache_harmony_nio_internal_EpollSelectorImpl_resolveFD
+Java_org_apache_harmony_nio_internal_EpollSelectorImpl_prepare
+Java_org_apache_harmony_nio_internal_EpollSelectorImpl_addFileDescriptor
+Java_org_apache_harmony_nio_internal_EpollSelectorImpl_delFileDescriptor
+Java_org_apache_harmony_nio_internal_EpollSelectorImpl_epoll

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -22,7 +22,7 @@
 CFLAGS += -fpic
 
 BUILDFILES = \
-	../shared/DirectBufferUtil.o ../shared/AddressUtil.o 
+	../shared/DirectBufferUtil.o ../shared/AddressUtil.o ../unix/EpollSelectorImpl.o
 
 ifneq ($(HY_ZIP_API),true)
 MDLLIBFILES += $(LIBPATH)libhyzip.a 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.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/DatagramChannelTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java Thu Oct 25 07:44:56 2007
@@ -2403,29 +2403,29 @@
     
     public void test_write_LBuffer_positioned() throws Exception {
         // Regression test for Harmony-683
-        int postion = 16;
+        int position = 16;
         DatagramChannel dc = DatagramChannel.open();
         byte[] sourceArray = new byte[CAPACITY_NORMAL];        
         dc.connect(localAddr1);
         // write
         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
-        sourceBuf.position(postion);
-        assertEquals(CAPACITY_NORMAL - postion, dc.write(sourceBuf));
+        sourceBuf.position(position);
+        assertEquals(CAPACITY_NORMAL - position, dc.write(sourceBuf));
     }
 
-    public void test_send_LBuffer_LSocketAddress_PositonNotZero()
+    public void test_send_LBuffer_LSocketAddress_PositionNotZero()
             throws Exception {
         // regression test for Harmony-701
         int CAPACITY_NORMAL = 256;
-        int postion = 16;
+        int position = 16;
         DatagramChannel dc = DatagramChannel.open();
         byte[] sourceArray = new byte[CAPACITY_NORMAL];
         // send ByteBuffer whose position is not zero
         ByteBuffer sourceBuf = ByteBuffer.wrap(sourceArray);
-        sourceBuf.position(postion);
+        sourceBuf.position(position);
         int ret = dc.send(sourceBuf, localAddr1);
         // assert send (256 - 16) bytes  
-        assertEquals(CAPACITY_NORMAL - postion, ret);
+        assertEquals(CAPACITY_NORMAL - position, ret);
         // assert the position of ByteBuffer has been set
         assertEquals(CAPACITY_NORMAL, sourceBuf.position());
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.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/FileChannelTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelTest.java Thu Oct 25 07:44:56 2007
@@ -1331,7 +1331,7 @@
     /**
      * @tests java.nio.channels.FileChannel#read(ByteBuffer,long)
      */
-    public void test_readLByteBufferJ_Postion_BeyondFileLimit()
+    public void test_readLByteBufferJ_Position_BeyondFileLimit()
             throws Exception {
 
         writeDataToFile(fileOfReadOnlyFileChannel);
@@ -1346,7 +1346,7 @@
     /**
      * @tests java.nio.channels.FileChannel#read(ByteBuffer,long)
      */
-    public void test_readLByteBufferJ_Postion_As_Long() throws Exception {
+    public void test_readLByteBufferJ_Position_As_Long() throws Exception {
         ByteBuffer readBuffer = ByteBuffer.allocate(CAPACITY);
         try {
             readOnlyFileChannel.read(readBuffer, Long.MAX_VALUE);

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.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/ServerSocketChannelTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java Thu Oct 25 07:44:56 2007
@@ -572,4 +572,19 @@
             // expected
         }
     }
+    /**
+     * Regression test for HARMONY-4961
+     */
+    public void test_socket_getLocalPort() throws IOException {
+        serverChannel.socket().bind(localAddr1);
+        clientChannel.connect(localAddr1); 
+        SocketChannel myChannel = serverChannel.accept();
+        int port = myChannel.socket().getLocalPort();
+        assertEquals(localAddr1.getPort(), port);
+        myChannel.close();
+        clientChannel.close();
+        serverChannel.close();
+    }
+
+    
 }

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -389,17 +389,17 @@
         assertEquals(s.getLocalAddress().getHostAddress(), "0.0.0.0");
         // RI fails here. RI returns 0 while spec says unbound socket should
         // return -1.
-        assertEquals(s.getLocalPort(), -1);
+        assertEquals(-1, s.getLocalPort());
         assertFalse(s.getReuseAddress());
         assertNull(s.getLocalSocketAddress());
 
         // not connected
-        assertEquals(s.getPort(), 0);
+        assertEquals(0, s.getPort());
         assertTrue(s.getReceiveBufferSize() >= 8192);
         assertNull(s.getRemoteSocketAddress());
         assertTrue(s.getSendBufferSize() >= 8192);
-        assertEquals(s.getSoTimeout(), 0);
-        assertEquals(s.getTrafficClass(), 0);
+        assertEquals(0, s.getSoTimeout());
+        assertEquals(0, s.getTrafficClass());
 
     }
 
@@ -431,8 +431,8 @@
         assertEquals(s.getRemoteSocketAddress(), (SocketAddress) address);
         // assertFalse(s.getReuseAddress());
         assertTrue(s.getSendBufferSize() >= 8192);
-        assertEquals(s.getSoTimeout(), 0);
-        assertEquals(s.getTrafficClass(), 0);
+        assertEquals(0, s.getSoTimeout());
+        assertEquals(0, s.getTrafficClass());
     }
 
     private void assertSocketAction_Block_BeforeConnect(Socket s)

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/.classpath?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/.classpath Thu Oct 25 07:44:56 2007
@@ -5,7 +5,7 @@
 	<classpathentry kind="src" output="bin/test" path="src/test/java"/>
 	<classpathentry kind="src" output="bin/test" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="JUNIT_SRC_HOME/junitsrc.zip"/>
 	<classpathentry kind="lib" path="src/test/resources/jars/charset_provider.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
 	<classpathentry kind="output" path="bin/main"/>
 </classpath>

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayout.java Thu Oct 25 07:44:56 2007
@@ -248,5 +248,18 @@
     public String getName() {
         return name;
     }
+    
+    public int numBackwardsCallables() {
+        int num = 0;
+        String[] split = layout.split("\\(");
+        if(split.length > 0) {
+            for (int i = 1; i < split.length; i++) {
+                if(split[i].startsWith("-") || split[i].startsWith("0")) {
+                    num++;
+                }
+            }
+        }
+        return num;
+    }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeLayoutMap.java Thu Oct 25 07:44:56 2007
@@ -16,10 +16,6 @@
  */
 package org.apache.harmony.pack200;
 
-// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-// NOTE: Do not extract strings as messages; this code is still a
-// work-in-progress
-// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -223,6 +219,12 @@
         }
         return null;
 	}
+    
+    public AttributeLayout getAttributeLayout(int index, int context)
+            throws Pack200Exception {
+        Map map = layouts[context];
+        return (AttributeLayout) map.get(new Integer(index));
+    }
     
     /**
      * The map should not contain the same layout and name combination more than

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java Thu Oct 25 07:44:56 2007
@@ -15,19 +15,17 @@
  *  limitations under the License.
  */
 package org.apache.harmony.pack200;
-//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-//NOTE: Do not extract strings as messages; this code is still a work-in-progress
-//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
+
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * TODO Comment -- quite a lot can be nicked from Codec, since this was created
  * from it
- * 
- * @author Alex Blewitt
- * 
+ *  
  */
 public final class BHSDCodec extends Codec {
 
@@ -155,13 +153,23 @@
 			x = in.read();
 			if (x == -1)
 				throw new EOFException("End of stream reached whilst decoding");
-			z += x * Math.pow(h, n); 
+			z += x * Math.pow(h, n);
             n++;
 		} while (n < b & isHigh(x));
-        long u = z;
-        long twoPowS = (long)Math.pow(2, s);
-        double twoPowSMinusOne = twoPowS-1;
+
+// TODO: Decide whether to use this algorithm instead (neater, possibly quicker but less easy to understand)
+//        if (isSigned()) {
+//            int u = ((1 << s) - 1);
+//            if ((z & u) == u) {
+//                z = z >>> s ^ -1L;
+//            } else {
+//                z = z - (z >>> s);
+//            }
+//        }
         if(isSigned()) {
+            long u = z;
+            long twoPowS = (long)Math.pow(2, s);
+            double twoPowSMinusOne = twoPowS-1;
             if(u % twoPowS < twoPowSMinusOne) {
                 if(cardinality < Math.pow(2, 32)) {
                     z = (long) (u - (Math.floor(u/ twoPowS)));                    
@@ -172,8 +180,8 @@
                 z = (long) (-Math.floor(u/ twoPowS) - 1);
             }
         }
-		if (isDelta())
-			z += last;
+	    if (isDelta())
+	        z += last;
 		return z;
 	}
 
@@ -196,6 +204,50 @@
 	public boolean encodes(long value) {
 		return (value >= smallest() && value <= largest());
 	}
+    
+    public byte[] encode(long value, long last) throws Pack200Exception {
+        if (isDelta()) {
+            value -= last;
+        }
+        if (!encodes(value)) {
+            throw new Pack200Exception("The codec " + toString()
+                    + " does not encode the value " + value);
+        }
+        long z = value;
+        if (isSigned()) {
+            if (z < 0) {
+                z = (-z << s) - 1;
+            } else {
+                if (s == 1) {
+                    z = z << s;
+                } else {
+                    z += (z - z % 3) / 3;
+                }
+            }
+        }
+        List byteList = new ArrayList();
+        for (int n = 0; n < b; n++) {
+            long byteN;
+            if (z < l) {
+                byteN = z;
+            } else {
+                byteN = z % h;
+                while (byteN < l)
+                    byteN += h;
+            }
+            byteList.add(new Byte((byte) byteN));
+            if (byteN < l) {
+                break;
+            }
+            z -= byteN;
+            z /= h;
+        }
+        byte[] bytes = new byte[byteList.size()];
+        for (int i = 0; i < bytes.length; i++) {
+            bytes[i] = ((Byte) byteList.get(i)).byteValue();
+        }
+        return bytes;
+    }
 
 	/**
 	 * Returns true if this codec is a delta codec
@@ -220,19 +272,15 @@
 	 */
 	public long largest() {
 		long result;
-		if (isDelta()) {
-			result = Long.MAX_VALUE;
+		// TODO This can probably be optimized into a better mathematical statement
+		if (s == 0) {
+			result = cardinality() - 1;
+		} else if (s == 1) {
+			result = cardinality() / 2 - 1;
+		} else if (s == 2) {
+			result = (3L * cardinality()) / 4 - 1;
 		} else {
-			// TODO This can probably be optimized into a better mathematical statement
-			if (s == 0) {
-				result = cardinality() - 1;
-			} else if (s == 1) {
-				result = cardinality() / 2 - 1;
-			} else if (s == 2) {
-				result = (3L * cardinality()) / 4 - 1;
-			} else {
-				throw new Error("Unknown s value");
-			}
+			throw new Error("Unknown s value");
 		}
 		return Math.min((s == 0 ? ((long) Integer.MAX_VALUE) << 1
 				: Integer.MAX_VALUE) - 1, result);
@@ -244,14 +292,10 @@
 	 */
 	public long smallest() {
 		long result;
-		if (isDelta()) {
-			result = Integer.MIN_VALUE;
+		if (isSigned()) {
+			result = -cardinality() / (1 << s);
 		} else {
-			if (isSigned()) {
-				result = -cardinality() / (1 << s);
-			} else {
-				result = 0;
-			}
+			result = 0;
 		}
 		return Math.max(Integer.MIN_VALUE, result);
 	}

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Thu Oct 25 07:44:56 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.harmony.pack200;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -36,7 +37,7 @@
     }
 
     /**
-     * Decode a band and return an array of <code>int[]</code> values
+     * Decode a band and return an array of <code>int</code> values
      * 
      * @param name
      *            the name of the band (primarily for logging/debugging
@@ -47,7 +48,7 @@
      *            the default codec for this band
      * @param count
      *            the number of elements to read
-     * @return an array of decoded <code>int[]</code> values
+     * @return an array of decoded <code>int</code> values
      * @throws IOException
      *             if there is a problem reading from the underlying input
      *             stream
@@ -60,17 +61,34 @@
             Pack200Exception {
         // TODO Might be able to improve this directly.
         int[] result = new int[count];
-
-        // TODO We need to muck around in the scenario where the first value
-        // read indicates
-        // an uber-codec
         long[] longResult = decodeBandLong(name, in, defaultCodec, count);
         for (int i = 0; i < count; i++) {
             result[i] = (int) longResult[i];
         }
         return result;
     }
-    
+
+    /**
+     * Decode a band and return an array of <code>int[]</code> values
+     * 
+     * @param name
+     *            the name of the band (primarily for logging/debugging
+     *            purposes)
+     * @param in
+     *            the InputStream to decode from
+     * @param defaultCodec
+     *            the default codec for this band
+     * @param counts
+     *            the numbers of elements to read for each int array within the
+     *            array to be returned
+     * @return an array of decoded <code>int[]</code> values
+     * @throws IOException
+     *             if there is a problem reading from the underlying input
+     *             stream
+     * @throws Pack200Exception
+     *             if there is a problem decoding the value or that the value is
+     *             invalid
+     */
     public int[][] decodeBandInt(String name, InputStream in, BHSDCodec defaultCodec, int[] counts) throws IOException, Pack200Exception {
         int[][] result = new int[counts.length][];
         int totalCount = 0;
@@ -90,7 +108,7 @@
     }
     
     /**
-     * Decode a band and return an array of <code>long[]</code> values
+     * Decode a band and return an array of <code>long</code> values
      * 
      * @param name
      *            the name of the band (primarily for logging/debugging
@@ -101,7 +119,7 @@
      *            the default codec for this band
      * @param count
      *            the number of elements to read
-     * @return an array of decoded <code>long[]</code> values
+     * @return an array of decoded <code>long</code> values
      * @throws IOException
      *             if there is a problem reading from the underlying input
      *             stream
@@ -135,24 +153,39 @@
             return codec.decode(count - 1, in, first);
         }
     }
+
+    public byte[] encodeBandLong(long[] data, BHSDCodec codec) throws IOException, Pack200Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        for (int i = 0; i < data.length; i++) {
+            baos.write(codec.encode(data[i], i == 0 ? 0 : data[i-1]));
+        }
+        return baos.toByteArray();
+    }
     
     public long[] parseFlags(String name, InputStream in, int count,
-            BHSDCodec codec, boolean hasHi) throws IOException, Pack200Exception {
-        return parseFlags(name, in, 1, new int[] { count }, (hasHi ? codec
-                : null), codec)[0];
+            BHSDCodec codec, boolean hasHi) throws IOException,
+            Pack200Exception {
+        return parseFlags(name, in, new int[] { count },
+                (hasHi ? codec : null), codec)[0];
+    }
+
+    public long[][] parseFlags(String name, InputStream in, int counts[],
+            BHSDCodec codec, boolean hasHi) throws IOException,
+            Pack200Exception {
+        return parseFlags(name, in, counts, (hasHi ? codec : null), codec);
     }
 
-    public long[][] parseFlags(String name, InputStream in, int count,
-            int counts[], BHSDCodec codec, boolean hasHi) throws IOException,
+    public long[] parseFlags(String name, InputStream in, int count,
+            BHSDCodec hiCodec, BHSDCodec loCodec) throws IOException,
             Pack200Exception {
-        return parseFlags(name, in, count, counts, (hasHi ? codec : null),
-                codec);
+        return parseFlags(name, in, new int[] { count }, hiCodec, loCodec)[0];
     }
 
-    public long[][] parseFlags(String name, InputStream in, int count,
-            int counts[], BHSDCodec hiCodec, BHSDCodec loCodec) throws IOException,
+    public long[][] parseFlags(String name, InputStream in, int counts[],
+            BHSDCodec hiCodec, BHSDCodec loCodec) throws IOException,
             Pack200Exception {
         // TODO Move away from decoding into a parseBand type structure
+        int count = counts.length;
         if (count == 0) {
             return new long[][] { {} };
         }
@@ -182,7 +215,7 @@
      * [0..reference.length-1].
      * 
      * @param name
-     *            TODO
+     *            the band name
      * @param in
      *            the input stream to read from
      * @param codec
@@ -247,12 +280,12 @@
         }
         // TODO Merge the decode and parsing of a multiple structure into one
         String[] result1 = new String[sum];
-        int[] decode = decodeBandInt(name, in, codec, sum);
+        int[] indices = decodeBandInt(name, in, codec, sum);
         for (int i1 = 0; i1 < sum; i1++) {
-            int index = decode[i1];
+            int index = indices[i1];
             if (index < 0 || index >= reference.length)
                 throw new Pack200Exception(
-                        "Something has gone wrong during parsing references");
+                        "Something has gone wrong during parsing references, index = " + index + ", array size = " + reference.length);
             result1[i1] = reference[index];
         }
         String[] refs = result1;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java Thu Oct 25 07:44:56 2007
@@ -21,7 +21,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
-import java.util.Arrays;
 
 import org.apache.harmony.pack200.bytecode.ByteCode;
 import org.apache.harmony.pack200.bytecode.CodeAttribute;
@@ -31,8 +30,11 @@
  */
 public class BcBands extends BandSet {
     
-    // the bytecodes for each method in each class as they come (i.e. in their packed format)
+    // The bytecodes for each method in each class as they come (i.e. in their packed format)
     private byte[][][] methodByteCodePacked;
+    
+    // The bands
+    // TODO:  Haven't resolved references yet.  Do we want to?
     private int[] bcCaseCount;
     private int[][] bcCaseValue;
     private int[] bcByte;
@@ -137,7 +139,6 @@
                    for (int i = 0; i < codes.length; i++) {
                        codes[i] = methodByteCodePacked[c][m][i] & 0xff;
                    }
-                   debug(Arrays.toString(codes));
                    for (int i = 0; i < methodByteCodePacked[c][m].length; i++) {
                        int codePacked = 0xff & methodByteCodePacked[c][m][i];
                        // TODO a lot of this needs to be encapsulated in the
@@ -467,6 +468,5 @@
 
     public int[][] getBcEscByte() {
         return bcEscByte;
-    }    
-
+    }
 }



Mime
View raw message