cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6579] Fixing the inflation code not to lose the existing inflated content
Date Wed, 09 Sep 2015 13:37:58 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 400a46825 -> e1c2055ea


[CXF-6579] Fixing the inflation code not to lose the existing inflated content


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e1c2055e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e1c2055e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e1c2055e

Branch: refs/heads/2.7.x-fixes
Commit: e1c2055eaa7c6adb13ecf4793d079c02502e96c3
Parents: 400a468
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Sep 9 13:07:13 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Sep 9 14:37:37 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java  | 5 ++++-
 .../apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java  | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e1c2055e/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java
index 76c68ef..951de15 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java
@@ -49,8 +49,11 @@ public class DeflateEncoderDecoder {
                         break;
                     }
                 }
-                
+                byte[] lastInflatedToken = inflatedToken;
                 inflatedToken = new byte[input.length + inflatedLen];
+                if (lastInflatedToken != input) {
+                    System.arraycopy(lastInflatedToken, 0, inflatedToken, 0, inflatedLen);
+                }
                 System.arraycopy(input, 0, inflatedToken, inflatedLen, inputLen);
                 inflatedLen += inputLen;
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/e1c2055e/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java
b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java
index 15a2512..38bfdf4 100644
--- a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java
+++ b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java
@@ -70,7 +70,7 @@ public class DeflateEncoderDecoderTest extends Assert {
         String token = "valid_grant valid_grant valid_grant valid_grant valid_grant valid_grant";
 
         DeflateEncoderDecoder deflateEncoderDecoder = new DeflateEncoderDecoder();
-        byte[] deflatedToken = deflateEncoderDecoder.deflateToken(token.getBytes(), 0, true);
+        byte[] deflatedToken = deflateEncoderDecoder.deflateToken(token.getBytes());
 
         String cxfInflatedToken = IOUtils
                 .toString(deflateEncoderDecoder.inflateToken(deflatedToken));


Mime
View raw message