Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-433

BigDecimalValidator does not validate "()" negative currency uniformly for all locales

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Not A Bug
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: Routines
    • Labels:
      None
    • Environment:

      Windows 10, Tomcat 6, Java 8

      Description

      Hi,

      The following tests fail:

      final String JAPAN_YEN = (new DecimalFormatSymbols(Locale.JAPAN)).getCurrencySymbol();
      final String CHINA_YEN = (new DecimalFormatSymbols(Locale.CHINA)).getCurrencySymbol();

      BigDecimal negative = new BigDecimal("-1234.56");

      assertEquals("Japan negative", negative, validator.validate("(" + JAPAN_YEN + "1,234.56)", Locale.CHINA));
      assertEquals("China negative", negative, validator.validate("(" + CHINA_YEN + "1,234.56)", Locale.CHINA));

      Please not that this test do not fail for other locales (US AND UK, for example).

      Please advise on whether this is an issue, if there is a workaround, etc...

      Regards,
      John DiPirro

        Attachments

        1. screenshot-1.png
          33 kB
          John DiPirro
        2. junitResults.jpg
          85 kB
          John DiPirro
        3. CurrencyValidatorTest.java
          8 kB
          John DiPirro

          Activity

            People

            • Assignee:
              kinow Bruno P. Kinoshita
              Reporter:
              jjdipirro John DiPirro
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: