harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r727683 [7/11] - in /harmony/enhanced/classlib/branches/java6: ./ doc/ make/ modules/accessibility/src/main/java/javax/accessibility/ modules/archive/src/main/java/java/util/jar/ modules/archive/src/main/java/java/util/zip/ modules/archive/...
Date Thu, 18 Dec 2008 09:46:26 GMT
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=727683&r1=727682&r2=727683&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 Dec 18 01:46:12 2008
@@ -748,143 +748,129 @@
 /* IPv6 - we may have more than one open socket at this point, an IPv6 and an IPv4.  Now
  * that we are connect to a specific address we can determine whether to use the IPv4
  * or IPv6 address and close the other address.
- *
  */
 I_32 VMCALL
-hysock_connect (struct HyPortLibrary * portLibrary, hysocket_t sock,
-		hysockaddr_t addr)
+hysock_connect (struct HyPortLibrary * portLibrary, hysocket_t sock, hysockaddr_t addr)
 {
   I_32 rc = 0;
   DWORD socketType;
-  int socketTypeLen = sizeof (DWORD);
+  int socketTypeLen = sizeof(DWORD);
   byte nAddrBytes[HYSOCK_INADDR6_LEN];
 
-  /* get the socket type, it should be the same for both sockets and one of the two should be open */
-  if (sock->flags & SOCKET_IPV4_OPEN_MASK)
-    {
-      if (getsockopt
-	  (sock->ipv4, SOL_SOCKET, SO_TYPE, (char *) &socketType,
-	   &socketTypeLen) == SOCKET_ERROR)
-	{
-	  rc = WSAGetLastError ();
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
-    }
-  else
-    {
-      if (getsockopt
-	  (sock->ipv6, SOL_SOCKET, SO_TYPE, (char *) &socketType,
-	   &socketTypeLen) == SOCKET_ERROR)
-	{
-	  rc = WSAGetLastError ();
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
-    }
-
-  /* here we need to do the connect based on the type of addressed passed in as well as the sockets which are open. If 
-     a socket with a type that matches the type of the address passed in is open then we use that one.  Otherwise we
-     use the socket that is open */
+  /* Get the socket type.  It should be the same for both sockets
+   * and one of the two should be open.
+   */
+  if (sock->flags & SOCKET_IPV4_OPEN_MASK) {
+    if (getsockopt(sock->ipv4, SOL_SOCKET, SO_TYPE,
+          (char *) &socketType, &socketTypeLen) == SOCKET_ERROR) {
+      rc = WSAGetLastError();
+      return portLibrary->error_set_last_error(portLibrary, rc, findError(rc));
+    }
+  } else {
+    if (getsockopt(sock->ipv6, SOL_SOCKET, SO_TYPE,
+        (char *) &socketType, &socketTypeLen) == SOCKET_ERROR) {
+      rc = WSAGetLastError();
+      return portLibrary->error_set_last_error(portLibrary, rc, findError(rc));
+    }
+  }
+
+  /* Here we need to do the connect based on the type of address
+   * passed in as well as the sockets which are open.
+   * If a socket with a type that matches the type of the address
+   * passed in is open then we use that one.  Otherwise we use the
+   * socket that is open.
+   */
   if (((((OSSOCKADDR *) & addr->addr)->sin_family != OS_AF_UNSPEC) &&
-       ((((OSSOCKADDR *) & addr->addr)->sin_family == OS_AF_INET4) ||
-	!(sock->flags & SOCKET_IPV6_OPEN_MASK)) &&
-       (sock->flags & SOCKET_IPV4_OPEN_MASK)))
-    {
-      rc =
-	connect (sock->ipv4, (const struct sockaddr FAR *) &addr->addr,
-		 sizeof (addr->addr));
-      if (socketType != SOCK_DGRAM)
-	{
-	  internalCloseSocket (portLibrary, sock, FALSE);
-	}
-      else
-	{
-	  /* we don't acutally want to close the sockets as connect can be called again on a datagram socket  but we 
-	     still need to set the flag that tells us which socket to use */
-	  sock->flags = sock->flags | SOCKET_USE_IPV4_MASK;
-	}
-    }
-  else if (((OSSOCKADDR *) & addr->addr)->sin_family == OS_AF_INET6)
-    {
-      rc =
-	connect (sock->ipv6, (const struct sockaddr FAR *) &addr->addr,
-		 sizeof (addr->addr));
-      if (socketType != SOCK_DGRAM)
-	{
-	  internalCloseSocket (portLibrary, sock, TRUE);
-	}
-      else
-	{
-	  /* we don't acutally want to close the sockets as connect can be called again on a datagram socket  but we 
-	     still need to set the flag that tells us which socket to use. */
-	  sock->flags = sock->flags & ~SOCKET_USE_IPV4_MASK;
-	}
-    }
-  else
-    {
-      if (socketType != SOCK_DGRAM)
-	{
-	  /* this should never occur */
-	  return HYPORT_ERROR_SOCKET_BADAF;
-	}
-
-      /* for windows it seems to want to have it connect with an IN_ADDR any instead of with an 
-         UNSPEC familty type so lets be accomodating */
-
-      /* we need to disconnect on both sockets and swallow any expected errors */
-      memset (nAddrBytes, 0, HYSOCK_INADDR6_LEN);
-      if (sock->flags & SOCKET_IPV4_OPEN_MASK)
-	{
-	  hysock_sockaddr_init6 (portLibrary, addr, (U_8 *) nAddrBytes,
-				 HYSOCK_INADDR_LEN, HYADDR_FAMILY_AFINET4, 0,
-				 0, 0, sock);
-	  rc =
-	    connect (sock->ipv4, (const struct sockaddr FAR *) &addr->addr,
-		     sizeof (addr->addr));
-	}
-
-      /* filter out acceptable errors */
-      if (rc == SOCKET_ERROR)
-	{
-	  rc = WSAGetLastError ();
-	  if (rc == WSAEAFNOSUPPORT || rc == WSAEADDRNOTAVAIL)
-	    {
-	      rc = 0;
-	    }
-	}
-
-      if (rc == 0 && sock->flags & SOCKET_IPV6_OPEN_MASK)
-	{
-	  hysock_sockaddr_init6 (portLibrary, addr, (U_8 *) nAddrBytes,
-				 HYSOCK_INADDR_LEN, HYADDR_FAMILY_AFINET6, 0,
-				 0, 0, sock);
-	  connect (sock->ipv6, (const struct sockaddr FAR *) &addr->addr,
-		   sizeof (addr->addr));
-	}
-    }
-
-  if (rc == SOCKET_ERROR)
-    {
-      rc = WSAGetLastError ();
-      HYSOCKDEBUG ("<connect failed, err=%d>\n", rc);
-      switch (rc)
-	{
-	case WSAEINVAL:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    HYPORT_ERROR_SOCKET_ALREADYBOUND);
-	case WSAEAFNOSUPPORT:
-	  /* if it is a SOCK_DGRAM this is ok as posix says this may be returned when disconnecting */
-	  if (socketType == SOCK_DGRAM)
-	    {
-	      return 0;
-	    }
-	  /* no break here as default is what we want if we do not return above */
-	default:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
+      ((((OSSOCKADDR *) & addr->addr)->sin_family == OS_AF_INET4) ||
+      !(sock->flags & SOCKET_IPV6_OPEN_MASK)) &&
+       (sock->flags & SOCKET_IPV4_OPEN_MASK))) {
+
+    rc = connect(sock->ipv4, (const struct sockaddr FAR *) &addr->addr,
+                 sizeof (addr->addr));
+
+    if (socketType != SOCK_DGRAM) {
+      internalCloseSocket(portLibrary, sock, FALSE);
+    } else {
+      /* We don't acutally want to close the sockets as connect can
+       * be called again on a datagram socket  but we still need to
+       * set the flag that tells us which socket to use.
+       */
+      sock->flags = sock->flags | SOCKET_USE_IPV4_MASK;
+    }
+  } else if (((OSSOCKADDR *) & addr->addr)->sin_family == OS_AF_INET6) {
+    rc = connect(sock->ipv6, (const struct sockaddr FAR *) &addr->addr,
+                 sizeof (addr->addr));
+    if (socketType != SOCK_DGRAM) {
+      internalCloseSocket(portLibrary, sock, TRUE);
+    } else {
+      /* We don't acutally want to close the sockets as connect can
+       * be called again on a datagram socket  but we still need to
+       * set the flag that tells us which socket to use.
+       */
+      sock->flags = sock->flags & ~SOCKET_USE_IPV4_MASK;
+    }
+  } else {
+    if (socketType != SOCK_DGRAM) {
+      /* This should never occur. */
+      return HYPORT_ERROR_SOCKET_BADAF;
+    }
+
+    /* For windows it seems to want to have it connect with an
+     * IN_ADDR any instead of with an UNSPEC family type, so
+     * lets be accommodating.
+     */
+
+    /* We need to connect on both sockets and swallow any
+     * expected errors.
+     */
+    memset(nAddrBytes, 0, HYSOCK_INADDR6_LEN);
+    if (sock->flags & SOCKET_IPV4_OPEN_MASK) {
+      hysock_sockaddr_init6(portLibrary, addr, (U_8 *) nAddrBytes,
+                            HYSOCK_INADDR_LEN, HYADDR_FAMILY_AFINET4,
+                            0, 0, 0, sock);
+      rc = connect(sock->ipv4, (const struct sockaddr FAR *) &addr->addr,
+                   sizeof (addr->addr));
+    }
+
+    /* Filter out acceptable errors */
+    if (rc == SOCKET_ERROR) {
+      rc = WSAGetLastError();
+      if (rc == WSAEAFNOSUPPORT || rc == WSAEADDRNOTAVAIL) {
+        rc = 0;
+      }
+    }
+
+    if (rc == 0 && sock->flags & SOCKET_IPV6_OPEN_MASK) {
+      hysock_sockaddr_init6(portLibrary, addr, (U_8 *) nAddrBytes,
+                            HYSOCK_INADDR_LEN, HYADDR_FAMILY_AFINET6,
+                              0, 0, 0, sock);
+      connect(sock->ipv6, (const struct sockaddr FAR *) &addr->addr,
+              sizeof (addr->addr));
+    }
+  }
+
+  if (rc == SOCKET_ERROR) {
+    rc = WSAGetLastError();
+    HYSOCKDEBUG ("<connect failed, err=%d>\n", rc);
+    switch (rc) {
+      case WSAEINVAL :
+        return portLibrary->error_set_last_error(
+          portLibrary, rc, HYPORT_ERROR_SOCKET_ALREADYBOUND);
+      case WSAEAFNOSUPPORT :
+        /* If it is a SOCK_DGRAM this is ok as posix says
+         * this may be returned when disconnecting.
+         */
+        if (socketType == SOCK_DGRAM) {
+          return 0;
+        }
+        /* No break here as default is what we want if we
+         * do not return above.
+         */
+     default :
+       return portLibrary->error_set_last_error(
+         portLibrary, rc, findError(rc));
     }
+  }
   return rc;
 }
 
@@ -2457,41 +2443,35 @@
   I_32 bytesRec = 0;
   int socketTypeLen = sizeof (DWORD);
 
-  if (sock->flags & SOCKET_USE_IPV4_MASK
-      || !(sock->flags & SOCKET_IPV6_OPEN_MASK))
-    {
+  if (sock->flags & SOCKET_USE_IPV4_MASK ||
+     !(sock->flags & SOCKET_IPV6_OPEN_MASK)) {
+
       bytesRec = recv (sock->ipv4, (char *) buf, nbyte, flags);
-    }
-  else
-    {				/* If IPv6 is open */
+  } else {
+      /* If IPv6 is open */
       bytesRec = recv (sock->ipv6, (char *) buf, nbyte, flags);
-    }
+  }
+
+  if (SOCKET_ERROR == bytesRec) {
+    rc = WSAGetLastError();
+    HYSOCKDEBUG ("<recv failed, err=%d>\n", rc);
+    switch (rc) {
+      case WSAEINVAL :
+        return portLibrary->error_set_last_error (
+            portLibrary, rc, HYPORT_ERROR_SOCKET_NOTBOUND);
+      case WSAEMSGSIZE :
+        rc = portLibrary->error_set_last_error (portLibrary, rc, WSAEMSGSIZE);
+        if (flags == MSG_PEEK) {
+            return nbyte;
+        }
+      default :
+        return portLibrary->error_set_last_error (
+            portLibrary, rc, findError (rc));
+      }
+  } else {
+    rc = bytesRec;
+  }
 
-  if (SOCKET_ERROR == bytesRec)
-    {
-      rc = WSAGetLastError ();
-      HYSOCKDEBUG ("<recv failed, err=%d>\n", rc);
-      switch (rc)
-	{
-	case WSAEINVAL:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    HYPORT_ERROR_SOCKET_NOTBOUND);
-	case WSAEMSGSIZE:
-	  rc =
-	    portLibrary->error_set_last_error (portLibrary, rc, WSAEMSGSIZE);
-	  if (flags == MSG_PEEK)
-	    {
-	      return nbyte;
-	    }
-	default:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
-    }
-  else
-    {
-      rc = bytesRec;
-    }
   return rc;
 }
 
