Enum CurrencySymbolPosition in wrong order
mpxj version : 9.0.0 Impacted file : CurrencySymbolPosition.java
Actually the CurrencySymbolPosition enum is in this order :
AFTER(0), BEFORE(1), AFTER_WITH_SPACE(2), BEFORE_WITH_SPACE(3);
But it has to be in this order :
BEFORE(0), AFTER(1), BEFORE_WITH_SPACE(2), AFTER_WITH_SPACE(3);
There is no impact when exporting to XML file because the DataTypeConverter is ok :
private static final Map<String, CurrencySymbolPosition> MAP_TO_CURRENCY_SYMBOL_POSITION = new HashMap<>(); static { MAP_TO_CURRENCY_SYMBOL_POSITION.put("0", CurrencySymbolPosition.BEFORE); MAP_TO_CURRENCY_SYMBOL_POSITION.put("1", CurrencySymbolPosition.AFTER); MAP_TO_CURRENCY_SYMBOL_POSITION.put("2", CurrencySymbolPosition.BEFORE_WITH_SPACE); MAP_TO_CURRENCY_SYMBOL_POSITION.put("3", CurrencySymbolPosition.AFTER_WITH_SPACE); }
I didn't check if this bug has an impact when importing project.
This is an interesting one. The integer values seen in the enumeration are actually correct for MPX files (which is where the code originated 20+ years ago) and are used directly by the MPX reader/writer code. All the other readers and writers that use CurrencySymbolPosition provide their own mapping, so those should be correct. Let me know if you find any instances where you're getting the wrong value.
There's actually no reason for me to maintain these integer values, they are just an implementation detail for the MPX file handling so I may well remove them and make CurrencySymbolPosition into a straightforward enum. I'll leave this issue open for now to remind me to take a look.