pjfanning opened a new pull request, #1376: URL: https://github.com/apache/poi/pull/1376
SpotBugs flags these public `static synchronized` methods (US_OBJECT): any other code that synchronizes on the class can block them. - **`CellFormat.getInstance(Locale, String)`**: the cache is a `WeakHashMap`, so it still needs a lock, but now a private one. The format string is parsed outside the lock, so threads formatting cells no longer queue behind each other while a new format is parsed. If two threads parse the same new format at the same time, the first one to finish is cached. The javadoc already says two calls "may or may not return the same object". - **`PropertyIDMap.getSummaryInformationProperties()` / `getDocumentSummaryInformationProperties()` / `getFallbackProperties()`**: now lazy holder classes. These run for every property set that is read, and now take no lock at all. - **`HSSFColor.getIndexHash()`** and the private `mapEnumToColorClass()`: use a private lock. Most of that diff is re-indentation; view it with whitespace hidden. `StaticFontMetrics.getFontDetails` was flagged too, but the class is package-private and `final`, so outside code can't lock on it. I left it alone. Tests: the `ss.format` and `hpsf` packages, `TestHSSFColor`, `TestHSSFPalette` and `TestDataFormatter` all pass (253 tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
