gnodet-bot commented on code in PR #27198:
URL: https://github.com/apache/camel/pull/27198#discussion_r4154429390
##########
core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java:
##########
@@ -138,6 +139,25 @@ protected void startElement(String name) throws
IOException {
}
}
+ @Override
+ protected void doWriteThrowExceptionDefinition(String name,
ThrowExceptionDefinition def) throws IOException {
+ Exception e = def.getException();
+ String type = def.getExceptionClass() != null
+ ? def.getExceptionClass().getName() : e != null ?
e.getClass().getName() : null;
+ if (type == null || def.getExceptionType() != null ||
def.getRef() != null) {
+ super.doWriteThrowExceptionDefinition(name, def);
+ return;
+ }
+ // an exception given as a class or an instance, as in
throwException(new Exception("...")), is
+ // written as its type and message, as the class or instance
itself cannot be
Review Comment:
💡 Comment is truncated mid-sentence — "cannot be" what? Serialized to text?
```suggestion
// an exception given as a class or an instance, as in
throwException(new Exception("...")), is
// written as its type and message, as the class or instance
itself cannot be serialized
```
##########
core/camel-yaml-io/src/main/java/org/apache/camel/yaml/LwModelToYAMLDumper.java:
##########
@@ -137,6 +138,23 @@ protected void doWriteAttribute(JsonObject jo, String key,
String value, String
super.doWriteAttribute(jo, key, value, defaultValue);
}
+ @Override
+ protected JsonObject
doWriteThrowExceptionDefinition(ThrowExceptionDefinition def) {
+ JsonObject jo = super.doWriteThrowExceptionDefinition(def);
+ Exception e = def.getException();
+ String type = def.getExceptionClass() != null
+ ? def.getExceptionClass().getName() : e != null ?
e.getClass().getName() : null;
+ if (type != null && def.getExceptionType() == null &&
def.getRef() == null) {
+ // an exception given as a class or an instance, as in
throwException(new Exception("...")), is
+ // written as its type and message, as the class or
instance itself cannot be
Review Comment:
💡 Same truncated comment here.
```suggestion
// an exception given as a class or an instance, as in
throwException(new Exception("...")), is
// written as its type and message, as the class or
instance itself cannot be serialized
```
--
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]