private volatile TimeZoneFormat tzFormat;
/**
- * BreakIterator to use for capitalization
+ * BreakIterator to use for capitalization (will be cloned for actual use)
*/
private transient BreakIterator capitalizationBrkIter = null;
// should only happen when deserializing, etc.
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
+ // Note, the call to UCharacter.toTitleCase below is the only place that
+ // (the clone of) capitalizationBrkIter is actually used.
+ BreakIterator mutableCapitalizationBrkIter = (BreakIterator)capitalizationBrkIter.clone();
String firstField = buf.substring(bufstart); // bufstart or beginOffset, should be the same
- String firstFieldTitleCase = UCharacter.toTitleCase(locale, firstField, capitalizationBrkIter,
+ String firstFieldTitleCase = UCharacter.toTitleCase(locale, firstField, mutableCapitalizationBrkIter,
UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT);
buf.replace(bufstart, buf.length(), firstFieldTitleCase);
}