Fix XStreamUnmarshallingTests

This commit adds an explicit type permission to unmarshall
the `Trade` class.
This commit is contained in:
Mahmoud Ben Hassine
2022-03-16 17:55:33 +01:00
parent 300baf8df5
commit b2b5b48e77

View File

@@ -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;
}