harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r588245 [8/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/portlib/src/main/native/port/unix/hyipcmutex.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyipcmutex.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyipcmutex.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyipcmutex.c Thu Oct 25 07:44:56 2007
@@ -60,7 +60,7 @@
  *
  * If a Mutex with the same Name already exists, the function opens the existing 
  * Mutex and tries to lock it.
- * If another process already has the Mutex locked, the function will block indefinetely. 
+ * If another process already has the Mutex locked, the function will block indefinitely. 
  * If there is no Mutex with the same Name, the function will create it and lock
  * it for the calling process of this function.
  *

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyshsem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyshsem.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyshsem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hyshsem.c Thu Oct 25 07:44:56 2007
@@ -784,7 +784,7 @@
       return FAILED;
     }
 
-  /*sucessfully created base file, now create semaphores */
+  /*successfully created base file, now create semaphores */
 
   while (projid < HYSH_MAX_PROJ_ID)
     {
@@ -835,7 +835,7 @@
                                              findError (errno, __errno2 ()));
           return FAILED;
         }
-      /* if we get here it means that we have succes with getting a semaphore! */
+      /* if we get here it means that we have success with getting a semaphore! */
       break;
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysock.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysock.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysock.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysock.c Thu Oct 25 07:44:56 2007
@@ -495,7 +495,7 @@
  * entity, as known to the communications layer. The exact format of the addr parameter 
  * is determined by the address family established when the socket was created. 
  * @param[in] sockHandle A pointer to a hysocket_t  which will point to the newly created 
- * socket once accept returns succesfully
+ * socket once accept returns successfully
  *
  * @return 
  * \arg 0 on success
@@ -1074,7 +1074,7 @@
   OSADDRINFO *addr;
   int i;
 
-  /* If we have the IPv6 functions then we'll cast to a OSADDRINFO othewise we have a hostent */
+  /* If we have the IPv6 functions then we'll cast to a OSADDRINFO otherwise we have a hostent */
 #if defined(IPv6_FUNCTION_SUPPORT)
   addr = (OSADDRINFO *) handle->addr_info;
   for (i = 0; i < index; i++)
@@ -3983,7 +3983,7 @@
       interfaces[counter].addresses = NULL;
     }
 #endif
-/* set up the return stucture */
+/* set up the return structure */
   array->elements = interfaces;
   array->length = numAdapters;
   /* now get the adapter information */
@@ -4406,7 +4406,7 @@
       interfaces[counter].addresses = NULL;
     }
 #endif
-/* set up the return stucture */
+/* set up the return structure */
   array->elements = interfaces;
   array->length = numAdapters;
   lastName = NULL;
@@ -4663,7 +4663,7 @@
       interfaces[counter].addresses = NULL;
     }
 #endif
-/* set up the return stucture */
+/* set up the return structure */
   array->elements = interfaces;
   array->length = numAdapters;
   lastName = NULL;
@@ -5025,7 +5025,7 @@
             }
           /* we are done if the NLM_F_MULTI flag is not set in this header */
           *nextMessage = netlinkContext->netlinkHeader;
-          if (netlinkContext->netlinkHeader->nlmsg_flags & NLM_F_MULTI !=
+          if ((netlinkContext->netlinkHeader->nlmsg_flags & NLM_F_MULTI) !=
               NLM_F_MULTI)
             {
               netlinkContext->done = 1;

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/hysysinfo.c Thu Oct 25 07:44:56 2007
@@ -41,6 +41,7 @@
 #if defined(FREEBSD) || defined(MACOSX)
 #include <sys/types.h>
 #include <sys/sysctl.h>
+#include <dlfcn.h>
 #endif
 
 #include <unistd.h>
@@ -305,6 +306,23 @@
 #if defined(LINUX)
   return readSymbolicLink (portLibrary, "/proc/self/exe", result);
 #else
+#if defined(FREEBSD)
+  extern int main (int argc, char **argv, char **envp);
+  Dl_info info;
+  if (dladdr( (const void*)&main, &info) == 0) {
+    return -1;
+  }
+  *result =
+    (portLibrary->mem_allocate_memory) (portLibrary,
+                                        strlen (info.dli_fname) + 1);
+
+  if (!*result) {
+    return -1;
+  }
+  strcpy (*result, info.dli_fname);
+  return 0;
+  
+#else
   IDATA retval = -1;
   IDATA length;
   char *p;
@@ -431,6 +449,7 @@
       currentName = NULL;
     }
   return retval;
+#endif
 #endif
 
 }

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=588245&r1=588244&r2=588245&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 Thu Oct 25 07:44:56 2007
@@ -42,9 +42,4 @@
 DLLNAME = ../libhyprt$(HY_SHLIB_SUFFIX)
 EXPNAME = HYPRT_0.1
 