@@ -2613,43 +2593,30 @@
   I_32 rc = 0;
   I_32 result = 0;
 
-  if (NULL == timeout)
-    {
-      result =
-	select (nfds, &readfds->handle, &writefds->handle, &exceptfds->handle,
-		NULL);
-    }
-  else
-    {
-      result =
-	select (nfds, &readfds->handle, &writefds->handle, &exceptfds->handle,
-		&timeout->time);
-    }
-  if (SOCKET_ERROR == result)
-    {
-      rc = WSAGetLastError ();
-      HYSOCKDEBUG ("<select failed, err=%d>\n", rc);
-      switch (rc)
-	{
-	case WSAEINVAL:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    HYPORT_ERROR_SOCKET_INVALIDTIMEOUT);
-	default:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
-    }
-  else
-    {
-      if (0 == result)
-	{
-	  rc = HYPORT_ERROR_SOCKET_TIMEOUT;
-	}
-      else
-	{
-	  rc = result;
-	}
+  if (NULL == timeout) {
+    result =
+	  select(nfds, &readfds->handle, &writefds->handle, &exceptfds->handle, NULL);
+  } else {
+    result =
+	  select(nfds, &readfds->handle, &writefds->handle, &exceptfds->handle, &timeout->time);
+  }
+  if (SOCKET_ERROR == result) {
+    rc = WSAGetLastError ();
+    HYSOCKDEBUG ("<select failed, err=%d>\n", rc);
+    switch (rc) {
+      case WSAEINVAL :
+        return portLibrary->error_set_last_error(
+          portLibrary, rc, HYPORT_ERROR_SOCKET_INVALIDTIMEOUT);
+      default :
+        return portLibrary->error_set_last_error (portLibrary, rc, findError (rc));
+	}
+  } else {
+    if (0 == result) {
+      rc = HYPORT_ERROR_SOCKET_TIMEOUT;
+    } else {
+      rc = result;
     }
+  }
   return rc;
 }
 
