You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/10/02 09:36:27 UTC

[GitHub] coheigea closed pull request #452: CXF-7858 fix decoding too

coheigea closed pull request #452: CXF-7858 fix decoding too
URL: https://github.com/apache/cxf/pull/452
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java b/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
index a3ae330c6b2..459c3749023 100644
--- a/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
+++ b/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
@@ -130,6 +130,10 @@ private Base64Utility() {
                                      int l)
         throws Base64Exception {
 
+        if (id != null && id.length == 0 && l == 0) {
+            return new byte[]{};
+        }
+
         // Keep it simple - must be >= 4. Unpadded
         // base64 data contain < 3 octets is invalid.
         //
diff --git a/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java b/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
index ff61b802a75..6062822a5de 100644
--- a/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
+++ b/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
@@ -179,6 +179,9 @@ public void testVectors() throws Exception {
         assertEquals("Zm9vYg==", Base64Utility.encode("foob".getBytes()));
         assertEquals("Zm9vYmE=", Base64Utility.encode("fooba".getBytes()));
         assertEquals("Zm9vYmFy", Base64Utility.encode("foobar".getBytes()));
+
+        //decode
+        assertArrayEquals(new byte[]{}, Base64Utility.decode(""));
     }
 
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services