Bug 1103638 - SW Graph Serialization (HTTPInvoker) does not serialize attributes of custom Exception
Summary: SW Graph Serialization (HTTPInvoker) does not serialize attributes of custom ...
Keywords:
Status: MODIFIED
Alias: None
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: DR2
: ---
Assignee: Rob Cernich
QA Contact: Matej Melko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-02 09:06 UTC by vkasala
Modified: 2021-11-08 10:23 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
Simple showcase of Graph serialization. (8.14 KB, application/zip)
2014-06-02 09:06 UTC, vkasala
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SWITCHYARD-2166 0 Major Resolved custom Exception attributes not serialized 2015-11-19 08:35:54 UTC

Description vkasala 2014-06-02 09:06:55 UTC
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.

Comment 1 David Ward 2014-06-02 17:26:48 UTC
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.

Comment 2 David Ward 2014-06-02 17:32:48 UTC
Created linked jboss jira: https://issues.jboss.org/browse/SWITCHYARD-2166

Comment 3 David Ward 2014-06-10 20:09:40 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.