@@ -2781,39 +2748,36 @@
   I_32 rc = 0;
   U_32 param = nonblocking;
 
-  /* If both the IPv4 and IPv6 socket are open then we want to set the option on both.  If only one is open,
-     then we set it just on that one.  */
-
-  if (socketP->flags & SOCKET_IPV4_OPEN_MASK)
-    {
-      rc = ioctlsocket (socketP->ipv4, FIONBIO, &param);
-    }
-
-  if (rc == 0 && socketP->flags & SOCKET_IPV6_OPEN_MASK)
-    {
-      rc = ioctlsocket (socketP->ipv6, FIONBIO, &param);
-    }
-
-  if (rc != 0)
-    {
-      rc = WSAGetLastError ();
-      HYSOCKDEBUG ("<set_nonblocking (for bool) failed, err=%d>\n", rc);
-      switch (rc)
-	{
-	case WSAEINVAL:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    HYPORT_ERROR_SOCKET_OPTARGSINVALID);
-	default:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
-						    findError (rc));
-	}
+  /* If both the IPv4 and IPv6 socket are open then we want to set the option on both.
+   * If only one is open, then we set it just on that one.
+   */
+  if (socketP->flags & SOCKET_IPV4_OPEN_MASK) {
+    rc = ioctlsocket (socketP->ipv4, FIONBIO, &param);
+  }
+
+  if (rc == 0 && socketP->flags & SOCKET_IPV6_OPEN_MASK) {
+    rc = ioctlsocket (socketP->ipv6, FIONBIO, &param);
+  }
+
+  if (rc != 0) {
+    rc = WSAGetLastError ();
+    HYSOCKDEBUG ("<set_nonblocking (for bool) failed, err=%d>\n", rc);
+    switch (rc) {
+      case WSAEINVAL :
+	      return portLibrary->error_set_last_error (portLibrary, rc,
+          HYPORT_ERROR_SOCKET_OPTARGSINVALID);
+        default :
+	        return portLibrary->error_set_last_error (portLibrary, rc,
+            findError (rc));
     }
+  }
 
   return rc;
 }
 
 #undef CDEV_CURRENT_FUNCTION
 
+
 #define CDEV_CURRENT_FUNCTION hysock_setflag
 /**
  * Ensure the flag designated is set in the argument.  This is used to construct arguments for the 
@@ -2871,51 +2835,42 @@
   BOOL option = (BOOL) * optval;
   I_32 optlen = sizeof (option);
 
-  if (0 > platformLevel)
-    {
-      return platformLevel;
-    }
-  if (0 > platformOption)
-    {
-      return platformOption;
-    }
-
-  /* If both the IPv4 and IPv6 socket are open then we want to set the option on both.  If only one is open,
-     then we set it just on that one.  */
+  if (0 > platformLevel) {
+    return platformLevel;
+  }
+  if (0 > platformOption) {
+    return platformOption;
+  }
 
-  if (socketP->flags & SOCKET_IPV4_OPEN_MASK)
-    {
-      rc =
-	setsockopt (socketP->ipv4, platformLevel, platformOption,
-		    (char *) &option, optlen);
-    }
-  if (rc == 0 && socketP->flags & SOCKET_IPV6_OPEN_MASK)
-    {
-      if ((platformOption == IP_MULTICAST_LOOP)
-	  && (platformLevel == OS_IPPROTO_IP))
-	{
-	  platformLevel = IPPROTO_IPV6;
-	  platformOption = IPV6_MULTICAST_LOOP;
-	}
-      rc =
-	setsockopt (socketP->ipv6, platformLevel, platformOption,
+  /* If both the IPv4 and IPv6 socket are open then we want to set the
+   * option on both.  If only one is open, then we set it just on that one.
+   */
+  if (socketP->flags & SOCKET_IPV4_OPEN_MASK) {
+    rc = setsockopt(socketP->ipv4, platformLevel, platformOption,
+		  (char *) &option, optlen);
+  }
+  if (rc == 0 && socketP->flags & SOCKET_IPV6_OPEN_MASK) {
+    if ((platformOption == IP_MULTICAST_LOOP) &&
+        (platformLevel == OS_IPPROTO_IP)) {
+      platformLevel = IPPROTO_IPV6;
+	    platformOption = IPV6_MULTICAST_LOOP;
+	  }
+    rc = setsockopt(socketP->ipv6, platformLevel, platformOption,
 		    (char *) &option, optlen);
     }
 
-  if (rc != 0)
-    {
-      rc = WSAGetLastError ();
-      HYSOCKDEBUG ("<setsockopt (for bool) failed, err=%d>\n", rc);
-      switch (rc)
-	{
-	case WSAEINVAL:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
+  if (rc != 0) {
+    rc = WSAGetLastError ();
+    HYSOCKDEBUG ("<setsockopt (for bool) failed, err=%d>\n", rc);
+    switch (rc) {
+      case WSAEINVAL :
+	      return portLibrary->error_set_last_error (portLibrary, rc,
 						    HYPORT_ERROR_SOCKET_OPTARGSINVALID);
-	default:
-	  return portLibrary->error_set_last_error (portLibrary, rc,
+	    default :
+	      return portLibrary->error_set_last_error (portLibrary, rc,
 						    findError (rc));
-	}
-    }
+	  }
+  }
 
   return rc;
 }

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hycpu
+hycpu.exe
+hycpu.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hycpu.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycpu/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hycunit/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hycunit.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hyfiletext
+hyfiletext.exe
+hyfiletext.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hyfiletext.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyfiletext/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hygp
+hygp.exe
+hygp.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hygp.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hygp/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyipcmutex/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hyipcmutex
+hyipcmutex.exe
+hyipcmutex.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyipcmutex/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hyipcmutex.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyipcmutex/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hymem
+hymem.exe
+hymem.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hymem.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymem/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymmap/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hymmap
+hymmap.exe
+hymmap.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymmap/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hymmap.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hymmap/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hynls
+hynls.exe
+hynls.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hynls.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hynls/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hyport
+hyport.exe
+hyport.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hyport.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hyport/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hystr
+hystr.exe
+hystr.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hystr.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hystr/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hysysinfo/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -1 +1,3 @@
 hysysinfo
+hysysinfo.exe
+hysysinfo.pdb

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hysysinfo/shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+hysysinfo.obj

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/src/test/native/hysysinfo/windows/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 18 01:46:12 2008
@@ -0,0 +1 @@
+vc70.pdb

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java Thu Dec 18 01:46:12 2008
@@ -691,8 +691,7 @@
 
                     
                     isGetKeyStore = true;
-                    keyStore = ks;
-                    return keyStore;
+                    return ks;
                 } catch (KeyStoreException e) {
                     // Store exception
                     throw lastException = e;

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java Thu Dec 18 01:46:12 2008
@@ -24,18 +24,14 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InvalidObjectException;
 import java.io.NotSerializableException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.ObjectStreamField;
 import java.io.Serializable;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.harmony.security.fortress.PolicyUtils;
 import org.apache.harmony.security.internal.nls.Messages;
@@ -57,7 +53,6 @@
      */
     private static final long serialVersionUID = -4821973115467008846L;
 
-
     private String type;    
     
     private String name;
@@ -88,19 +83,7 @@
         this.type = type;
         this.name = name;
         this.actions = actions;
-        if (certs != null && certs.length != 0) {
-            //TODO filter non-signer certificates ???
-            List tmp = new ArrayList();
-            for (int i = 0; i < certs.length; i++) {
-                if (certs[i] != null) {
-                    tmp.add(certs[i]);
-                }
-            }
-            if (tmp.size() != 0) {
-                targetCerts = (Certificate[])tmp.toArray(
-                                new Certificate[tmp.size()]);
-            }
-        }
+        this.targetCerts = certs;
         hash = 0;
     }
 
@@ -137,21 +120,67 @@
             return true;
         }
         if (obj instanceof UnresolvedPermission) {
-            UnresolvedPermission that = (UnresolvedPermission)obj;
+            UnresolvedPermission that = (UnresolvedPermission) obj;
             if (getName().equals(that.getName())
-                && (name == null ? that.name == null 
-                    : name.equals(that.name))
-                && (actions == null ? that.actions == null
-                    : actions.equals(that.actions))
-                && (PolicyUtils.matchSubset(targetCerts, that.targetCerts) 
-                    && PolicyUtils.matchSubset(that.targetCerts, targetCerts))) {
+                    && (name == null ? that.name == null : name
+                            .equals(that.name))
+                    && (actions == null ? that.actions == null : actions
+                            .equals(that.actions))
+                    && equalsCertificates(this.targetCerts, that.targetCerts)) {
                 return true;
             }
         }
         return false;
     }
 
