Skip to content

<ft_us>2 not parseable; <ft_us>^2 is parsable #446

@seanmreidy

Description

@seanmreidy

Hello,

I am using the SimpleUnitFormat class using the ASCII flavor. Using the parse method, I get an error when trying to do an exponent operation that should be allowed using the UCUM standard - <ft_us>2. "The exponent is an integer number and is written immediately behind the unit term."

Here's the stack trace I get:

javax.measure.format.MeasurementParseException: unexpected token INTEGER
        at app//tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parseProductUnit(SimpleUnitFormat.java:778)
        at app//tech.units.indriya.format.SimpleUnitFormat.parseObject(SimpleUnitFormat.java:332)
        at app//tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:1028)
        at app//tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:1023)
        at app//tech.units.indriya.format.SimpleUnitFormat$DefaultFormat.parse(SimpleUnitFormat.java:1019)

However, '<ft_us>^2' does work.

Can you let us know if the standard UCUM exponent format is supported, or if the above error is expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions