|
1 | 1 | /*
|
2 |
| - * Copyright 2010-2021 the original author or authors. |
| 2 | + * Copyright 2010-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
19 | 19 | import java.util.HashMap;
|
20 | 20 | import java.util.Map;
|
21 | 21 |
|
22 |
| -import com.thoughtworks.xstream.security.ArrayTypePermission; |
23 | 22 | import com.thoughtworks.xstream.security.ExplicitTypePermission;
|
24 |
| -import com.thoughtworks.xstream.security.WildcardTypePermission; |
25 | 23 |
|
26 | 24 | import org.springframework.batch.item.xml.domain.Trade;
|
27 | 25 | import org.springframework.oxm.Unmarshaller;
|
|
30 | 28 | public class XStreamUnmarshallingTests extends AbstractStaxEventReaderItemReaderTests {
|
31 | 29 |
|
32 | 30 | @Override
|
33 |
| - protected Unmarshaller getUnmarshaller() throws Exception { |
| 31 | + protected Unmarshaller getUnmarshaller() { |
34 | 32 | XStreamMarshaller unmarshaller = new XStreamMarshaller();
|
35 | 33 | Map<String,Class<?>> aliasesMap = new HashMap<>();
|
36 | 34 | aliasesMap.put("trade", Trade.class);
|
37 | 35 | aliasesMap.put("isin", String.class);
|
38 | 36 | aliasesMap.put("customer", String.class);
|
39 | 37 | aliasesMap.put("price", BigDecimal.class);
|
40 |
| - /*unmarshaller.addAlias("trade", Trade.class); |
41 |
| - unmarshaller.addAlias("isin", String.class); |
42 |
| - unmarshaller.addAlias("customer", String.class); |
43 |
| - unmarshaller.addAlias("price", BigDecimal.class);*/ |
44 | 38 | unmarshaller.setAliases(aliasesMap);
|
45 |
| - unmarshaller.setTypePermissions(new ExplicitTypePermission(new String[]{"org.springframework.batch.item.xml.domain.Trade"})); |
| 39 | + ExplicitTypePermission typePermission = new ExplicitTypePermission(new Class[]{Trade.class}); |
| 40 | + unmarshaller.setTypePermissions(typePermission); |
46 | 41 | return unmarshaller;
|
47 | 42 | }
|
48 | 43 |
|
|
0 commit comments