I'm reading in an Excel file and trying to output test exactly as shown in Excel, i.e. the Display text rather than the underlying raw value.
For this purpose I'm using the DataFormatter as follows:
DataFormatter formatter = new DataFormatter();
String displayValue = formatter.formatCellValue(cell);
The problem is, the displayValue I get for this one Spreadsheet changes based on whether I run the POI code inside Tomcat or not. Outside Tomcat (in a UnitTest), the displayed text is: "29-Apr-21" When run inside my Tomcat Webapp, the value extracted is "29-Apr.-21"
I can see in the
org.apache.poi.ss.usermodel.DataFormatter
object, there's a member variable called 'dateSymbols' of type java.text.DateFormatSymbols
This has a member array 'shortMonths' where the abbreviated months have periods in the Tomcat case, but not when run in the UnitTest.
My first suspicion was that there was some environmental Locale differences, but in BOTH cases the formatter.locale = "en_AU" . What other environmental differences could lead to the use of different month abbreviations?