From a208f2930b2b9927c8c48043c18b7886c3b82534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Bakhoff?= Date: Tue, 6 Jun 2017 19:14:01 +0300 Subject: [PATCH] pop unmarshalled type on exception --- .../java/com/thoughtworks/xstream/core/TreeUnmarshaller.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xstream/src/java/com/thoughtworks/xstream/core/TreeUnmarshaller.java b/xstream/src/java/com/thoughtworks/xstream/core/TreeUnmarshaller.java index c30575dd3..12f5ba901 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/TreeUnmarshaller.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/TreeUnmarshaller.java @@ -71,7 +71,6 @@ protected Object convert(final Object parent, final Class type, final Convert try { types.push(type); final Object result = converter.unmarshal(reader, this); - types.popSilently(); return result; } catch (final ConversionException conversionException) { addInformationTo(conversionException, type, converter, parent); @@ -80,6 +79,8 @@ protected Object convert(final Object parent, final Class type, final Convert final ConversionException conversionException = new ConversionException(e); addInformationTo(conversionException, type, converter, parent); throw conversionException; + } finally { + types.popSilently(); } }