Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Out of range for a int when record.toMap() called

    SmartClient Version: v8.2p_2012-05-24/PowerEdition Deployment (built 2012-05-24)
    Firefox 7

    The following message is coming back when calling record.toMap(): invoke arguments: JS double value -9.589061106728952E15 out of range for a int

    The field is declared as a bigint in a postgres database, and in the datasource has the field as a long.

    I can call record.getAtrributeAsDouble/Long/Float("messedUpField") with no problem, however a call to ...asInt() as expected, gives back the same error.

    My question is why does record.toMap() try to put that value as an integer, regardless of what I have in the datasource.xml? I have declared it as long, double, string, and int, and always, the call to .toMap() fails. What can I do to get around this problem?

    Code:
    Record mission = MissionHelper.getCurrentlyActiveMission();
            if (mission != null)
            {
                changeStareForm.setValues(mission.toMap());
                valuesManager.setValues(mission.toMap());
            }
    datasource.xml snippet
    Code:
     <field name="remote_sortie_id" type="double"/>

    #2
    There is a check in the code called by the record.toMap() codepath for values exceeding Integer.MAX_VALUE but a corollary check for values less than MIN_VALUE wasn't present. We've now resolved this, so this issue should go away in the next nightly build (June 12, 3.0p and 3.1d branches).

    (As an aside, the reason the field type wasn't making a difference for you is that record.toMap isn't aware of what dataSource the record came from, so can't look at the field type. There are many other code paths which rely on the dataSource field type but this particular JS -> Java conversion doesn't.)

    Comment

    Working...
    X