gnodet-bot commented on code in PR #28905:
URL: https://github.com/apache/camel/pull/28905#discussion_r4445146431
##########
components/camel-dfdl/src/main/java/org/apache/camel/dataformat/dfdl/DfdlDataFormat.java:
##########
@@ -71,7 +71,7 @@ public void marshal(Exchange exchange, Object graph,
OutputStream stream) throws
W3CDOMInfosetInputter inputter = new
W3CDOMInfosetInputter(xmlDocument);
UnparseResult result = this.daffodilProcessor.unparse(inputter,
Channels.newChannel(stream));
if (result.isError()) {
- exchange.setException(new DfdlUnparseException(result));
+ throw new DfdlUnparseException(result);
}
Review Comment:
✅ Marshal is correctly fixed here to `throw`. But the `unmarshal` method
(line ~84 in this file) still uses `exchange.setException(new
DfdlParseException(result)); return null;` — the same old pattern. This will
cause `testParseErrorHandledKeepsBody` to fail: `UnmarshalProcessor` calls
`out.setBody(null)` when `unmarshal` returns null, destroying the body before
the `onException` handler runs.
```suggestion
throw new DfdlUnparseException(result);
```
Apply the equivalent fix to `unmarshal`:
```java
// At line ~84:
- exchange.setException(new DfdlParseException(result));
- return null;
+ throw new DfdlParseException(result);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]