Skip to content

$formatNumber: invalid picture patterns leak raw java.lang.IllegalArgumentException / miss validation (jsonata 2.2.1) #437

Description

@wnm3

Surfaced while comparing JSONata4Java against the jsonata-js 2.2.1 test corpus during the Jackson 3 migration (#430 / PR #431). These are pre-existing functional-compatibility gaps vs the reference implementation (try.jsonata.org 2.2.1), not regressions introduced by the migration.

$formatNumber mishandles several invalid/edge picture strings — either leaking a raw java.lang.IllegalArgumentException (rather than a JSONata EvaluateException) or producing output the reference rejects.

Expression JSONata4Java jsonata.org 2.2.1
$formatNumber(42, "%%") raw java.lang.IllegalArgumentException: Too many percent/per mille characters error (well-formed JSONata error)
$formatNumber(42, "‰‰") raw java.lang.IllegalArgumentException: Too many percent/per mille characters error
$formatNumber(42, "%‰") raw java.lang.IllegalArgumentException: Too many percent/per mille characters error
$formatNumber(42, "---") returns "---42" error (invalid picture)

Expected: these should raise a proper JSONata EvaluateException (D3080-class picture-string error) rather than leaking an internal Java exception or silently accepting an invalid picture.

Reference: jsonata-js 2.2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions