-
Bug
-
Resolution: Done
-
Major
-
1.0.0.Alpha
-
None
PolicyConfig on Policy is defined as transient, however that is ignored by Jackson (Jackson does not look at the member variables but at the getter/setters instead). So if one serialized a policy to JSON it looks like:
"policies" : [ { "policyJsonConfig" : "{ \"ipList\" : [ \"127.0.0.1\", \"localhost\" ] }", "policyImpl" : "class:org.overlord.apiman.engine.policies.IPWhitelistPolicy", "policyConfig" : { "ipList" : [ "localhost", "127.0.0.1" ] } } ]
Upon deserializion jackson turns the policyConfig into a LinkedHashMap, which leads to:
ERROR | Gateway Internal Error: java.util.LinkedHashMap cannot be cast to org.overlord.apiman.engine.policies.config.IPWhitelistConfig java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to org.overlord.apiman.engine.policies.config.IPWhitelistConfig at org.overlord.apiman.engine.policies.IPWhitelistPolicy.doApply(IPWhitelistPolicy.java:32)[apiman-rt-engine-policies-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT] at org.overlord.apiman.engine.policies.AbstractPolicy.apply(AbstractPolicy.java:64)[apiman-rt-engine-policies-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT] at org.overlord.apiman.rt.engine.policy.PolicyChainImpl.doApply(PolicyChainImpl.java:65)[file:/Users/kstam/osc/jboss/git/apiman/apiman-rt/apiman-rt-engine/apiman-rt-engine-core/target/classes/:] at org.overlord.apiman.rt.engine.impl.EngineImpl.execute(EngineImpl.java:163)[file:/Users/kstam/osc/jboss/git/apiman/apiman-rt/apiman-rt-engine/apiman-rt-engine-core/target/classes/:]
The following annotation should be added to the policyConfig field:
@JsonIgnore