Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum CurrencySymbolPosition in wrong order #213

Open
boundemars opened this issue Mar 10, 2021 · 1 comment
Open

Enum CurrencySymbolPosition in wrong order #213

boundemars opened this issue Mar 10, 2021 · 1 comment

Comments

@boundemars
Copy link

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.

@joniles
Copy link
Owner

joniles commented Mar 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants