Unwrap XMLStreamException from cause

Closes: gh-24622
This commit is contained in:
Rossen Stoyanchev
2020-03-23 12:21:33 +00:00
parent 623a019ef8
commit e11373fe69
2 changed files with 39 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -197,6 +197,10 @@ public class Jaxb2XmlDecoder extends AbstractDecoder<Object> {
catch (XMLStreamException ex) {
throw Exceptions.propagate(ex);
}
catch (Throwable ex) {
ex = (ex.getCause() instanceof XMLStreamException ? ex.getCause() : ex);
throw Exceptions.propagate(ex);
}
finally {
DataBufferUtils.release(dataBuffer);
}