Double value is serialized in 0.0E0 format

Double value is serialized in 0.0E0 format

book

Article ID: KB0084249

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -

Description

In TIBCO BusinessEvents if you use functions such as Instance.serialze() or Instance.serializeusingDefaults() to serialize concept, then concept properties of type double are serialized in "scientific notation". This is because the serialized concept is an XML which has to cover the XML specification W3C ( http://www.w3.org/TR/xmlschema-2/#double).

 

Environment

BusinessEvents 5.x All Operating Systems

Resolution

When printing the value using "<cpname>.<property>" it prints the "normal" numeric value.

------sample BE code -----
    Concepts.Account acc  =    Concepts.Account.Account(
            request.AccountId         /*extId String */,
            request.Balance           /*Balance double */,
            0                         /*Debits double */,
            "Normal"                  /*Status String */,
            request.AvgMonthlyBalance /*AvgMonthlyBalance double */);
        System.debugOut("#### Created account " + acc@extId);
        System.debugOut("#### serializeUsingDefaults account "  + Instance.serializeUsingDefaults(acc));
        System.debugOut("#### Created account with Balance  " + acc.Balance);
        System.debugOut("#### Created account with AvgMonthlyBalance  " + acc.AvgMonthlyBalance);

------BE Logs --------
Info [HTTP-NIO-Worker-1-1] - [user] [din] #### Created account Bob
Inf Info [HTTP-NIO-Worker-1-1] - [user] [din] #### serializeUsingDefaults account <?xml version="1.0" encoding="UTF-8"?>

<ns0:Account xmlns:ns0="www.tibco.com/be/ontology/Concepts/Account" Id="5" extId="Bob" type="www.tibco.com/be/ontology/Concepts/Account">
    <Balance>2.0E4</Balance>
    <Debits>0.0E0</Debits>
    <Status>Normal</Status>
    <AvgMonthlyBalance>1.1E4</AvgMonthlyBalance>
</ns0:Account>
Info [HTTP-NIO-Worker-1-1] - [user] [din] #### Created account with Balance  20000.0
Info [HTTP-NIO-Worker-1-1] - [user] [din] #### Created account with AvgMonthlyBalance  11000.0

Issue/Introduction

Double value is serialized in 0.0E0 format.