From b2b5b48e776559e9d99b82b84042ecc951730798 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 16 Mar 2022 17:55:33 +0100 Subject: [PATCH] Fix XStreamUnmarshallingTests This commit adds an explicit type permission to unmarshall the `Trade` class. --- .../batch/item/xml/XStreamUnmarshallingTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java index 90b4e2a3b..0b76b1005 100644 --- a/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java +++ b/spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/xml/XStreamUnmarshallingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2014 the original author or authors. + * Copyright 2010-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; +import com.thoughtworks.xstream.security.ExplicitTypePermission; + import org.springframework.batch.item.xml.domain.Trade; import org.springframework.oxm.Unmarshaller; import org.springframework.oxm.xstream.XStreamMarshaller; @@ -38,6 +40,7 @@ public class XStreamUnmarshallingTests extends AbstractStaxEventReaderItemReader unmarshaller.addAlias("customer", String.class); unmarshaller.addAlias("price", BigDecimal.class);*/ unmarshaller.setAliases(aliasesMap); + unmarshaller.setTypePermissions(new ExplicitTypePermission(new Class[]{org.springframework.batch.item.xml.domain.Trade.class})); return unmarshaller; }