[struts] branch WW-2815-xstream updated (bb7161029 -> a562f8f80)

2022-10-17 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch WW-2815-xstream
in repository https://gitbox.apache.org/repos/asf/struts.git


from bb7161029 WW-2815 Refactors XStreamHandler to allow to provide a 
custom configuration
 new ac13c32bd WW-2815 Drops deprecated API
 new a562f8f80 WW-2815 Fixes support for Collections and String

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/struts2/rest/handler/XStreamHandler.java | 13 ++---
 .../org/apache/struts2/rest/handler/XStreamHandlerTest.java |  9 +++--
 2 files changed, 5 insertions(+), 17 deletions(-)



[struts] 02/02: WW-2815 Fixes support for Collections and String

2022-10-17 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-2815-xstream
in repository https://gitbox.apache.org/repos/asf/struts.git

commit a562f8f8065223e71777b1931a736c9ac980e913
Author: Lukasz Lenart 
AuthorDate: Mon Oct 17 09:52:07 2022 +0200

WW-2815 Fixes support for Collections and String
---
 .../java/org/apache/struts2/rest/handler/XStreamHandler.java | 4 ++--
 .../java/org/apache/struts2/rest/handler/XStreamHandlerTest.java | 9 +++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
index 70ea810eb..5958ff5c9 100644
--- 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
+++ 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
@@ -107,6 +107,7 @@ public class XStreamHandler extends 
AbstractContentTypeHandler {
 stream.addPermission(new ExplicitTypePermission(new 
Class[]{((ModelDriven) invocation.getAction()).getModel().getClass()}));
 }
 stream.addPermission(NullPermission.NULL);
+stream.addPermission(new ExplicitTypePermission(new 
Class[]{String.class}));
 stream.addPermission(PrimitiveTypePermission.PRIMITIVES);
 stream.addPermission(ArrayTypePermission.ARRAYS);
 stream.addPermission(CollectionTypePermission.COLLECTIONS);
@@ -126,8 +127,7 @@ public class XStreamHandler extends 
AbstractContentTypeHandler {
 
 @Override
 public boolean allows(Class type) {
-return type != null && type.isInterface() &&
-(Collection.class.isAssignableFrom(type) || 
Map.class.isAssignableFrom(type));
+return type != null && (Collection.class.isAssignableFrom(type) || 
Map.class.isAssignableFrom(type));
 }
 
 }
diff --git 
a/plugins/rest/src/test/java/org/apache/struts2/rest/handler/XStreamHandlerTest.java
 
b/plugins/rest/src/test/java/org/apache/struts2/rest/handler/XStreamHandlerTest.java
index 3510634ed..732643bdc 100644
--- 
a/plugins/rest/src/test/java/org/apache/struts2/rest/handler/XStreamHandlerTest.java
+++ 
b/plugins/rest/src/test/java/org/apache/struts2/rest/handler/XStreamHandlerTest.java
@@ -38,6 +38,7 @@ import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Locale;
@@ -135,16 +136,12 @@ public class XStreamHandlerTest extends XWorkTestCase {
 
 @Override
 public Set allowedClassNames() {
-HashSet strings = new HashSet<>();
-strings.add(ArrayList.class.getName());
-return strings;
+return Collections.emptySet();
 }
 
 @Override
 public Collection getTypePermissions() {
-ArrayList permissions = new ArrayList<>();
-permissions.add(new ExplicitTypePermission(new 
Class[]{String.class}));
-return permissions;
+return Collections.emptyList();
 }
 }
 



[struts] 01/02: WW-2815 Drops deprecated API

2022-10-17 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-2815-xstream
in repository https://gitbox.apache.org/repos/asf/struts.git

commit ac13c32bdb9fc5a16fe9b1e0fb1d2769a13f0740
Author: Lukasz Lenart 
AuthorDate: Mon Oct 17 09:47:37 2022 +0200

WW-2815 Drops deprecated API
---
 .../java/org/apache/struts2/rest/handler/XStreamHandler.java | 9 -
 1 file changed, 9 deletions(-)

diff --git 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
index d3534e32b..70ea810eb 100644
--- 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
+++ 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
@@ -62,15 +62,6 @@ public class XStreamHandler extends 
AbstractContentTypeHandler {
 xstream.fromXML(in, target);
 }
 
-/**
- * @deprecated use version with {@link ActionInvocation}
- */
-@Deprecated
-protected XStream createXStream() {
-LOG.warn("You are using a deprecated API!");
-return new XStream();
-}
-
 protected XStream createXStream(ActionInvocation invocation) {
 XStream stream;
 if (invocation.getAction() instanceof XStreamProvider) {



[struts] branch WW-2815-xstream updated: WW-2815 Drops clearing existing permissions to avoid messing with user provided configuration

2022-10-17 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-2815-xstream
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/WW-2815-xstream by this push:
 new 339c30320 WW-2815 Drops clearing existing permissions to avoid messing 
with user provided configuration
339c30320 is described below

commit 339c30320af03e80c36dd878c53cce0a946865b2
Author: Lukasz Lenart 
AuthorDate: Mon Oct 17 10:14:51 2022 +0200

WW-2815 Drops clearing existing permissions to avoid messing with user 
provided configuration
---
 .../src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java  | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
index 5958ff5c9..d4d40221d 100644
--- 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
+++ 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
@@ -72,9 +72,6 @@ public class XStreamHandler extends 
AbstractContentTypeHandler {
 stream = new XStream(new StaxDriver());
 }
 
-LOG.debug("Clears existing permissions");
-stream.addPermission(NoTypePermission.NONE);
-
 LOG.debug("Adds per action permissions");
 addPerActionPermission(invocation, stream);
 



[struts] branch WW-2815-xstream updated: WW-2815 Drops unused import

2022-10-17 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-2815-xstream
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/WW-2815-xstream by this push:
 new 802afb0cc WW-2815 Drops unused import
802afb0cc is described below

commit 802afb0cc0df878a55584a9a5dc9d0f61bbfd1f0
Author: Lukasz Lenart 
AuthorDate: Mon Oct 17 10:55:46 2022 +0200

WW-2815 Drops unused import
---
 .../src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java| 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
index d4d40221d..13831093f 100644
--- 
a/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
+++ 
b/plugins/rest/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java
@@ -24,7 +24,6 @@ import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.io.xml.StaxDriver;
 import com.thoughtworks.xstream.security.ArrayTypePermission;
 import com.thoughtworks.xstream.security.ExplicitTypePermission;
-import com.thoughtworks.xstream.security.NoTypePermission;
 import com.thoughtworks.xstream.security.NullPermission;
 import com.thoughtworks.xstream.security.PrimitiveTypePermission;
 import com.thoughtworks.xstream.security.TypePermission;