-# temp by geir - please ignore
-#
-LIBNAME = $(LIBPATH)libhyprt.a
-
-
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfile.c Thu Oct 25 07:44:56 2007
@@ -90,9 +90,11 @@
 {
   DWORD result;
   wchar_t *pathW;
+
   convert_path_to_unicode(portLibrary, path, &pathW);
   result = GetFileAttributesW ((LPCWSTR) pathW);
   portLibrary->mem_free_memory(portLibrary, pathW);
+
   if (result == 0xFFFFFFFF)
     {
       result = GetLastError ();
@@ -206,8 +208,9 @@
   strcat (newPath, "*");
   
   convert_path_to_unicode(portLibrary, newPath, &pathW);
-
   result = FindFirstFileW ((LPCWSTR) pathW, &lpFindFileDataW);
+  portLibrary->mem_free_memory(portLibrary, pathW);
+
   if (result == INVALID_HANDLE_VALUE)
     {
       I_32 error = GetLastError ();
@@ -266,13 +269,17 @@
     HANDLE newHandle;
     I_64 result, tempResult;
     I_32 error;
+    wchar_t *pathW;
 
-    newHandle = CreateFile(path, FILE_READ_ATTRIBUTES,  
+    convert_path_to_unicode(portLibrary, path, &pathW);
+    newHandle = CreateFileW(pathW, FILE_READ_ATTRIBUTES,  
         FILE_SHARE_READ,  
         NULL,  
         OPEN_EXISTING,  
         FILE_FLAG_BACKUP_SEMANTICS,  
         NULL);
+    portLibrary->mem_free_memory(portLibrary, pathW);
+
     if (newHandle == INVALID_HANDLE_VALUE)
     {
         error = GetLastError ();
@@ -321,11 +328,18 @@
     I_64 result;
     I_32 error;
     WIN32_FILE_ATTRIBUTE_DATA myStat;
-    int ret = GetFileAttributesEx(path,GetFileExInfoStandard,&myStat);
+    wchar_t *pathW;
+    int ret;
+    
+    convert_path_to_unicode(portLibrary, path, &pathW);
+    ret = GetFileAttributesExW(pathW,GetFileExInfoStandard,&myStat);
+    portLibrary->mem_free_memory(portLibrary, pathW);    
+
     if(ret == 0) {
         error = GetLastError ();
         return portLibrary->error_set_last_error (portLibrary, error, findError (error));
     }
+
     result = ((I_64) myStat.nFileSizeHigh) << 32;
     result += (I_64) myStat.nFileSizeLow;
     return result;
@@ -333,13 +347,59 @@
 
 #undef CDEV_CURRENT_FUNCTION
 
+#define CDEV_CURRENT_FUNCTION is_device_name
+
+/**
+ * Determines if the given file name is a reserved device name
+  
+ * @param[in] fname file name
+ * @return length of device name if given file name is a device name or
+ *   0 otherwise 
+ */
+int
+is_device_name(const char *fname)
+{
+    const char *reserved[] = {"con", "prn", "aux", "nul", "com", "lpt"};
+    int i, len = strlen(fname);
+    
+    for (i = 0; i < 6; i++) {
+        if (i < 4 && len >= 3 && !_stricmp(fname + len - 3, reserved[i])) {
+            return 3;
+        } else if (len >= 4 && !_strnicmp(fname + len - 4, reserved[i], 3) &&
+                   isdigit(fname[len - 1])) {
+            return 4;
+        }
+    }
+    return 0;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
 #define CDEV_CURRENT_FUNCTION convert_path_to_unicode
 
+
+// Maximum length of path accepted by unicode versions of
+// WinAPI functions is limited to 32767 characters;
+// each character can take up to three bytes in UTF-8.
+#define ABS_PATH_BUF_LEN 32767*3
+   
+/**
+ * Convert UTF-8 encoded path to UTF-16 so it can be used as an argument to
+ * unicode versions of WinAPI fucntions. This function also converts all
+ * relative paths to absolute ones.
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] path UTF-8 encoded null-terminated path
+ * @param[out] pathW Pointer to wide characters array that contains converted
+ *   path
+ *
+ * @note Sets *pathW to null and returns if path cannot be converted 
+ */
 void
 convert_path_to_unicode(struct HyPortLibrary * portLibrary, const char *path,
 	     wchar_t **pathW)
 {
-    int len = strlen(path);
+    int len;
     int wlen;
     char *canonicalpath;
     int srcArrayCount=0;
@@ -347,25 +407,52 @@
     int slashCount=0; //record how many slashes it met.
     int dotsCount=0; //record how many dots following a separator.
     int *slashStack; //record position of every separator.
+    
+    // Buffer to store absolute path name.
+    char absPath[ABS_PATH_BUF_LEN];
+ 
+    if (!path) {
+        *pathW = (void*) 0;
+        return;
+    }
+
+    // check if given path is a name of device: nul, con, lpt1 and etc.
+    if (len = is_device_name(path)) {
+        wlen = MultiByteToWideChar(CP_UTF8, 0, path, -1, *pathW, 0);
+        *pathW = portLibrary->mem_allocate_memory(portLibrary, wlen*sizeof(wchar_t));
+        MultiByteToWideChar(CP_UTF8, 0, path + strlen(path) - len, -1, *pathW, wlen);
+        return;
+    }
+
+    // calculate an absolute path first
+    if (!GetFullPathNameA(path, ABS_PATH_BUF_LEN, absPath, (void*) 0))
+    {
+        // error occurred
+        *pathW = (void*) 0;
+        return;
+    }
+
+    len = strlen(absPath);
+
     slashStack = portLibrary->mem_allocate_memory(portLibrary, len*sizeof(int));
     canonicalpath = portLibrary->mem_allocate_memory(portLibrary, len+5);
 
     strcpy(canonicalpath,"\\\\?\\");
 
     for(srcArrayCount=0,destArrayCount=4;srcArrayCount<len;srcArrayCount++){
-        // the input path of this method has been parsed to absolute path already.
-        if(path[srcArrayCount]=='.'){
+        // we have an absolute path already.
+        if(absPath[srcArrayCount]=='.'){
             // count the dots following last separator.
-            if(dotsCount>0 || path[srcArrayCount-1]=='\\'){
+            if(dotsCount>0 || absPath[srcArrayCount-1]=='\\'){
                 dotsCount++;
                 continue;
             }
         }
         // deal with the dots when we meet next separator.
-        if(path[srcArrayCount]=='\\'){
+        if(absPath[srcArrayCount]=='\\'){
             if(dotsCount == 1){
-        	dotsCount = 0;
-        	continue;
+                dotsCount = 0;
+                continue;
             }else if (dotsCount > 1){
                 if(slashCount-2<0){
                     slashCount=2;
@@ -385,7 +472,7 @@
             canonicalpath[destArrayCount++]='.';
             dotsCount--;
         }
-        canonicalpath[destArrayCount++]=path[srcArrayCount];
+        canonicalpath[destArrayCount++]=absPath[srcArrayCount];
     }
     while(canonicalpath[destArrayCount-1] == '.'){
         destArrayCount--;
@@ -398,6 +485,7 @@
     portLibrary->mem_free_memory(portLibrary, slashStack);
 }
 
+#undef ABS_PATH_BUF_LEN
 #undef CDEV_CURRENT_FUNCTION
 
 #define CDEV_CURRENT_FUNCTION hyfile_mkdir
@@ -416,6 +504,7 @@
 {
     int returnVar=0;
     wchar_t *pathW;
+
     convert_path_to_unicode(portLibrary, path, &pathW);
     returnVar = CreateDirectoryW (pathW, 0);
     portLibrary->mem_free_memory(portLibrary, pathW);
@@ -450,7 +539,16 @@
 hyfile_move (struct HyPortLibrary * portLibrary, const char *pathExist,
 	     const char *pathNew)
 {
-  if (MoveFile (pathExist, pathNew))
+  wchar_t *pathExistW, *pathNewW;
+  int ret;
+  
+  convert_path_to_unicode(portLibrary, pathExist, &pathExistW);
+  convert_path_to_unicode(portLibrary, pathNew, &pathNewW);
+  ret = MoveFileW (pathExistW, pathNewW);
+  portLibrary->mem_free_memory(portLibrary, pathNewW);
+  portLibrary->mem_free_memory(portLibrary, pathExistW);
+  
+  if (ret)
     {
       return 0;
     }
@@ -483,6 +581,7 @@
   DWORD accessMode, shareMode, createMode, flagsAndAttributes;
   HANDLE aHandle;
   I_32 error;
+  wchar_t *pathW;
 
   Trc_PRT_file_open_Entry (path, flags, mode);
 
@@ -516,14 +615,17 @@
 		flagsAndAttributes |= FILE_FLAG_WRITE_THROUGH;
 	}
 
+  convert_path_to_unicode(portLibrary, path, &pathW);
   aHandle =
-    CreateFile (path, accessMode, shareMode, NULL, createMode,
+    CreateFileW (pathW, accessMode, shareMode, NULL, createMode,
 		flagsAndAttributes, NULL);
+
   if (aHandle == INVALID_HANDLE_VALUE)
     {
       error = GetLastError ();
       portLibrary->error_set_last_error (portLibrary, error,
 					 findError (error));
+      portLibrary->mem_free_memory(portLibrary, pathW); 
       Trc_PRT_file_open_Exit2 (error, findError (error));
       return -1;
     }
@@ -537,13 +639,14 @@
 	}
 
       aHandle =
-	CreateFile (path, accessMode, shareMode, NULL, TRUNCATE_EXISTING,
+	CreateFileW (pathW, accessMode, shareMode, NULL, TRUNCATE_EXISTING,
 		    flagsAndAttributes, NULL);
       if (aHandle == INVALID_HANDLE_VALUE)
-	{
+      {
 	  error = GetLastError ();
 	  portLibrary->error_set_last_error (portLibrary, error,
 					     findError (error));
+      portLibrary->mem_free_memory(portLibrary, pathW); 
 	  Trc_PRT_file_open_Exit3 (error, findError (error));
 	  return -1;
 	}
@@ -554,6 +657,7 @@
       portLibrary->file_seek (portLibrary, (IDATA) aHandle, 0, HySeekEnd);
     }
 
+  portLibrary->mem_free_memory(portLibrary, pathW); 
   Trc_PRT_file_open_Exit (aHandle);
   return ((IDATA) aHandle);
 }
@@ -748,14 +852,21 @@
 I_32 VMCALL
 hyfile_unlink (struct HyPortLibrary * portLibrary, const char *path)
 {
+  wchar_t *pathW;
+  int ret;
+
   /* should be able to delete read-only dirs, so we set the file attribute back to normal */
-  if (0 == SetFileAttributes (path, FILE_ATTRIBUTE_NORMAL))
+  convert_path_to_unicode(portLibrary, path, &pathW);
+  if (0 == SetFileAttributesW (pathW, FILE_ATTRIBUTE_NORMAL))
     {
       I_32 error = GetLastError ();
       portLibrary->error_set_last_error (portLibrary, error, findError (error));	/* continue */
     }
 
-  if (DeleteFile (path))
+  ret = DeleteFileW (pathW);
+  portLibrary->mem_free_memory(portLibrary, pathW);  
+  
+  if (ret)
     {
       return 0;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfiletext.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfiletext.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfiletext.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyfiletext.c Thu Oct 25 07:44:56 2007
@@ -25,10 +25,7 @@
 
 #include <windows.h>
 #include "hyport.h"
-
-#define CDEV_CURRENT_FUNCTION _prototypes_private
-U_32 decodeUTF8CharN (const U_8 * input, U_16 * result, U_32 bytesRemaining);
-#undef CDEV_CURRENT_FUNCTION
+#include "utf8decode.h"
 
 #define CDEV_CURRENT_FUNCTION hybuf_write_text
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyipcmutex.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyipcmutex.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyipcmutex.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyipcmutex.c Thu Oct 25 07:44:56 2007
@@ -41,7 +41,7 @@
  * Acquires a named mutex for the calling process.
  *
  * If a Mutex with the same Name already exists, the function opens the existing Mutex and tries
- * to lock it. If another process already has the Mutex locked, the function will block indefinetely. 
+ * to lock it. If another process already has the Mutex locked, the function will block indefinitely. 
  * If there is no Mutex with the same Name, the function will create it and lock it for the calling
  * process of this function.
  *
@@ -77,7 +77,7 @@
     {
       /* Wait until mutex is released by other process */
       dwResult = WaitForSingleObject (hMutex,	/* Handle to mutex */
-				      INFINITE);	/* Block indefinetely */
+				      INFINITE);	/* Block indefinitely */
 
       /* if state of mutex was signaled within wait interval or mutex was abandoned, return true */
       /* otherwise function timeout, so return false */

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c Thu Oct 25 07:44:56 2007
@@ -499,7 +499,7 @@
  * entity, as known to the communications layer. The exact format of the addr parameter 
  * is determined by the address family established when the socket was created. 
  * @param[in] sockHandle A pointer to a hysocket_t  which will point to the newly created 
- * socket once accept returns succesfully
+ * socket once accept returns successfully
  *
  * @return 
  * \arg 0 on success
@@ -1311,7 +1311,7 @@
   OSADDRINFO *addr;
   int i;
 
-  /* If we have the IPv6 functions then we'll cast to a OSADDRINFO othewise we have a hostent */
+  /* If we have the IPv6 functions then we'll cast to a OSADDRINFO otherwise we have a hostent */
   if (PPG_sock_IPv6_FUNCTION_SUPPORT)
     {
       addr = (OSADDRINFO *) handle->addr_info;
@@ -2034,7 +2034,7 @@
 	}
     }
 
-  /* if both sockets are open we cannot retun the address for either one as whichever one we return it is wrong in some 
+  /* if both sockets are open we cannot return the address for either one as whichever one we return it is wrong in some 
      cases. Therefore,  we reset the address to the ANY address and leave the port as is as it should be the same
      for both sockets (bind makes sure that when we open the two sockets we use the same port */
   if ((handle->flags & SOCKET_IPV4_OPEN_MASK)
@@ -4206,7 +4206,7 @@
 	    }
 #endif
 
-	  /* set up the return stucture */
+	  /* set up the return structure */
 	  array->elements = interfaces;
 	  array->length = numAdapters;
 
@@ -4631,7 +4631,7 @@
 	}
 #endif
 
-      // set up the return stucture
+      // set up the return structure
       array->elements = interfaces;
       array->length = numAdapters + 1;
       currentAdapter = adaptersList;

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hycpu

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyerror/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -2,3 +2,4 @@
 *.pdb
 *.obj
 *.manifest
+hyerror

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -2,3 +2,4 @@
 *.pdb
 *.obj
 *.manifest
+hyfile

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfile/shared/hyfile.c Thu Oct 25 07:44:56 2007
@@ -23,10 +23,8 @@
 #include "hycomp.h"
 #include "hyport.h"
 #include "hycunit.h"
+#include "utf8encode.h"
 
-#define CDEV_CURRENT_FUNCTION _prototypes_private
-encodeUTF8CharN (UDATA unicode, U_8 * result, U_32 bytesRemaining);
-#undef CDEV_CURRENT_FUNCTION
 void cleanup(HyPortLibrary hyportLibrary);
 void generateAbsoluteFilePath(struct HyPortLibrary *hyportLibrary,char *dist , char *fileName);
 void forVprintfTest(struct HyPortLibrary *hyportLibrary,IDATA fd,char* format,...);

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hyfiletext

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hygp

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hymem

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hynls

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hyport

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -0,0 +1 @@
+hystr

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hytime/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -2,3 +2,4 @@
 *.pdb
 *.obj
 *.manifest
+hytime

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/init/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 25 07:44:56 2007
@@ -2,3 +2,4 @@
 *.pdb
 *.obj
 *.manifest
+init

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/PrintClient.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/PrintClient.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/PrintClient.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/PrintClient.java Thu Oct 25 07:44:56 2007
@@ -75,7 +75,7 @@
      * @param flavor flavor of document, for which check should
      * be performed.
      * @param attributes set of doc's print request attributes.
-     * @return true if attribute value is supported, and othervise
+     * @return true if attribute value is supported, and otherwise
      * false.
      */
     boolean isAttributeValueSupported(Attribute attribute,

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java Thu Oct 25 07:44:56 2007
@@ -791,7 +791,7 @@
     void selectMedia(Media oldMedia) {
         if (sizeBox.getItemCount() > 0) {    
             
-            /* if media was not set - get it from attribites */
+            /* if media was not set - get it from attributes */
             if ((oldMedia == null) && attrs.containsKey(Media.class)) {
                 oldMedia = (Media) attrs.get(Media.class);
             }
@@ -1010,10 +1010,10 @@
      * Meaning of this fields should be updated if Orientation is changed.
      * 
      * When we initialize the dialog at first time, "Margins" values are 
-     * calculated using the following algorythm: 
+     * calculated using the following algorithm: 
      *
      *  * 1. If MediaPrintableArea + Media attributes are supported, attrs set 
-     *    contains MediaPrintableArea and Media, Media attibute from attrs is 
+     *    contains MediaPrintableArea and Media, Media attribute from attrs is 
      *    supported by selected print service and this is MediaSizeName object 
      *    (i.e. we can get size of this Media) and margins may be correctly 
      *    calculated using these Media and MediaMargins attributes - we get 
@@ -1644,7 +1644,7 @@
     }
     
     /*
-     * retirns dialog's PrintServices list
+     * returns dialog's PrintServices list
      */
     public PrintService [] getServices() {
         return services;

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSClient.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSClient.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSClient.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSClient.java Thu Oct 25 07:44:56 2007
@@ -103,7 +103,7 @@
     }
 
     /* 
-     * SPECIAL - supportedFlavors is global for perfomance 
+     * SPECIAL - supportedFlavors is global for performance 
      * but it can be set local for dynamic
      * 
      * @org.apache.harmony.x.print.PrintClient#getSupportedDocFlavors()
@@ -978,4 +978,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSPrintServiceProvider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSPrintServiceProvider.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSPrintServiceProvider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/cups/CUPSPrintServiceProvider.java Thu Oct 25 07:44:56 2007
@@ -380,7 +380,7 @@
             }
         }
 
-        // retun array of printers
+        // return array of printers
         return (String[]) ippservices.toArray(new String[0]);
     }
 
@@ -550,4 +550,4 @@
         CUPSPrintServiceProvider.verbose = newverbose;
         CUPSClient.setVerbose(newverbose);
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppDefs.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppDefs.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppDefs.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppDefs.java Thu Oct 25 07:44:56 2007
@@ -375,7 +375,7 @@
             PRINTERDESCRIPTIONATTRIBUTES,
             PRINTEROPERATIONATTRIBUTES };
 
-    // TODO need to tune for perfomance
+    // TODO need to tune for performance
     public static byte getAttributeGtag(String aname) {
         for (int ii = ATAGS.length, i = 0; i < ii; i += 1) {
             Object[] atags = (Object[]) ATAGS[i];
@@ -388,7 +388,7 @@
         return -1;
     }
 
-    // TODO need to tune for perfomance
+    // TODO need to tune for performance
     public static byte getAttributeVtag(String aname) {
         for (int ii = ATAGS.length, i = 0; i < ii; i += 1) {
             Object[] atags = (Object[]) ATAGS[i];

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppPrinter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppPrinter.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppPrinter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppPrinter.java Thu Oct 25 07:44:56 2007
@@ -204,7 +204,7 @@
      * The method validate mimetypes.
      * Returned array is the same as parameter,
      * just with null in position of unsupported mimetypes.
-     * This method created for perfomance issue
+     * This method created for performance issue
      */
     public String[] requestGetSupportedMimeTypes(String[] mimetypes)
             throws Exception {
@@ -388,4 +388,4 @@
             return exception;
         }
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java Thu Oct 25 07:44:56 2007
@@ -465,7 +465,7 @@
 }
 
 /*
- * This native function returms Windows printers list
+ * This native function returns Windows printers list
  */
 private native String [] getWindowsPrintServices();
 
@@ -584,4 +584,4 @@
     System.out.println("----------------------------------------");
     System.out.println(s);
 }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java Thu Oct 25 07:44:56 2007
@@ -69,7 +69,7 @@
         try {
             AttributeSetUtilities.
                 verifyAttributeCategory(ColorSupported.class, DocAttribute.class);
-                fail("metod doesn't throw ClassCastException " +
+                fail("method doesn't throw ClassCastException " +
                         "if object is not a Class that implements interfaceName");
         } catch (ClassCastException e) {
             //System.out.println("testVerifyAttributeCategory1 - " + e.toString());
@@ -96,7 +96,7 @@
 
     /*
      * verifyAttributeCategory(Object object, Class interfaceName) method testing. 
-     * Tests that method throws exeption if object is a Class that implements 
+     * Tests that method throws exception if object is a Class that implements 
      * interfaceName but interfaceName is not a class that implements interface
      * Attribute.
      */
@@ -108,7 +108,7 @@
         try {
             AttributeSetUtilities.
                 verifyAttributeCategory(SimpleDoc.class, Doc.class);
-            fail("metod doesn't throw ClassCastException if object " +
+            fail("method doesn't throw ClassCastException if object " +
                     "is a Class that implements interfaceName but " +
                         "interfaceName is not a class that implements " +
                             "interface Attribute");

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java Thu Oct 25 07:44:56 2007
@@ -201,7 +201,7 @@
 
     /*
      * clear() method testing. 
-     * Test that clear() remove all values from this attribite set.
+     * Test that clear() remove all values from this attribute set.
      */
     public final void testClear() {
 
@@ -382,7 +382,7 @@
 
     /*
      * remove(Attribute attribute) method testing. Tests that if given attribute
-     * wasn't in attribute set than remove(Attribute attribut) returns false.
+     * wasn't in attribute set than remove(Attribute attribute) returns false.
      */
     public final void testRemove() {
 

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/org/apache/harmony/rmi/transport/RMIObjectOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/org/apache/harmony/rmi/transport/RMIObjectOutputStream.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/org/apache/harmony/rmi/transport/RMIObjectOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/src/main/java/org/apache/harmony/rmi/transport/RMIObjectOutputStream.java Thu Oct 25 07:44:56 2007
@@ -125,7 +125,7 @@
     }
 
     /**
-     * Annotates specified proxy class with it's codebase URL if avaliable.
+     * Annotates specified proxy class with it's codebase URL if available.
      *
      * @param cl proxy class to be annotated
      */

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java Thu Oct 25 07:44:56 2007
@@ -68,7 +68,8 @@
         assertNull(e.detail);
         try {
             e.initCause(e);
-        } catch (IllegalStateException exception) {
+            fail("No expected IllegalArgumentException");
+        } catch (IllegalArgumentException exception) {
             // expected
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Provider.java Thu Oct 25 07:44:56 2007
@@ -38,6 +38,7 @@
 import java.util.Set;
 
 import org.apache.harmony.luni.util.TwoKeyHashMap;
+import org.apache.harmony.security.Util;
 import org.apache.harmony.security.fortress.Services;
 import org.apache.harmony.security.internal.nls.Messages;
 
@@ -313,13 +314,13 @@
         
         String attributeValue = getPropertyIgnoreCase(servAlg + ' ' + attribute);
         if (attributeValue != null) {
-            if (attribute.equalsIgnoreCase("KeySize")) { //$NON-NLS-1$
+            if (Util.equalsIgnoreCase(attribute,"KeySize")) { //$NON-NLS-1$
                 if (Integer.valueOf(attributeValue).compareTo(
                         Integer.valueOf(val)) >= 0) {
                     return true;
                 }
             } else { // other attributes
-                if (attributeValue.equalsIgnoreCase(val)) {
+                if (Util.equalsIgnoreCase(attributeValue, val)) {
                     return true;
                 }
             }
@@ -375,11 +376,11 @@
         }
 
         if (type.equals(lastServiceName)
-                && algorithm.equalsIgnoreCase(lastAlgorithm)) {
+                && Util.equalsIgnoreCase(algorithm, lastAlgorithm)) {
             return returnedService;
         }
 
-        String alg = algorithm.toUpperCase();
+        String alg = Util.toUpperCase(algorithm);
         Object o = null;
         if (serviceTable != null) {
             o = serviceTable.get(type, alg);
@@ -439,13 +440,13 @@
         if (serviceTable == null) {
             serviceTable = new TwoKeyHashMap<String, String, Service>(128);
         }
-        serviceTable.put(s.type, s.algorithm.toUpperCase(), s);
+        serviceTable.put(s.type, Util.toUpperCase(s.algorithm), s);
         if (s.aliases != null) {
             if (aliasTable == null) {
                 aliasTable = new TwoKeyHashMap<String, String, Service>(256);
             }
             for (Iterator<String> it = s.getAliases(); it.hasNext();) {
-                aliasTable.put(s.type, (it.next()).toUpperCase(), s);
+                aliasTable.put(s.type, Util.toUpperCase(it.next()), s);
             }
         }
         serviceInfoToProperties(s);
@@ -461,11 +462,11 @@
         }
         servicesChanged();
         if (serviceTable != null) {
-            serviceTable.remove(s.type, s.algorithm.toUpperCase());
+            serviceTable.remove(s.type, Util.toUpperCase(s.algorithm));
         }
         if (aliasTable != null && s.aliases != null) {
             for (Iterator<String> it = s.getAliases(); it.hasNext();) {
-                aliasTable.remove(s.type, (it.next()).toUpperCase());
+                aliasTable.remove(s.type, Util.toUpperCase(it.next()));
             }
         }
         serviceInfoFromProperties(s);
@@ -526,14 +527,14 @@
         String algorithm = null;
         String attribute = null;
         int i;
-        if (k.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$
+        if (k.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<standardName> //$NON-NLS-1$
             String aliasName;
             String service_alias = k.substring(10);
             i = service_alias.indexOf("."); //$NON-NLS-1$
             serviceName = service_alias.substring(0, i);
             aliasName = service_alias.substring(i + 1);
             if (propertyAliasTable != null) {
-                propertyAliasTable.remove(serviceName, aliasName.toUpperCase());
+                propertyAliasTable.remove(serviceName, Util.toUpperCase(aliasName));
             }
             if (propertyServiceTable != null) {
                 for (Iterator<Service> it = propertyServiceTable.values().iterator(); it
@@ -557,12 +558,12 @@
             serviceName = k.substring(0, j);
             algorithm = k.substring(j + 1);
             if (propertyServiceTable != null) {
-                Provider.Service ser = propertyServiceTable.remove(serviceName, algorithm.toUpperCase());
+                Provider.Service ser = propertyServiceTable.remove(serviceName, Util.toUpperCase(algorithm));
                 if (ser != null && propertyAliasTable != null
                         && ser.aliases != null) {
                     for (Iterator<String> it = ser.aliases.iterator(); it.hasNext();) {
-                        propertyAliasTable.remove(serviceName, (it
-                                .next()).toUpperCase());
+                        propertyAliasTable.remove(serviceName, Util.toUpperCase(it
+                                .next()));
                     }
                 }
             }
@@ -572,8 +573,7 @@
             serviceName = k.substring(0, j);
             algorithm = k.substring(j + 1, i);
             if (propertyServiceTable != null) {
-                Object o = propertyServiceTable.get(serviceName, algorithm
-                        .toUpperCase());
+                Object o = propertyServiceTable.get(serviceName, Util.toUpperCase(algorithm));
                 if (o != null) {
                     s = (Provider.Service) o;
                     s.attributes.remove(attribute);
@@ -607,14 +607,14 @@
                 continue;
             }
             int i;
-            if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$
+            if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<standardName> //$NON-NLS-1$
                 String aliasName;
                 String service_alias = key.substring(10);
                 i = service_alias.indexOf("."); //$NON-NLS-1$
                 serviceName = service_alias.substring(0, i);
                 aliasName = service_alias.substring(i + 1);
                 algorithm = value;
-                String algUp = algorithm.toUpperCase();
+                String algUp = Util.toUpperCase(algorithm);
                 Object o = null;
                 if (propertyServiceTable == null) {
                     propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128);
@@ -628,7 +628,7 @@
                         propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256);
                     }
                     propertyAliasTable.put(serviceName,
-                            aliasName.toUpperCase(), s);
+                            Util.toUpperCase(aliasName), s);
                 } else {
                     String className = (String) changedProperties
                             .get(serviceName + "." + algorithm); //$NON-NLS-1$
@@ -641,8 +641,8 @@
                         if (propertyAliasTable == null) {
                             propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256);
                         }
-                        propertyAliasTable.put(serviceName, aliasName
-                                .toUpperCase(), s);
+                        propertyAliasTable.put(serviceName, Util.toUpperCase(aliasName
+                                ), s);
                     }
                 }
                 continue;
@@ -655,7 +655,7 @@
             if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className>
                 serviceName = key.substring(0, j);
                 algorithm = key.substring(j + 1);
-                String alg = algorithm.toUpperCase();
+                String alg = Util.toUpperCase(algorithm);
                 Object o = null;
                 if (propertyServiceTable != null) {
                     o = propertyServiceTable.get(serviceName, alg);
@@ -677,7 +677,7 @@
                 serviceName = key.substring(0, j);
                 algorithm = key.substring(j + 1, i);
                 String attribute = key.substring(i + 1);
-                String alg = algorithm.toUpperCase();
+                String alg = Util.toUpperCase(algorithm);
                 Object o = null;
                 if (propertyServiceTable != null) {
                     o = propertyServiceTable.get(serviceName, alg);
@@ -733,7 +733,7 @@
         }
         for (Enumeration<?> e = propertyNames(); e.hasMoreElements();) {
             String pname = (String) e.nextElement();
-            if (key.equalsIgnoreCase(pname)) {
+            if (Util.equalsIgnoreCase(key, pname)) {
                 return getProperty(pname);
             }
         }
@@ -839,38 +839,34 @@
                     throw result;
                 }
             }
-            
-            Class[] parameterTypes = new Class[1];
+            if (constructorParameter == null) {
+                try {
+                    return implementation.newInstance();
+                } catch (Exception e) {
+                    throw new NoSuchAlgorithmException(Messages.getString("security.199", //$NON-NLS-1$
+                            type, algorithm), e);
+                }
+            } else {
+                if (!supportsParameter(constructorParameter)) {
+                    throw new InvalidParameterException(
+                            Messages.getString("security.12", type)); //$NON-NLS-1$
+                }
 
-            if (constructorParameter != null
-                    && !supportsParameter(constructorParameter)) {
-                throw new InvalidParameterException(Messages.getString(
-                        "security.12", type)); //$NON-NLS-1$
-            }
-            Object[] initargs = { constructorParameter };
-
-            try {
-                if (type.equalsIgnoreCase("CertStore")) { //$NON-NLS-1$
-                    parameterTypes[0] = Class
-                            .forName("java.security.cert.CertStoreParameters"); //$NON-NLS-1$
-                } else if (type.equalsIgnoreCase("Configuration")) {
-                    parameterTypes[0] = Class
-                            .forName("javax.security.auth.login.Configuration$Parameters");
-                }
-
-                if (parameterTypes[0] == null) {
-                    if (constructorParameter == null) {
-                        return implementation.newInstance();
+                Class[] parameterTypes = new Class[1];
+                Object[] initargs = { constructorParameter };
+                try {
+                    if (Util.equalsIgnoreCase(type,"CertStore")) { //$NON-NLS-1$
+                        parameterTypes[0] = Class
+                                .forName("java.security.cert.CertStoreParameters"); //$NON-NLS-1$
                     } else {
                         parameterTypes[0] = constructorParameter.getClass();
                     }
+                    return implementation.getConstructor(parameterTypes)
+                            .newInstance(initargs);
+                } catch (Exception e) {
+                    throw new NoSuchAlgorithmException(Messages.getString("security.199", //$NON-NLS-1$
+                            type, algorithm), e);
                 }
-                return implementation.getConstructor(parameterTypes)
-                        .newInstance(initargs);
-            } catch (Exception e) {               
-                throw new NoSuchAlgorithmException(Messages.getString(
-                        "security.199", //$NON-NLS-1$
-                        type, algorithm), e);
             }
         }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Security.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Security.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Security.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/Security.java Thu Oct 25 07:44:56 2007
@@ -36,6 +36,7 @@
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.harmony.security.Util;
 import org.apache.harmony.security.fortress.Engine;
 import org.apache.harmony.security.fortress.PolicyUtils;
 import org.apache.harmony.security.fortress.SecurityAccess;
@@ -74,7 +75,7 @@
                     }
                 }
 
-                if ("true".equalsIgnoreCase(secprops.getProperty("security.allowCustomPropertiesFile", "true"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                if (Util.equalsIgnoreCase("true", secprops.getProperty("security.allowCustomPropertiesFile", "true"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                     String securityFile = System.getProperty("java.security.properties"); //$NON-NLS-1$
                     if (securityFile != null) {
                         if (securityFile.startsWith("=")) { // overwrite //$NON-NLS-1$
@@ -149,7 +150,7 @@
             for (Enumeration e = providers[i].propertyNames(); e
                     .hasMoreElements();) {
                 String pname = (String) e.nextElement();
-                if (prop.equalsIgnoreCase(pname)) {
+                if (Util.equalsIgnoreCase(prop, pname)) {
                     return providers[i].getProperty(pname);
                 }
             }
@@ -394,7 +395,7 @@
         for (int i = 0; i < p.length; i++) {
             for (Iterator it = p[i].getServices().iterator(); it.hasNext();) {
                 Provider.Service s = (Provider.Service) it.next();
-                if (s.getType().equalsIgnoreCase(serviceName)) {
+                if (Util.equalsIgnoreCase(s.getType(),serviceName)) {
                     result.add(s.getAlgorithm());
                 }
             }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java Thu Oct 25 07:44:56 2007
@@ -127,9 +127,9 @@
                 break parsing;
 
             case StreamTokenizer.TT_WORD:
-                if ("keystore".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                if (Util.equalsIgnoreCase("keystore", st.sval)) { //$NON-NLS-1$
                     keystoreEntries.add(readKeystoreEntry(st));
-                } else if ("grant".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                } else if (Util.equalsIgnoreCase("grant", st.sval)) { //$NON-NLS-1$
                     grantEntries.add(readGrantEntry(st));
                 } else {
                     handleUnexpectedToken(st, Messages.getString("security.89")); //$NON-NLS-1$
@@ -208,19 +208,19 @@
             switch (st.nextToken()) {
 
             case StreamTokenizer.TT_WORD:
-                if ("signedby".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                if (Util.equalsIgnoreCase("signedby", st.sval)) { //$NON-NLS-1$
                     if (st.nextToken() == '"') {
                         ge.signers = st.sval;
                     } else {
                         handleUnexpectedToken(st, Messages.getString("security.8B")); //$NON-NLS-1$
                     }
-                } else if ("codebase".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                } else if (Util.equalsIgnoreCase("codebase", st.sval)) { //$NON-NLS-1$
                     if (st.nextToken() == '"') {
                         ge.codebase = st.sval;
                     } else {
                         handleUnexpectedToken(st, Messages.getString("security.8C")); //$NON-NLS-1$
                     }
-                } else if ("principal".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                } else if (Util.equalsIgnoreCase("principal", st.sval)) { //$NON-NLS-1$
                     ge.addPrincipal(readPrincipalEntry(st));
                 } else {
                     handleUnexpectedToken(st);
@@ -308,7 +308,7 @@
             switch (st.nextToken()) {
 
             case StreamTokenizer.TT_WORD:
-                if ("permission".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                if (Util.equalsIgnoreCase("permission", st.sval)) { //$NON-NLS-1$
                     PermissionEntry pe = new PermissionEntry();
                     if (st.nextToken() == StreamTokenizer.TT_WORD) {
                         pe.klass = st.sval;
@@ -326,7 +326,7 @@
                             }
                         }
                         if (st.ttype == StreamTokenizer.TT_WORD
-                                && "signedby".equalsIgnoreCase(st.sval)) { //$NON-NLS-1$
+                                && Util.equalsIgnoreCase("signedby", st.sval)) { //$NON-NLS-1$
                             if (st.nextToken() == '"') {
                                 pe.signers = st.sval;
                             } else {

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/PolicyEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/PolicyEntry.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/PolicyEntry.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/PolicyEntry.java Thu Oct 25 07:44:56 2007
@@ -22,6 +22,8 @@
 
 package org.apache.harmony.security;
 
+import java.net.URL;
+import java.security.CodeSigner;
 import java.security.CodeSource;
 import java.security.Permission;
 import java.security.Principal;
@@ -30,7 +32,6 @@
 
 import org.apache.harmony.security.fortress.PolicyUtils;
 
-
 /**
  * This class represents an elementary block of a security policy. It associates
  * a CodeSource of an executable code, Principals allowed to execute the code,
@@ -55,7 +56,7 @@
      */
     public PolicyEntry(CodeSource cs, Collection<? extends Principal> prs,
             Collection<? extends Permission> permissions) {
-        this.cs = cs;
+        this.cs = (cs != null) ? normalizeCodeSource(cs) : null;
         this.principals = (prs == null || prs.isEmpty()) ? null
                 : (Principal[]) prs.toArray(new Principal[prs.size()]);
         this.permissions = (permissions == null || permissions.isEmpty()) ? null
@@ -68,7 +69,31 @@
      * imply() method.
      */
     public boolean impliesCodeSource(CodeSource codeSource) {
-        return (cs == null) ? true : cs.implies(codeSource);
+        if (cs == null) {
+            return true;
+        }
+
+        if (codeSource == null) {
+            return false;
+        }
+        return cs.implies(normalizeCodeSource(codeSource));
+    }
+
+    private CodeSource normalizeCodeSource(CodeSource codeSource) {
+        URL codeSourceURL = PolicyUtils.normalizeURL(codeSource.getLocation());
+        CodeSource result = codeSource;
+
+        if (codeSourceURL != codeSource.getLocation()) {
+            // URL was normalized - recreate codeSource with new URL
+            CodeSigner[] signers = codeSource.getCodeSigners();
+            if (signers == null) {
+                result = new CodeSource(codeSourceURL, codeSource
+                        .getCertificates());
+            } else {
+                result = new CodeSource(codeSourceURL, signers);
+            }
+        }
+        return result;
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java Thu Oct 25 07:44:56 2007
@@ -25,7 +25,6 @@
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.File;
 import java.io.Reader;
 import java.net.URL;
 import java.security.cert.Certificate;
@@ -194,23 +193,6 @@
         if (ge.codebase != null) {
             codebase = new URL(resolve ? PolicyUtils.expandURL(ge.codebase,
                     system) : ge.codebase);
-            //Fix HARMONY-1963
-            if ("file".equals(codebase.getProtocol())) { //$NON-NLS-1$
-            	File codeFile = new File(codebase.getFile());
-            	if (codeFile.isAbsolute()) {
-                    String absolutePath = codeFile.getAbsolutePath();
-                    //Fix HARMONY-4184
-                    //Unix style file path.
-                    if (absolutePath.startsWith("/")) {
-                        codebase = new URL("file://" + //$NON-NLS-1$
-                                codeFile.getAbsolutePath());
-                    } else {
-                        //Windows style file path.                        
-                        codebase = new URL("file:/" + //$NON-NLS-1$
-                                codeFile.getAbsolutePath());
-                    }           		
-            	}
-            }
         }
         if (ge.signers != null) {
             if (resolve) {

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Engine.java Thu Oct 25 07:44:56 2007
@@ -25,6 +25,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 
+import org.apache.harmony.security.Util;
 import org.apache.harmony.security.internal.nls.Messages;
 
 
@@ -89,7 +90,7 @@
         }
         Services.refresh();
         if (returnedService != null
-                && algorithm.equalsIgnoreCase(lastAlgorithm)
+                && Util.equalsIgnoreCase(algorithm, lastAlgorithm)
                 && refreshNumber == Services.refreshNumber) {
             serv = returnedService;
         } else {
@@ -99,7 +100,7 @@
             }
             serv = Services.getService(new StringBuffer(128)
                     .append(serviceName).append(".").append( //$NON-NLS-1$
-                            algorithm.toUpperCase()).toString());
+                            Util.toUpperCase(algorithm)).toString());
             if (serv == null) {
                 throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
                         serviceName, algorithm));

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/PolicyUtils.java Thu Oct 25 07:44:56 2007
@@ -25,6 +25,8 @@
 import java.io.File;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.Permission;
@@ -39,6 +41,7 @@
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.harmony.security.Util;
 import org.apache.harmony.security.internal.nls.Messages;
 
 /**
@@ -282,6 +285,56 @@
             throws ExpansionFailedException {
         return expand(str, properties).replace(File.separatorChar, '/');
     }
+    
+    /**
+     * Normalizes URLs to standard ones, eliminating pathname symbols.
+     * 
+     * @param codebase -
+     *            the original URL.
+     * @return - the normalized URL.
+     */
+    public static URL normalizeURL(URL codebase) {
+        if (codebase != null && "file".equals(codebase.getProtocol())) { //$NON-NLS-1$
+            try {
+                if (codebase.getHost().length() == 0) {
+                    String path = codebase.getFile();
+
+                    if (path.length() == 0) {
+                        // codebase is "file:"
+                        path = "*";
+                    }
+                    return filePathToURI(new File(path)
+                            .getAbsolutePath()).normalize().toURL();
+                } else {
+                    // codebase is "file://<smth>"
+                    return codebase.toURI().normalize().toURL();
+                }
+            } catch (Exception e) {
+                // Ignore
+            }
+        }
+        return codebase;
+    }
+
+    /**
+     * Converts a file path to URI without accessing file system
+     * (like {File#toURI()} does).
+     * 
+     * @param path -
+     *            file path.
+     * @return - the resulting URI.
+     * @throw URISyntaxException
+     */
+    public static URI filePathToURI(String path) throws URISyntaxException {
+        path = path.replace(File.separatorChar, '/');
+
+        if (!path.startsWith("/")) { //$NON-NLS-1$
+            return new URI("file", null, //$NON-NLS-1$
+                    new StringBuilder(path.length() + 1).append('/')
+                            .append(path).toString(), null, null);
+        }
+        return new URI("file", null, path, null, null); //$NON-NLS-1$
+    }
 
     /**
      * Instances of this interface are intended for resolving  
@@ -371,7 +424,7 @@
      * @see #expand(String, Properties)  
      */
     public static boolean canExpandProperties() {
-        return !FALSE.equalsIgnoreCase(AccessController
+        return !Util.equalsIgnoreCase(FALSE,AccessController
                 .doPrivileged(new SecurityPropertyAccessor(POLICY_EXPAND)));
     }
 
@@ -417,7 +470,7 @@
         URL dynamicURL = null;
 
         //first check if policy is set via system properties
-        if (!FALSE.equalsIgnoreCase(AccessController
+        if (!Util.equalsIgnoreCase(FALSE, AccessController
                 .doPrivileged(security.key(POLICY_ALLOW_DYNAMIC)))) {
             String location = system.getProperty(systemUrlKey);
             if (location != null) {
@@ -585,4 +638,4 @@
         }
         return true;
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java Thu Oct 25 07:44:56 2007
@@ -33,6 +33,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.harmony.security.Util;
+
 
 /**
  * This class contains information about all registered providers and preferred
@@ -171,14 +173,14 @@
             type = serv.getType();
             sb.delete(0, sb.length());
             key = sb.append(type).append(".").append( //$NON-NLS-1$
-                    serv.getAlgorithm().toUpperCase()).toString();
+                    Util.toUpperCase(serv.getAlgorithm())).toString();
             if (!services.containsKey(key)) {
                 services.put(key, serv);
             }
             for (Iterator<String> it2 = Engine.door.getAliases(serv); it2.hasNext();) {
                 alias = it2.next();
                 sb.delete(0, sb.length());
-                key = sb.append(type).append(".").append(alias.toUpperCase()) //$NON-NLS-1$
+                key = sb.append(type).append(".").append(Util.toUpperCase(alias)) //$NON-NLS-1$
                         .toString();
                 if (!services.containsKey(key)) {
                     services.put(key, serv);

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java Thu Oct 25 07:44:56 2007
@@ -201,7 +201,7 @@
      * from the TBSCertList structure and converts them to the
      * X509CRLEntryImpl objects
      */
-    private void retirieveEntries() {
+    private void retrieveEntries() {
         entriesRetrieved = true;
         List rcerts = tbsCertList.getRevokedCertificates();
         if (rcerts == null) {
@@ -243,7 +243,7 @@
             throw new NullPointerException();
         }
         if (!entriesRetrieved) {
-            retirieveEntries();
+            retrieveEntries();
         }
         if (entries == null) {
             return null;
@@ -295,7 +295,7 @@
      */
     public X509CRLEntry getRevokedCertificate(BigInteger serialNumber) {
         if (!entriesRetrieved) {
-            retirieveEntries();
+            retrieveEntries();
         }
         if (entries == null) {
             return null;
@@ -315,7 +315,7 @@
      */
     public Set<? extends X509CRLEntry> getRevokedCertificates() {
         if (!entriesRetrieved) {
-            retirieveEntries();
+            retrieveEntries();
         }
         if (entries == null) {
             return null;

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/AlgNameMapper.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/AlgNameMapper.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/AlgNameMapper.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/utils/AlgNameMapper.java Thu Oct 25 07:44:56 2007
@@ -29,6 +29,7 @@
 import java.util.Set;
 import java.util.Map.Entry;
 
+import org.apache.harmony.security.Util;
 import org.apache.harmony.security.asn1.ObjectIdentifier;
 
 /**
@@ -80,7 +81,7 @@
 
     static {
         for (String[] element : knownAlgMappings) {
-            String algUC = element[1].toUpperCase();
+            String algUC = Util.toUpperCase(element[1]);
             alg2OidMap.put(algUC, element[0]);
             oid2AlgMap.put(element[0], algUC);
             // map upper case alg name to its original name
@@ -110,7 +111,7 @@
      */
     public static String map2OID(String algName) {
         // alg2OidMap map contains upper case keys
-        return alg2OidMap.get(algName.toUpperCase());
+        return alg2OidMap.get(Util.toUpperCase(algName));
     }
 
     /**
@@ -133,7 +134,7 @@
      * @return algorithm name
      */
     public static String getStandardName(String algName) {
-        return algAliasesMap.get(algName.toUpperCase());
+        return algAliasesMap.get(Util.toUpperCase(algName));
     }
 
     // Searches given provider for mappings like
@@ -150,7 +151,7 @@
                 if (key.startsWith(keyPrfix2find)) {
                     String alias = key.substring(keyPrfix2find.length());
                     String alg = (String)me.getValue();
-                    String algUC = alg.toUpperCase();
+                    String algUC = Util.toUpperCase(alg);
                     if (isOID(alias)) {
                         if (alias.startsWith("OID.")) { //$NON-NLS-1$
                             alias = alias.substring(4);
@@ -169,8 +170,8 @@
                             algAliasesMap.put(algUC, alg);
                         }
                            // Do not override known standard names
-                    } else if (!algAliasesMap.containsKey(alias.toUpperCase())) {
-                        algAliasesMap.put(alias.toUpperCase(), alg);
+                    } else if (!algAliasesMap.containsKey(Util.toUpperCase(alias))) {
+                        algAliasesMap.put(Util.toUpperCase(alias), alg);
                     }
                 }
             }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java.injected/java/security/ProviderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java.injected/java/security/ProviderTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java.injected/java/security/ProviderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java.injected/java/security/ProviderTest.java Thu Oct 25 07:44:56 2007
@@ -64,7 +64,7 @@
         if (!"value 1".equals(p.getProperty("Property 1").trim()) ||
                 !"className".equals(p.getProperty("serviceName.algName").trim()) ||    
                 !"attrValue".equals(p.getProperty("serviceName.algName attrName").trim()) ||
-                !"stanbdardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
+                !"standardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
                 !String.valueOf(p.getName()).equals(p.getProperty("Provider.id name").trim()) ||
                 !String.valueOf(p.getVersion()).equals(p.getProperty("Provider.id version").trim()) ||
                 !String.valueOf(p.getInfo()).equals(p.getProperty("Provider.id info").trim()) ||

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java Thu Oct 25 07:44:56 2007
@@ -38,34 +38,34 @@
      */
     public void test_engineDigestLB$LILI() throws Exception {
 
-        final int DIGEST_LENGHT = 2;
+        final int DIGEST_LENGTH = 2;
 
         MyMessageDigest md = new MyMessageDigest() {
 
             public int engineGetDigestLength() {
-                return DIGEST_LENGHT;
+                return DIGEST_LENGTH;
             }
 
             public byte[] engineDigest() {
-                return new byte[DIGEST_LENGHT]; // return non-null value
+                return new byte[DIGEST_LENGTH]; // return non-null value
             }
         };
 
         byte[] b = new byte[5];
         try {
             // test: null output buffer
-            md.engineDigest(null, 1, DIGEST_LENGHT);
+            md.engineDigest(null, 1, DIGEST_LENGTH);
             fail("No expected NullPointerException");
         } catch (NullPointerException e) {
         }
         try {
             //test: len param < digest length
-            md.engineDigest(b, 1, DIGEST_LENGHT - 1);
+            md.engineDigest(b, 1, DIGEST_LENGTH - 1);
             fail("No expected DigestException");
         } catch (DigestException e) {
         }
 
-        assertEquals("incorrect result", DIGEST_LENGHT, md
+        assertEquals("incorrect result", DIGEST_LENGTH, md
                 .engineDigest(b, 1, 3));
         
         // Regression for HARMONY-3045

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java Thu Oct 25 07:44:56 2007
@@ -197,7 +197,7 @@
         // Regression for HARMONY-1963 and HARMONY-2910
         String policyFile = Support_Resources
                 .getAbsoluteResourcePath("PolicyTest.txt");
-        String oldSysProp = System.getProperty(JAVA_SECURITY_POLICY);
+        String oldJavaPolicy = System.getProperty(JAVA_SECURITY_POLICY);
         Policy oldPolicy = Policy.getPolicy();
 
         try {
@@ -206,14 +206,20 @@
             // test: absolute paths
             assertCodeBasePropertyExpansion("/11111/*", "/11111/-");
             assertCodeBasePropertyExpansion("/22222/../22222/*", "/22222/-");
-            //FIXME assertCodeBasePropertyExpansion("/33333/*", "/33333/../33333/-");
+            assertCodeBasePropertyExpansion("/33333/*", "/33333/../33333/-");
+            assertCodeBasePropertyExpansion("/44444/../44444/-", "/44444/*");
+            assertCodeBasePropertyExpansion("/55555/../55555/-", "/55555/../55555/-");
+            assertCodeBasePropertyExpansion("/666 66 66/-", "/666 66 66/-");
 
             // test: relative paths
-            assertCodeBasePropertyExpansion("44444/*", "44444/-");
-            assertCodeBasePropertyExpansion("55555/../55555/*", "55555/-");
-            //FIXME assertCodeBasePropertyExpansion("66666/*", "66666/../66666/-");
+            assertCodeBasePropertyExpansion("11111/*", "11111/-");
+            assertCodeBasePropertyExpansion("22222/../22222/*", "22222/-");
+            assertCodeBasePropertyExpansion("33333/*", "33333/../33333/-");
+            assertCodeBasePropertyExpansion("44444/../44444/-", "44444/*");
+            assertCodeBasePropertyExpansion("55555/../55555/-", "55555/../55555/-");
+            assertCodeBasePropertyExpansion("666 66 66/-", "666 66 66/-");
         } finally {
-            TestUtils.setSystemProperty(JAVA_SECURITY_POLICY, oldSysProp);
+            TestUtils.setSystemProperty(JAVA_SECURITY_POLICY, oldJavaPolicy);
             Policy.setPolicy(oldPolicy);
         }
     }
@@ -236,7 +242,7 @@
         CodeSource codeSource = new CodeSource(
                 new URL("file:" + codeSourceURL),
                 (java.security.cert.Certificate[]) null);
-        
+
         PermissionCollection pCollection = p.getPermissions(codeSource);
         Enumeration<Permission> elements = pCollection.elements();
 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java Thu Oct 25 07:44:56 2007
@@ -112,11 +112,11 @@
         hm.put("MessageDigest.SHA-1", "aaa.bbb.ccc.ddd");
         hm.put("Property 1", "value 1");
         hm.put("serviceName.algName attrName", "attrValue");
-        hm.put("Alg.Alias.engineClassName.aliasName", "stanbdardName");
+        hm.put("Alg.Alias.engineClassName.aliasName", "standardName");
         p.putAll(hm);
         if (!"value 1".equals(p.getProperty("Property 1").trim()) ||
                 !"attrValue".equals(p.getProperty("serviceName.algName attrName").trim()) ||
-                !"stanbdardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
+                !"standardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
                 !"aaa.bbb.ccc.ddd".equals(p.getProperty("MessageDigest.SHA-1").trim()) ) {
             fail("Incorrect property value");
         }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Signature2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Signature2Test.java?rev=588245&r1=588244&r2=588245&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Signature2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Signature2Test.java Thu Oct 25 07:44:56 2007
@@ -25,6 +25,7 @@
 import java.security.Security;
 import java.security.Signature;
 import java.security.spec.DSAParameterSpec;
+import java.util.Locale;
 
 public class Signature2Test extends junit.framework.TestCase {
 
@@ -226,4 +227,23 @@
 		sig.update(MESSAGE.getBytes());
 		assertTrue("Sign/Verify does not pass", sig.verify(signature));
 	}
+    
+    //Regression Test for HARMONY-4916
+    public void test_getInstance_withI18n() throws Exception {
+        // Enfore that providers information has been loaded.
+        Signature.getInstance("DSA");
+        Locale defaultLocale = Locale.getDefault();
+        try {
+            /**
+             * In locale("tr"), char 'i' will be transferred to an upper case
+             * other char than 'I'. Thus in security architecture, all
+             * manipulation to the string representing an algorithm name or
+             * standard property shall be treated as locale neutral
+             */
+            Locale.setDefault(new Locale("tr"));
+            Signature.getInstance("MD5withRSA");
+        } finally {
+            Locale.setDefault(defaultLocale);
+        }
+    }
 }



Mime
View raw message