-	/**
+    /*
+     * check whether given array of certificates are equivalent
+     */
+    private boolean equalsCertificates(Certificate[] certs1,
+            Certificate[] certs2) {
+        if (certs1 == null || certs2 == null) {
+            return certs1 == certs2;
+        }
+
+        int length = certs1.length;
+        if (length != certs2.length) {
+            return false;
+        }
+
+        if (length > 0) {
+            boolean found;
+            for (int i = 0; i < length; i++) {
+                found = false;
+                for (int j = 0; j < length; j++) {
+                    if (certs1[i].equals(certs2[j])) {
+                        found = true;
+                        break;
+                    }
+                }
+
+                if (!found) {
+                    return false;
+                }
+            }
+
+            for (int i = 0; i < length; i++) {
+                found = false;
+                for (int j = 0; j < length; j++) {
+                    if (certs2[i].equals(certs1[j])) {
+                        found = true;
+                        break;
+                    }
+                }
+
+                if (!found) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
 	 * Answers an integer hash code for the receiver. Any two objects which
 	 * answer <code>true</code> when passed to <code>equals</code> must
 	 * answer the same value for this method.

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java Thu Dec 18 01:46:12 2008
@@ -38,6 +38,7 @@
 import org.apache.harmony.security.asn1.BerOutputStream;
 import org.apache.harmony.security.internal.nls.Messages;
 import org.apache.harmony.security.utils.ObjectIdentifier;
+import org.apache.harmony.security.Util;
 
 
 /**
@@ -284,7 +285,7 @@
             this.oid = thisOid;
 
         } else {
-            this.oid = (ObjectIdentifier) KNOWN_NAMES.get(sOid.toUpperCase());
+            this.oid = (ObjectIdentifier) KNOWN_NAMES.get(Util.toUpperCase(sOid));
             if (this.oid == null) {
                 throw new IOException(Messages.getString("security.178", sOid)); //$NON-NLS-1$
             }
@@ -311,7 +312,7 @@
             buf.append('=');
             if (value.escapedString == value.getHexString()) {
                 //FIXME all chars in upper case
-                buf.append(value.getHexString().toUpperCase());
+                buf.append(Util.toUpperCase(value.getHexString()));
             } else if (value.escapedString.length() != value.rawString.length()) {
                 // was escaped
                 value.appendQEString(buf);

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore2Test.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/KeyStore2Test.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore2Test.java Thu Dec 18 01:46:12 2008
@@ -19,19 +19,28 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.Key;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.KeyStoreSpi;
+import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.security.Provider;
 import java.security.PublicKey;
 import java.security.SecureRandom;
 import java.security.Security;
 import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
@@ -588,6 +597,122 @@
 
 		assertEquals("the size of the keyStore is not 3", 3, keyTest.size());
 	}
+    
+    
+    public void test_Constructor() throws Exception {
+        KeyStore ks = new MockKeyStore(new MockKeyStoreSpi(), null,
+                "MockKeyStore");
+        ks.load(null, null);
+        ks.store(null, null);
+
+        ks = new MockKeyStore(new MockKeyStoreSpi(), null, "MockKeyStore");
+        ks.load(null);
+        try {
+            ks.store(null);
+            fail("should throw UnsupportedOperationException.");
+        } catch (UnsupportedOperationException e) {
+            // expected.
+        }
+    }
+    
+    public class MockKeyStore extends KeyStore{
+
+        public MockKeyStore(KeyStoreSpi keyStoreSpi, Provider provider, String type) {
+            super(keyStoreSpi, provider, type);            
+        }
+    }
+    
+    public class MockKeyStoreSpi extends KeyStoreSpi {
+
+        @Override
+        public Enumeration<String> engineAliases() {
+            return null;
+        }
+
+        @Override
+        public boolean engineContainsAlias(String alias) {
+            return false;
+        }
+
+        @Override
+        public void engineDeleteEntry(String alias) throws KeyStoreException {
+            return;
+        }
+
+        @Override
+        public Certificate engineGetCertificate(String alias) {
+            return null;
+        }
+
+        @Override
+        public String engineGetCertificateAlias(Certificate cert) {
+            return null;
+        }
+
+        @Override
+        public Certificate[] engineGetCertificateChain(String alias) {
+            return null;
+        }
+
+        @Override
+        public Date engineGetCreationDate(String alias) {
+            return null;
+        }
+
+        @Override
+        public Key engineGetKey(String alias, char[] password)
+                throws NoSuchAlgorithmException, UnrecoverableKeyException {
+            return null;
+        }
+
+        @Override
+        public boolean engineIsCertificateEntry(String alias) {
+            return false;
+        }
+
+        @Override
+        public boolean engineIsKeyEntry(String alias) {
+            return false;
+        }
+
+        @Override
+        public void engineLoad(InputStream stream, char[] password)
+                throws IOException, NoSuchAlgorithmException,
+                CertificateException {
+            return;
+        }
+
+        @Override
+        public void engineSetCertificateEntry(String alias, Certificate cert)
+                throws KeyStoreException {
+            return;
+        }
+
+        @Override
+        public void engineSetKeyEntry(String alias, Key key, char[] password,
+                Certificate[] chain) throws KeyStoreException {
+            return;
+        }
+
+        @Override
+        public void engineSetKeyEntry(String alias, byte[] key,
+                Certificate[] chain) throws KeyStoreException {
+            return;
+        }
+
+        @Override
+        public int engineSize() {
+            return 0;
+        }
+
+        @Override
+        public void engineStore(OutputStream stream, char[] password)
+                throws IOException, NoSuchAlgorithmException,
+                CertificateException {
+            return;
+        }
+        
+    }
 
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.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/KeyStore3Test.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java Thu Dec 18 01:46:12 2008
@@ -18,6 +18,7 @@
 package org.apache.harmony.security.tests.java.security;
 
 import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -30,6 +31,9 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 import java.security.UnrecoverableKeyException;
+import java.security.KeyStore.Builder;
+import java.security.KeyStore.PasswordProtection;
+import java.security.KeyStore.ProtectionParameter;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
@@ -148,6 +152,31 @@
         mockKeyStore.store(null, null);
     }
     
+    public void test_getKeyStore() throws KeyStoreException,
+            NoSuchAlgorithmException, CertificateException,
+            FileNotFoundException, IOException {
+
+        String alias = "BKS";
+        char[] pwd = new char[] { '1', '2', '3', '4', '5', '6' };
+        InputStream fis = KeyStore2Test.class
+                .getResourceAsStream("builderimpl.ks");
+        KeyStore ks = KeyStore.getInstance(alias);
+        ks.load(fis, pwd);
+        Builder b = Builder.newInstance(ks, new PasswordProtection(pwd));
+        KeyStore firstKeyStore = b.getKeyStore();
+        ProtectionParameter firstProtParameter = b
+                .getProtectionParameter(alias);
+        assertSame(firstKeyStore, b.getKeyStore());
+        assertSame(firstProtParameter, b.getProtectionParameter(alias));
+
+        b = Builder.newInstance(alias, ks.getProvider(),
+                new KeyStore.PasswordProtection(pwd));
+        firstKeyStore = b.getKeyStore();
+        firstProtParameter = b.getProtectionParameter(alias);
+        assertNotSame(firstKeyStore, b.getKeyStore());
+        assertSame(firstProtParameter, b.getProtectionParameter(alias));
+    }
+    
     protected void setUp() throws Exception {
         super.setUp();
         mockKeyStore = new MyKeyStore(new MyKeyStoreSpi(), null, "MyKeyStore");

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermission_ImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermission_ImplTest.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermission_ImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermission_ImplTest.java Thu Dec 18 01:46:12 2008
@@ -22,8 +22,12 @@
 
 package java.security;
 
+import java.security.cert.Certificate;
+
 import junit.framework.TestCase;
 
+import org.apache.harmony.security.tests.support.cert.MyCertificate;
+
 /**
  * Tests for <code>UnresolvedPermission</code> class fields and methods
  * 
@@ -46,14 +50,6 @@
         assertEquals(name, up.getUnresolvedName()); 
         assertEquals(action, up.getUnresolvedActions()); 
         assertNull(up.getUnresolvedCerts());
-        
-        up = new UnresolvedPermission(type, name, action, new java.security.cert.Certificate[0]);
-        assertNull("Empty array should be the same as null", up.getUnresolvedCerts());
-        // case of trivial collection: {null}
-        up = new UnresolvedPermission(type, name, action, new java.security.cert.Certificate[3]);
-        assertNull(up.getUnresolvedCerts());
-        //assertNotSame(up.getUnresolvedCerts(), up.getUnresolvedCerts());
-        //assertEquals(1, up.getUnresolvedCerts().length);
     }
     
     public void testEquals()
@@ -70,13 +66,10 @@
         assertTrue(up.equals(up2));
         assertTrue(up.hashCode() == up2.hashCode());
         up2 = new UnresolvedPermission(type, name, action, new java.security.cert.Certificate[0]);
-        assertTrue("null and empty certificates should be considered equal", up.equals(up2));
         assertTrue(up.hashCode() == up2.hashCode());
         up2 = new UnresolvedPermission(type, name, action, new java.security.cert.Certificate[2]);
-        assertTrue(up.equals(up2));
         //case of trivial collections {null} 
         up = new UnresolvedPermission(type, name, action, new java.security.cert.Certificate[10]);
-        assertTrue(up.equals(up2));
         assertTrue(up.hashCode() == up2.hashCode());
     }
 
@@ -102,4 +95,133 @@
         up = new UnresolvedPermission("java.security.AllPermission", null, null, new java.security.cert.Certificate[0]);
         assertEquals(new AllPermission(name, ""), up.resolve(AllPermission.class));
     }
+    
+    public static final String type = "java.util.PropertyPermission";
+
+    public static final String name = "os.name";
+
+    public static final String action = "write,read";
+
+    public static final byte[] testEncoding1 = new byte[] { (byte) 1 };
+
+    public static final byte[] testEncoding2 = new byte[] { (byte) 2 };
+
+    public static final byte[] testEncoding3 = new byte[] { (byte) 1, (byte) 2,
+            (byte) 3 };
+
+    public static final Certificate cert1 = new MyCertificate("TEST_TYPE1",
+            testEncoding1);
+
+    public static final Certificate cert2 = new MyCertificate("TEST_TYPE2",
+            testEncoding2);
+
+    public static final Certificate cert3 = new MyCertificate("TEST_TYPE3",
+            testEncoding3);
+
+    public void test_Constructor() {
+        UnresolvedPermission up = new UnresolvedPermission(type, name, action,
+                null);
+        assertNull(up.getUnresolvedCerts());
+
+        up = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[0]);
+        assertEquals(0, up.getUnresolvedCerts().length);
+
+        up = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        assertEquals(2, up.getUnresolvedCerts().length);
+    }
+
+    public void test_Equals_Scenario0() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                null);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                null);
+        assertEquals(up1, up2);
+    }
+
+    public void test_Equals_Scenario1() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                null);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[0]);
+        assertFalse(up1.equals(up2));
+    }
+
+    public void test_Equals_Scenario2() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                null);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        assertFalse(up1.equals(up2));
+    }
+
+    public void test_Equals_Scenario3() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[0]);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[0]);
+        assertEquals(up1, up2);
+    }
+
+    public void test_Equals_Scenario4() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[0]);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        assertFalse(up1.equals(up2));
+    }
+
+    public void test_Equals_Scenario5() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[5]);
+        assertFalse(up1.equals(up2));
+    }
+
+    public void test_Equals_Scenario6() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1 });
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1 });
+        assertEquals(up1, up2);
+    }
+
+    public void test_Equals_Scenario7() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1, cert2 });
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1, cert2 });
+        assertEquals(up1, up2);
+    }
+
+    public void test_Equals_Scenario8() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1, cert2 });
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert2, cert1 });
+        assertEquals(up1, up2);
+    }
+
+    public void test_Equals_Scenario9() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert1, cert2, cert3 });
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[] { cert2, cert1, cert3 });
+        assertEquals(up1, up2);
+    }
+    
+    public void test_Equals_Scenario10() {
+        UnresolvedPermission up1 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        UnresolvedPermission up2 = new UnresolvedPermission(type, name, action,
+                new java.security.cert.Certificate[2]);
+        try {
+            up1.equals(up2);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/JoinRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/JoinRowSetImpl.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/JoinRowSetImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/JoinRowSetImpl.java Thu Dec 18 01:46:12 2008
@@ -37,7 +37,6 @@
 import javax.sql.rowset.spi.SyncFactoryException;
 import javax.sql.rowset.spi.SyncProviderException;
 
-import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.sql.internal.nls.Messages;
 
 public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {

Propchange: harmony/enhanced/classlib/branches/java6/modules/suncompat/src/main/java/com/sun/image/codec/jpeg/JPEGImageEncoderImpl.java
            ('svn:mergeinfo' removed)

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common Thu Dec 18 01:46:12 2008
@@ -1,17 +1,7 @@
 javax/swing/AccessibleJComponent_MultithreadedTest.java
-javax/swing/BoxLayoutTest.java
-javax/swing/DefaultDesktopManagerTest.java
-javax/swing/ImageIcon_MultithreadedTest.java
-javax/swing/JColorChooserTest.java
-javax/swing/JComponentTest.java
-javax/swing/JComponent_AddRemoveNotifyTest.java
-# should be checked once again: does it still hang?
-javax/swing/JComponent_MultithreadedTest.java
 javax/swing/JDialogTest.java
 javax/swing/JEditorPaneTest.java
 javax/swing/JEditorPane_AccessibleJEditorPaneHTMLTest.java
-javax/swing/JEditorPane_AccessibleJEditorPaneTest.java
-javax/swing/JEditorPane_MultithreadedTest.java
 javax/swing/JFormattedTextFieldTest.java
 javax/swing/JFormattedTextField_CommitActionRTest.java
 javax/swing/JFrameRTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.windows.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.windows.x86.drl?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.windows.x86.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.windows.x86.drl Thu Dec 18 01:46:12 2008
@@ -1,4 +1,4 @@
-javax/swing/JCheckBoxMenuItemTest.java
+javax/swing/JFileChooserRTest
 javax/swing/Timer_MultithreadedTest.java
 javax/swing/text/AbstractDocument_AbstractElement_MASNoLockTest.java
 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/ImageIcon.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/ImageIcon.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/ImageIcon.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/ImageIcon.java Thu Dec 18 01:46:12 2008
@@ -33,7 +33,6 @@
 import javax.accessibility.AccessibleIcon;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleStateSet;
-import org.apache.harmony.luni.util.NotImplementedException;
 
 /**
  * <p>

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Thu Dec 18 01:46:12 2008
@@ -364,12 +364,12 @@
         }
     }
 
-    protected static final String ICONIFY_CMD = "Iconify";
-    protected static final String MAXIMIZE_CMD = "Maximize";
-    protected static final String RESTORE_CMD = "Restore";
-    protected static final String CLOSE_CMD = "Close";
-    protected static final String MOVE_CMD = "Move";
-    protected static final String SIZE_CMD = "Size";
+    protected static final String ICONIFY_CMD = new String("Iconify");
+    protected static final String MAXIMIZE_CMD = new String("Maximize");
+    protected static final String RESTORE_CMD = new String("Restore");
+    protected static final String CLOSE_CMD = new String("Close");
+    protected static final String MOVE_CMD = new String("Move");
+    protected static final String SIZE_CMD = new String("Size");
 
     protected JMenuBar menuBar;
     protected JMenu windowMenu;

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTabbedPaneUI.java Thu Dec 18 01:46:12 2008
@@ -986,7 +986,6 @@
                 return run;
             }
         }
-        assert false : "incorrect tabIndex";
         return 0;
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java Thu Dec 18 01:46:12 2008
@@ -22,7 +22,7 @@
 
 import org.apache.harmony.x.swing.Utilities;
 
-public class ColorPainter extends SynthPainter {
+class ColorPainter extends SynthPainter {
 
     /**
      * Method that do paints

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java Thu Dec 18 01:46:12 2008
@@ -40,7 +40,11 @@
      * The maximum number of created color types. This field exist for
      * compatibility with RI only
      */
-    public static final int MAX_COUNT = 5;
+    public static final int MAX_COUNT; // Required by spec to be defined as a non-const value.
+    
+    static {
+        MAX_COUNT = 5;
+    }
 
     /**
      * The field is used for ID calculation

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/View.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/View.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/View.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/View.java Thu Dec 18 01:46:12 2008
@@ -388,8 +388,6 @@
         } else if (type == DocumentEvent.EventType.CHANGE) {
             view.changedUpdate(event, shape, factory);
         }
-        assert false : "Unknown document event type. "
-                       + "Valid values are EventType.INSERT, REMOVE, CHANGE";
     }
 
     protected boolean updateChildren(final DocumentEvent.ElementChange change,

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java Thu Dec 18 01:46:12 2008
@@ -63,12 +63,12 @@
     /**
      * @deprecated
      */
-    public static final String RESET = "Reset";
+    public static final String RESET = new String("Reset");
 
     /**
      * @deprecated
      */
-    public static final String SUBMIT = "Submit Query";
+    public static final String SUBMIT = new String("Submit Query");
 
     private int inputTypeIndex = FormAttributes.INPUT_TYPE_INDEX_UNDEFINED;
 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/rtf/RTFEditorKit.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/rtf/RTFEditorKit.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/rtf/RTFEditorKit.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/rtf/RTFEditorKit.java Thu Dec 18 01:46:12 2008
@@ -17,6 +17,7 @@
 
 package javax.swing.text.rtf;
 
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.text.rtf.RTFParser;
 import org.apache.harmony.x.swing.text.rtf.ParseException;
 import org.apache.harmony.x.swing.text.rtf.RTFHandler;
@@ -68,12 +69,12 @@
     }
   }
 
-  public void write(OutputStream out, Document doc, int pos, int len) {
-
+  public void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException, NotImplementedException {
+      throw new NotImplementedException();
   }
 
-  public void write(Writer out, Document doc, int pos, int len) {
-
+  public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
+      throw new IOException("Cannot write RTF");
   }
 
 }
\ No newline at end of file

Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java Thu Dec 18 01:46:12 2008
@@ -39,24 +39,38 @@
      * Constant that indicates the default base level. If there is no strong
      * character, then set the paragraph level to left-to-right.
      */
-    public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT;
+    public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = -2;
 
     /**
      * Constant that indicates the default base level. If there is no strong
      * character, then set the paragraph level to right-to-left.
      */
-    public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT;
+    public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = -1;
 
     /**
      * Constant that specifies the default base level as 
      * left-to-right. 
      */
-    public static final int DIRECTION_LEFT_TO_RIGHT = com.ibm.icu.text.Bidi.DIRECTION_LEFT_TO_RIGHT;
+    public static final int DIRECTION_LEFT_TO_RIGHT = 0;
 
     /**
      * Constant that specifies the default base level right-to-left.
      */  
-    public static final int DIRECTION_RIGHT_TO_LEFT = com.ibm.icu.text.Bidi.DIRECTION_RIGHT_TO_LEFT;
+    public static final int DIRECTION_RIGHT_TO_LEFT = 1;
+
+    /*
+     * Converts the constant from the value specified in the Java spec, to the
+     * value required by the ICU implementation.
+     */
+    private final static int convertDirectionConstant(int javaConst) {
+        switch (javaConst) {
+        case DIRECTION_DEFAULT_LEFT_TO_RIGHT : return com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT;
+        case DIRECTION_DEFAULT_RIGHT_TO_LEFT : return com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT;
+        case DIRECTION_LEFT_TO_RIGHT         : return com.ibm.icu.text.Bidi.DIRECTION_LEFT_TO_RIGHT;
+        case DIRECTION_RIGHT_TO_LEFT         : return com.ibm.icu.text.Bidi.DIRECTION_RIGHT_TO_LEFT;
+        default                              : return com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT;
+        }
+    }
 
     /* 
      * Use an embedded ICU4J Bidi object to do all the work
@@ -159,7 +173,8 @@
                     "text.11", paragraphLength)); //$NON-NLS-1$
         }
 
-        icuBidi = new com.ibm.icu.text.Bidi(text, textStart, embeddings, embStart, paragraphLength, flags);
+        icuBidi = new com.ibm.icu.text.Bidi(text, textStart, embeddings,
+                embStart, paragraphLength, convertDirectionConstant(flags));
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/.settings/org.eclipse.jdt.core.prefs?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/.settings/org.eclipse.jdt.core.prefs (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/.settings/org.eclipse.jdt.core.prefs Thu Dec 18 01:46:12 2008
@@ -1,7 +1,7 @@
-#Wed May 03 13:10:22 BST 2006
+#Sun Dec 14 10:48:45 CST 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.5
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/build.xml Thu Dec 18 01:46:12 2008
@@ -127,8 +127,6 @@
             <javac-elements>
                 <src>
                     <pathelement location="${hy.x-net.src.test}/support/common/java" />
-                    <!-- FIXME: X-NET tests should not reach into security module code -->
-                    <pathelement location="${hy.x-net}/../security/src/test/support/common/java"/>
                 </src>
 
                 <include name="**/*.java" />

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultServerSocketFactory.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net;
 
 import java.io.IOException;
@@ -27,22 +22,27 @@
 import java.net.ServerSocket;
 
 /**
- * Default implementation of javax.net.ServerSocketFactory
- * 
+ * Default implementation of {@link javax.net.ServerSocketFactory}
  */
-class DefaultServerSocketFactory extends ServerSocketFactory {
+final class DefaultServerSocketFactory extends ServerSocketFactory {
+
+    DefaultServerSocketFactory() {
+        super();
+    }
 
+    @Override
     public ServerSocket createServerSocket(int port) throws IOException {
         return new ServerSocket(port);
     }
 
-    public ServerSocket createServerSocket(int port, int backlog)
-            throws IOException {
+    @Override
+    public ServerSocket createServerSocket(int port, int backlog) throws IOException {
         return new ServerSocket(port, backlog);
     }
 
-    public ServerSocket createServerSocket(int port, int backlog,
-            InetAddress iAddress) throws IOException {
+    @Override
+    public ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+            throws IOException {
         return new ServerSocket(port, backlog, iAddress);
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultSocketFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultSocketFactory.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultSocketFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/DefaultSocketFactory.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net;
 
 import java.io.IOException;
@@ -28,31 +23,38 @@
 import java.net.UnknownHostException;
 
 /**
- * Default implementation of javax.net.SocketFactory
- * 
+ * Default implementation of {@link javax.net.SocketFactory}
  */
-class DefaultSocketFactory extends SocketFactory {
+final class DefaultSocketFactory extends SocketFactory {
 
-	public Socket createSocket() throws IOException {
-		return new Socket();
-	}
+    DefaultSocketFactory() {
+        super();
+    }
+
+    @Override
+    public Socket createSocket() throws IOException {
+        return new Socket();
+    }
 
-    public Socket createSocket(String host, int port) throws IOException,
-            UnknownHostException {
+    @Override
+    public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
         return new Socket(host, port);
     }
 
-    public Socket createSocket(String host, int port, InetAddress localHost,
-            int localPort) throws IOException, UnknownHostException {
+    @Override
+    public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+            throws IOException, UnknownHostException {
         return new Socket(host, port, localHost, localPort);
     }
 
+    @Override
     public Socket createSocket(InetAddress host, int port) throws IOException {
         return new Socket(host, port);
     }
 
-    public Socket createSocket(InetAddress address, int port,
-            InetAddress localAddress, int localPort) throws IOException {
+    @Override
+    public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+            int localPort) throws IOException {
         return new Socket(address, port, localAddress, localPort);
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ServerSocketFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ServerSocketFactory.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ServerSocketFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ServerSocketFactory.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net;
 
 import java.io.IOException;
@@ -27,35 +22,30 @@
 import java.net.ServerSocket;
 import java.net.SocketException;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
 public abstract class ServerSocketFactory {
-    static ServerSocketFactory defaultFactory;
-    protected ServerSocketFactory() {
-    }
+    private static ServerSocketFactory defaultFactory;
 
     public static synchronized ServerSocketFactory getDefault() {
         if (defaultFactory == null) {
-                defaultFactory = new DefaultServerSocketFactory();
+            defaultFactory = new DefaultServerSocketFactory();
         }
         return defaultFactory;
     }
 
+    protected ServerSocketFactory() {
+        super();
+    }
+
     public ServerSocket createServerSocket() throws IOException {
-        // follow RI's behavior 
+        // follow RI's behavior
         throw new SocketException("Unbound server sockets not implemented");
     }
 
-    public abstract ServerSocket createServerSocket(int port)
-            throws IOException;
+    public abstract ServerSocket createServerSocket(int port) throws IOException;
 
-    public abstract ServerSocket createServerSocket(int port, int backlog)
-            throws IOException;
+    public abstract ServerSocket createServerSocket(int port, int backlog) throws IOException;
 
-    public abstract ServerSocket createServerSocket(int port, int backlog,
-            InetAddress iAddress) throws IOException;
+    public abstract ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+            throws IOException;
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/SocketFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/SocketFactory.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/SocketFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/SocketFactory.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net;
 
 import java.io.IOException;
@@ -28,16 +23,9 @@
 import java.net.SocketException;
 import java.net.UnknownHostException;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public abstract class SocketFactory {
 
-    static SocketFactory defaultFactory;
-    
-    protected SocketFactory() {
-    }
+    private static SocketFactory defaultFactory;
 
     public static synchronized SocketFactory getDefault() {
         if (defaultFactory == null) {
@@ -46,21 +34,23 @@
         return defaultFactory;
     }
 
+    protected SocketFactory() {
+        super();
+    }
+
     public Socket createSocket() throws IOException {
-        // follow RI's behavior 
+        // follow RI's behavior
         throw new SocketException("Unconnected sockets not implemented");
     }
 
-    public abstract Socket createSocket(String host, int port)
-            throws IOException, UnknownHostException;
-
-    public abstract Socket createSocket(String host, int port,
-            InetAddress localHost, int localPort) throws IOException,
+    public abstract Socket createSocket(String host, int port) throws IOException,
             UnknownHostException;
 
-    public abstract Socket createSocket(InetAddress host, int port)
-            throws IOException;
+    public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+            throws IOException, UnknownHostException;
+
+    public abstract Socket createSocket(InetAddress host, int port) throws IOException;
 
-    public abstract Socket createSocket(InetAddress address, int port,
-            InetAddress localAddress, int localPort) throws IOException;
-}
\ No newline at end of file
+    public abstract Socket createSocket(InetAddress address, int port, InetAddress localAddress,
+            int localPort) throws IOException;
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/CertPathTrustManagerParameters.java Thu Dec 18 01:46:12 2008
@@ -15,29 +15,37 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.security.cert.CertPathParameters;
 
 /**
- * @com.intel.drl.spec_ref
+ * Container for {@link CertPathParameters}.
  * 
+ * @since 1.5
  */
 public class CertPathTrustManagerParameters implements ManagerFactoryParameters {
 
-    private CertPathParameters param;
+    private final CertPathParameters param;
 
+    /**
+     * Constructs an instance by cloning the parameters passed.
+     * 
+     * @param parameters the parameters to wrap
+     * 
+     * @throws NullPointerException if {@code parameters} is {@code null}
+     */
     public CertPathTrustManagerParameters(CertPathParameters parameters) {
         param = (CertPathParameters) parameters.clone();
     }
 
+    /**
+     * The parameters contained within.
+     * 
+     * @return a cloned instance of the parameters
+     */
     public CertPathParameters getParameters() {
         return (CertPathParameters) param.clone();
     }
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultHostnameVerifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultHostnameVerifier.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultHostnameVerifier.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultHostnameVerifier.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLContext.java Thu Dec 18 01:46:12 2008
@@ -15,36 +15,28 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris V. Kuznetsov
- * @version $Revision$
- */
-
 package javax.net.ssl;
 
 import java.io.FileInputStream;
 import java.security.AccessController;
+import java.security.KeyStore;
+import java.security.PrivilegedAction;
 import java.security.Provider;
 import java.security.Security;
-import java.security.KeyStore;
-import java.util.Iterator;
 
 import org.apache.harmony.security.fortress.Engine;
 import org.apache.harmony.security.fortress.Services;
 
-
 /**
  * Support class for this package.
- *  
  */
-
-class DefaultSSLContext {
+final class DefaultSSLContext {
     private static SSLContext defaultSSLContext;
 
-    public static SSLContext getContext() {
+     static synchronized SSLContext getContext() {
         if (defaultSSLContext == null) {
             defaultSSLContext = AccessController
-                    .doPrivileged(new java.security.PrivilegedAction<SSLContext>() {
+                    .doPrivileged(new PrivilegedAction<SSLContext>() {
                         public SSLContext run() {
                             return findDefault();
                         }
@@ -55,40 +47,37 @@
 
     private static SSLContext findDefault() {
         // FIXME EXPORT CONTROL
-        Provider.Service service;
-        for (Iterator it1 = Services.getProvidersList().iterator(); it1
-                .hasNext();) {
-            service = Engine.door.getService((Provider) it1.next(),
-                    "SSLContext");
+        for (Provider provider : Services.getProvidersList()) {
+            final Provider.Service service = Engine.door.getService(provider, "SSLContext");
             if (service != null) {
                 try {
-                    SSLContext con = new ContextImpl(
-                            (SSLContextSpi) service.newInstance(null),
-                            service.getProvider(), 
-                            service.getAlgorithm());
+                    SSLContext con = new SSLContext((SSLContextSpi) service.newInstance(null),
+                            service.getProvider(), service.getAlgorithm());
 
- //TODO javax.net.ssl.keyStoreProvider, javax.net.ssl.trustStoreProvider system property
+                    /* 
+                     * TODO 
+                     * javax.net.ssl.keyStoreProvider, 
+                     * javax.net.ssl.trustStoreProvider system property
+                     */
+                    
                     // find KeyStore, KeyManagers
                     KeyManager[] keyManagers = null;
-                    KeyStore ks = KeyStore.getInstance(KeyStore
-                            .getDefaultType());
-                    String keystore = System
-                            .getProperty("javax.net.ssl.keyStore");
-                    String keystorepwd = System
-                            .getProperty("javax.net.ssl.keyStorePassword");
+                    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+                    String keystore = System.getProperty("javax.net.ssl.keyStore");
+                    String keystorepwd = System.getProperty("javax.net.ssl.keyStorePassword");
                     char[] pwd = null;
                     if (keystorepwd != null) {
                         pwd = keystorepwd.toCharArray();
                     }
                     if (keystore != null) {
-                        FileInputStream fis = new java.io.FileInputStream(
-                                keystore);
-                        ks.load(fis, pwd);
-                        fis.close();
-
+                        FileInputStream fis = new FileInputStream(keystore);
+                        try {
+                            ks.load(fis, pwd);
+                        } finally {
+                            fis.close();
+                        }
                         KeyManagerFactory kmf;
-                        String kmfAlg = Security
-                                .getProperty("ssl.KeyManagerFactory.algorithm");
+                        String kmfAlg = Security.getProperty("ssl.KeyManagerFactory.algorithm");
                         if (kmfAlg == null) {
                             kmfAlg = "SunX509";
                         }
@@ -100,21 +89,21 @@
                     // find TrustStore, TrustManagers
                     TrustManager[] trustManagers = null;
                     keystore = System.getProperty("javax.net.ssl.trustStore");
-                    keystorepwd = System
-                            .getProperty("javax.net.ssl.trustStorePassword");
+                    keystorepwd = System.getProperty("javax.net.ssl.trustStorePassword");
                     pwd = null;
                     if (keystorepwd != null) {
                         pwd = keystorepwd.toCharArray();
                     }
-                    //TODO Defaults: jssecacerts; cacerts
+                    // TODO Defaults: jssecacerts; cacerts
                     if (keystore != null) {
-                        FileInputStream fis = new java.io.FileInputStream(
-                                keystore);
-                        ks.load(fis, pwd);
-                        fis.close();
+                        FileInputStream fis = new FileInputStream(keystore);
+                        try {
+                            ks.load(fis, pwd);
+                        } finally {
+                            fis.close();
+                        }
                         TrustManagerFactory tmf;
-                        String tmfAlg = Security
-                                .getProperty("ssl.TrustManagerFactory.algorithm");
+                        String tmfAlg = Security.getProperty("ssl.TrustManagerFactory.algorithm");
                         if (tmfAlg == null) {
                             tmfAlg = "PKIX";
                         }
@@ -126,7 +115,6 @@
                     con.init(keyManagers, trustManagers, null);
                     return con;
                 } catch (Exception e) {
-                    // e.printStackTrace();
                     // ignore and try another
                 }
             }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/DefaultSSLServerSocketFactory.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.io.IOException;
@@ -33,33 +28,36 @@
  */
 class DefaultSSLServerSocketFactory extends SSLServerSocketFactory {
 
-    private String errMessage;
-    
+    private final String errMessage;
+
+    DefaultSSLServerSocketFactory(String mes) {
+        errMessage = mes;
+    }
+
+    @Override
     public String[] getDefaultCipherSuites() {
         return new String[0];
     }
 
+    @Override
     public String[] getSupportedCipherSuites() {
         return new String[0];
     }
 
+    @Override
     public ServerSocket createServerSocket(int port) throws IOException {
         throw new SocketException(errMessage);
     }
 
-
-    public ServerSocket createServerSocket(int port, int backlog)
-            throws IOException {
+    @Override
+    public ServerSocket createServerSocket(int port, int backlog) throws IOException {
         throw new SocketException(errMessage);
     }
 
-    public ServerSocket createServerSocket(int port, int backlog,
-            InetAddress iAddress) throws IOException {
+    @Override
+    public ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
+            throws IOException {
         throw new SocketException(errMessage);
     }
-    
-    DefaultSSLServerSocketFactory(String mes) {
-        errMessage = mes;
-    }
 
 }



Mime
View raw message