We're updating the issue view to help you get more done. 

DecimalFormatSymbols.setPatternForCurrencySpacing affects the value across instances

Description

Apparently, DecimalFormatSymbols.setPatternForCurrencySpacing affects the value across instances.

In the code, the value are stored in the array return from CurrencyData.getBeforeSymbols(), and the same instance is shared across DecimalFormatSymbols instance.

1 2 3 4 5 6 public class DecimalFormatSymbols { private void initSpacingInfo(CurrencySpacingInfo spcInfo) { currencySpcBeforeSym = spcInfo.getBeforeSymbols(); currencySpcAfterSym = spcInfo.getAfterSymbols(); } }
1 2 3 4 5 public class CurrencyData { public String[] getBeforeSymbols() { return symbols[SpacingType.BEFORE.ordinal()]; } }

I am not sure if the String[] or CurrencySpacingInfo should be cloned. Attach a code patch to clone String[].

The following bug has more details.
Bug: 116850744

Environment

Status

Assignee

Victor Chang

Reporter

Victor Chang

Time Needed

Hours

Reviewer

Shane Carr

Components

Fix versions

Priority

medium