Created attachment 901386 [details] Simple showcase of Graph serialization. Description of problem: Switchyard internal Graph serialization cannot serialize attributes of custom exception inherited from the Exception class and thus HTTPInvoker (RemoteInvoker) is not also able to serialize attributes of our own custom Exception and propagate thrown Exception correctly to client. Component: switchyard-serial Version-Release number of selected component (if applicable): 1.1.1-p5-redhat-1 How reproducible: Steps to Reproduce: 1. Create new custom Exception inherited from Exception. 2. Add new attributes + getters/setters. 3. Create serializer as in HTTPInvoker class : "SerializerFactory.create(FormatType.JSON, null, true);" 4. Try to serialize and then deserialize your custom exception. Actual results: No attributes are serialized/deserialized correctly. Expected results: Attributes should be also serialized/deserialized correctly.
Keith and I looked at this last week. There is logic within the serialization code that specifically handles Throwables. Custom Exceptions are only supported if they contain a zero or one-arg constructor, but beyond that, any custom attributes (setters/getters/fields) will be ignored. So, the custom Exception will be re-constituted on the other side, but those extra attributes will be null. This is because the serialization logic handles Throwables in a specific fashion, before - and instead of - our bean-handling serialization logic (specifically, our AccessNode logic). If this issue gets a fix target, than it should be a relatively straightforward fix.
Created linked jboss jira: https://issues.jboss.org/browse/SWITCHYARD-2166
Pull requests are on the associate jira. I will copy/paste the link + comment here: https://github.com/jboss-switchyard/core/pull/637 Throwables can now have custom attributes that will get ser/deserialized, OOTB. By default, though, they have to either have a no-arg or one-arg (String) constructor. If they don't, then using SwitchYard-specific annotations will have to be employed, using @Strategy(factory=MyCustomFactory.class). In the past, those annotations were ignored for Throwables.