Skip to content

Commit 6b979d0

Browse files
committed
CAMEL-10575: snakeyaml: add an option to filter classes the yaml parser can construct
1 parent 65a56ad commit 6b979d0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

components/camel-snakeyaml/src/main/java/org/apache/camel/component/snakeyaml/SnakeYAMLDataFormat.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
* A <a href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
5252
* using <a href="http://www.snakeyaml.org">SnakeYAML</a> to marshal to and from YAML.
5353
*/
54-
public final class SnakeYAMLDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
54+
public class SnakeYAMLDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
5555
private final ThreadLocal<WeakReference<Yaml>> yamlCache;
5656
private BaseConstructor constructor;
5757
private Representer representer;
@@ -77,7 +77,9 @@ public SnakeYAMLDataFormat(Class<?> type) {
7777
this.allowAnyType = false;
7878

7979
if (type != null) {
80-
setUnmarshalType(type);
80+
this.unmarshalType = type;
81+
this.typeFilters = new CopyOnWriteArrayList<>();
82+
this.typeFilters.add(TypeFilters.types(type));
8183
}
8284
}
8385

0 commit comments

Comments
 (0)