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:23:14 UTC

[httpcomponents-client] branch 4.5.x 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 4.5.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


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

commit ed16362d101fcbb5c47482586b7f25e9c7a882cc
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
---
 .../client/cache/DefaultHttpCacheEntrySerializer.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
index 806b194..44397d3 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
@@ -55,10 +55,18 @@ import org.apache.http.client.cache.HttpCacheEntrySerializer;
 public class DefaultHttpCacheEntrySerializer implements HttpCacheEntrySerializer {
 
     private static final List<Pattern> ALLOWED_CLASS_PATTERNS = Collections.unmodifiableList(Arrays.asList(
-            Pattern.compile("^(\\[L)?org\\.apache\\.http\\.(.*)"),
-            Pattern.compile("^(\\[L)?java\\.util\\.(.*)"),
-            Pattern.compile("^(\\[L)?java\\.lang\\.(.*)$"),
-            Pattern.compile("^\\[B$")));
+            Pattern.compile("^(?:\\[+L)?org\\.apache\\.http\\..*$"),
+            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
+    ));
 
     private final List<Pattern> allowedClassPatterns;