From 9ca85f8e43835a10f9a53a8d0509bb9538e8744d Mon Sep 17 00:00:00 2001 From: Tony CHEMIT Date: Mon, 27 Nov 2023 18:23:10 +0100 Subject: [PATCH] Issue 173 (#174) * fix maven configuration (test resources) * Fix NPe in tests - Closes #173 --- pom.xml | 8 ++++++++ src/com/esotericsoftware/yamlbeans/YamlReader.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76c4e53..1316c92 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,14 @@ src test target/classes + + + test + + **/*.yml + + + maven-compiler-plugin diff --git a/src/com/esotericsoftware/yamlbeans/YamlReader.java b/src/com/esotericsoftware/yamlbeans/YamlReader.java index f247cb6..6c510d8 100644 --- a/src/com/esotericsoftware/yamlbeans/YamlReader.java +++ b/src/com/esotericsoftware/yamlbeans/YamlReader.java @@ -190,7 +190,7 @@ private Class chooseType (String tag, Class defaultType, Class provided try { Class loadedFromTag = findTagClass(tag, classLoader); if (loadedFromTag != null) { - if (!providedType.isAssignableFrom(loadedFromTag)) { + if (providedType != null && !providedType.isAssignableFrom(loadedFromTag)) { throw new YamlReaderException("Class specified by tag is incompatible with expected type: " + loadedFromTag.getName() + " (expected " + providedType.getName() + ")"); }