You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/11/06 18:28:09 UTC

[httpcomponents-client] branch master updated: HTTPCLIENT-2023: Allow nested arrays and all primitive types in DefaultHttpCacheEntrySerializer

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/master by this push:
     new 33cfaed  HTTPCLIENT-2023: Allow nested arrays and all primitive types in DefaultHttpCacheEntrySerializer
33cfaed is described below

commit 33cfaed92ca5ce689e1dc40e607341923e9cf4a3
Author: Olof Larsson <ol...@sylt.nu>
AuthorDate: Wed Nov 6 18:02:20 2019 +0100

    HTTPCLIENT-2023: Allow nested arrays and all primitive types in DefaultHttpCacheEntrySerializer
---
 .../http/impl/cache/ByteArrayCacheEntrySerializer.java     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ByteArrayCacheEntrySerializer.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ByteArrayCacheEntrySerializer.java
index c15352c..2c34dc6 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ByteArrayCacheEntrySerializer.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ByteArrayCacheEntrySerializer.java
@@ -57,9 +57,17 @@ public final class ByteArrayCacheEntrySerializer implements HttpCacheEntrySerial
 
     private static final List<Pattern> ALLOWED_CLASS_PATTERNS = Collections.unmodifiableList(Arrays.asList(
             Pattern.compile("^(\\[L)?org\\.apache\\.hc\\.(.*)"),
-            Pattern.compile("^(\\[L)?java\\.util\\.(.*)"),
-            Pattern.compile("^(\\[L)?java\\.lang\\.(.*)$"),
-            Pattern.compile("^\\[B$")));
+            Pattern.compile("^(?:\\[+L)?java\\.util\\..*$"),
+            Pattern.compile("^(?:\\[+L)?java\\.lang\\..*$"),
+            Pattern.compile("^\\[+Z$"), // boolean
+            Pattern.compile("^\\[+B$"), // byte
+            Pattern.compile("^\\[+C$"), // char
+            Pattern.compile("^\\[+D$"), // double
+            Pattern.compile("^\\[+F$"), // float
+            Pattern.compile("^\\[+I$"), // int
+            Pattern.compile("^\\[+J$"), // long
+            Pattern.compile("^\\[+S$") // short
+    ));
 
     public static final ByteArrayCacheEntrySerializer INSTANCE = new ByteArrayCacheEntrySerializer();