[jira] [Resolved] (MATH-1395) MathParseException when parsing fractions on Android

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Resolved] (MATH-1395) MathParseException when parsing fractions on Android

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Sadowski resolved MATH-1395.
    Fix Version/s:     (was: 4.0)
       Resolution: Cannot Reproduce

Class {{Fraction}} was removed.
Fraction functionality is now developed in ["Commons Numbers"|https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-fraction].

> MathParseException when parsing fractions on Android
> ----------------------------------------------------
>                 Key: MATH-1395
>                 URL: https://issues.apache.org/jira/browse/MATH-1395
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Brian Zable
>            Priority: Major
> I'm seeing a strange issue when trying to work with the Fraction classes on Android. In my tests, which are standard JUnit tests, the following code performs flawlessly;
> {code:java}
> String amount = "1 1/2";
> ProperFractionFormat ff = new ProperFractionFormat();
> Fraction f = ff.parse(amount.trim());
> {code}
> However, at run time in an Android application, the same code throws an Exception:
> {noformat}
>                    Caused by: org.apache.commons.math3.exception.MathParseException: illegal state: string "1 1/2" unparseable (from position 3) as an object of type org.apache.commons.math3.fraction.Fraction
>                       at org.apache.commons.math3.fraction.FractionFormat.parse(FractionFormat.java:199)
> {noformat}
> I am testing on a Nexus 5X emulator with API level 23 for reference.

This message was sent by Atlassian Jira