Merge
diff --git a/.hgtags b/.hgtags
index 07acef3..456f3d2 100644
--- a/.hgtags
+++ b/.hgtags
@@ -309,6 +309,7 @@
 693025bbc45d683676fa78bb76201b665e0d8f2d jdk8u20-b21
 0c2393744b29175de5204140d4dfbf12ca3d364f jdk8u20-b22
 be30cb2a3088f2b7b334b499f7eddbd5312312a7 jdk8u20-b23
+dfb9f24d56b51e5a2ca26e77fc69a2464d51a4d3 jdk8u20-b25
 abca9f6f1a10e9f91b2538bbe7870f54f550d986 jdk8u25-b00
 7d0627679c9fdeaaaa9fe15c7cc11af0763621ec jdk8u25-b01
 b0277ec994b751ebb761814675352506cd56bcd6 jdk8u25-b02
@@ -319,3 +320,4 @@
 0e0a35b0bf0ff5852026c50038d5c2ecb26c075c jdk8u25-b07
 d7d221f56fd17b96bab4440448641a844f9e92cd jdk8u25-b08
 0c6cf43c5bcf0917d07a1bc94adb7a091f18f32c jdk8u25-b09
+1317d94e95861a47fee8258903b652af70a3493c jdk8u25-b10
diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README
index e16cd2a..6d1c60f 100644
--- a/THIRD_PARTY_README
+++ b/THIRD_PARTY_README
@@ -2,7 +2,7 @@
 -----------------------------
 
 %% This notice is provided with respect to ASM Bytecode Manipulation 
-Framework v5.0, which may be included with JRE 8, and JDK 8, and 
+Framework v5.0.3, which may be included with JRE 8, and JDK 8, and 
 OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -3349,14 +3349,14 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to zlib v1.2.5, which may be included 
+%% This notice is provided with respect to zlib v1.2.8, which may be included 
 with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
-  version 1.2.5, July 18th, 2005
+  version 1.2.8, April 28th, 2013
 
-  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+  Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -3382,11 +3382,11 @@
 -------------------------------------------------------------------------------
 
 %% This notice is provided with respect to the following which may be 
-included with JRE 8, JDK 8, and OpenJDK 8, except where noted:
+included with JRE 8, JDK 8, and OpenJDK 8.
 
-  Apache Commons Math 2.2
-  Apache Derby 10.10.1.2        [included with JDK 8]
-  Apache Jakarta BCEL 5.2 
+  Apache Commons Math 3.2
+  Apache Derby 10.10.1.3        
+  Apache Jakarta BCEL 5.1 
   Apache Jakarta Regexp 1.4 
   Apache Santuario XML Security for Java 1.5.4
   Apache Xalan-Java 2.7.1 
diff --git a/src/share/classes/sun/security/smartcardio/CardImpl.java b/src/share/classes/sun/security/smartcardio/CardImpl.java
index 7531d2e..1c14ea7 100644
--- a/src/share/classes/sun/security/smartcardio/CardImpl.java
+++ b/src/share/classes/sun/security/smartcardio/CardImpl.java
@@ -244,9 +244,6 @@
                     "sun.security.smartcardio.invertCardReset", "false")));
 
     public void disconnect(boolean reset) throws CardException {
-        if (invertReset) {
-            reset = !reset;
-        }
         if (reset) {
             checkSecurity("reset");
         }
@@ -254,6 +251,10 @@
             return;
         }
         checkExclusive();
+        // to preserve old behaviour, don't change flag until here
+        if (invertReset) {
+            reset = !reset;
+        }
         try {
             SCardDisconnect(cardId, (reset ? SCARD_RESET_CARD : SCARD_LEAVE_CARD));
         } catch (PCSCException e) {