Uploaded image for project: 'MyCoRe'
  1. MCR-1246

MCRMetaNumber depends on Locale of runtime environment being "de"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 2016.02
    • Fix Version/s: 2016.06.0
    • Component/s: mycore-base
    • Labels:
      None

      Description

      Current code only work if Locale is "de"
      internal representation should be independent of locale of the running system
      code now:

          public final String getNumberAsString() {
              final NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.getDefault()); //depends on runtime environment
              numberFormat.setGroupingUsed(false);
              numberFormat.setMaximumFractionDigits(FRACTION_DIGITS);
              numberFormat.setMinimumFractionDigits(FRACTION_DIGITS);
              return  numberFormat.format(number);
          }
      

      should be like this:

          public final String getNumberAsString() {
              final NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.ROOT); //does not depend on runtime environment
              numberFormat.setGroupingUsed(false);
              numberFormat.setMaximumFractionDigits(FRACTION_DIGITS);
              numberFormat.setMinimumFractionDigits(FRACTION_DIGITS);
              return  numberFormat.format(number);
          }
      

      as the result of getNumberAsString() is used for internal XML representation of the number. This format should be independent of the runtime environment so that data can be handled in different environments.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                mcrjkupf Jens Kupferschmidt
                Reporter:
                yagee Thomas Scheffler
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: