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 12:07:28 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 8accdcea3 -> 9c3ee8bd3


[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/9c3ee8bd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9c3ee8bd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9c3ee8bd

Branch: refs/heads/master
Commit: 9c3ee8bd3105155d7fe7b3a661cbb1779ad82da0
Parents: 8accdce
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 13:07:13 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/common/util/CompressionUtils.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/9c3ee8bd/core/src/main/java/org/apache/cxf/common/util/CompressionUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/CompressionUtils.java b/core/src/main/java/org/apache/cxf/common/util/CompressionUtils.java
index c80352e..a67a789 100644
--- a/core/src/main/java/org/apache/cxf/common/util/CompressionUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/CompressionUtils.java
@@ -53,8 +53,11 @@ public final class CompressionUtils {
                         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/9c3ee8bd/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