jscience
  1. jscience
  2. JSCIENCE-146

Currency constructor does not validate String param

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Macintosh

    • Issuezilla Id:
      146

      Description

      The javadoc says that "new Currency(String code)" will validate the code against
      its static currency codes, but this is not the case. The following will run
      without exceptions:

      double value = 1.23;
      String code = "ABC";
      Currency currency = new Currency(code);
      Amount amount = Amount.valueOf(value, currency);

      and amount.toString() produces "1.23 ABC".

      Not sure if it's related, but Currency.valueOf(code) always fails (even on valid
      currency codes eg "USD")

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            jscience-issues
            Reporter:
            oliver_meyn
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: