IBM Support

RS03638: REST API USING JSON SERIALIZE NULL VALUES IN RESPONSE WHEN FIELDS ARE DECORATED WITH @XMLELEMENT ANNOTATION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When an attribute decorated with @XmlElement is null, the value
    is printed as null in the json result returned by HTDS
    execution.
    This behavior has changed since
    8.9.2.
    
    Example:
    @XmlAccessorType(XmlAccessType.FIELD)
     public
    class Person {
     @XmlElement
     private String name;
     @XmlElement
    
    private Date age;
    
     public String getName() {
     return
    this.name;
     }
    
     public void setName(String name) {
     this.name =
    name;
     }
    
     public Date getAge() {
     return this.age;
     }
    
     public
    void setAge(Date age) {
     this.age = age;
     }
     }
    
    If the age
    field is set to a value, and name field is null:
    => until 8.8.1
    you got :
    {"age":"2020-06-24T16:23:16.810+0000"}
    
    => after
    8.8.1 you got:
    {"name": null,
    "age":"2020-06-24T16:23:16.810+0000"}
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Users using htds with fields decorated with @xmlElement      *
    * annotation                                                   *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * When an attribute decorated with @XmlElement is null, the    *
    * value is printed as null in the json result returned by HTDS *
    * execution.                                                   *
    * This behavior has changed since 8.9.2 with the ugrade of the *
    * JAXB library used for transforming object to JSON.           *
    *                                                              *
    *                                                              *
    *                                                              *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    

Problem conclusion

  • Note that by default the fix changes HTDS behavior and restore
    the 8.8.1 result format
    Example:
    
    After the fix
    {"age":"2020-06-24T16:23:16.810+0000"}
    
    Before the fix
    {"name": null, "age":"2020-06-24T16:23:16.810+0000"}
    
    A property has been added in HTDS application web.xml to restore
    the behavior if needed. set the value of
    forceSerializationOfNullFieldsDecoratedWithJAXBAnnotations
    property to true to restore the previous behavior.
    
    
     <context-param>
    
    <param-name>forceSerializationOfNullFieldsDecoratedWithJAXBAnnot
    ations</param-name>
            <param-value>false</param-value>
        </context-param>
    

Temporary fix

Comments

APAR Information

  • APAR number

    RS03638

  • Reported component name

    WDS FOR RULES

  • Reported component ID

    5725B6903

  • Reported release

    8A0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-06-25

  • Closed date

    2020-07-02

  • Last modified date

    2020-07-17

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WDS FOR RULES

  • Fixed component ID

    5725B6903

Applicable component levels

  • R8A0 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSQP76","label":"IBM Operational Decision Manager"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8A0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 February 2022