Proguard renaming of TimeUnit classes can lead to MissingResourceException: Can't find resource for bundle org.ocpsoft.prettytime.i18n.Resources, key ePattern
kevinslashslash opened this issue · 3 comments
kevinslashslash commented
The bundled proguard rules only keep org.ocpsoft.prettytime.i18n
but some ResourceBundle classes rely on TimeUnit.getClass().getSimpleName()
which are in org.ocpsoft.prettytime.units
and thus allowed to be renamed by proguard.
For example
Solutions I can think of are
Refactor code to not use TimeUnit.getClass().getSimpleName()
, it looks like ResourcesTimeUnit.getResourceKeyPrefix()
is appropriate but it's not on TimeUnit directly
Update proguard rules to keepnames for org.ocpsoft.prettytime.units
, this is easiest to do but feels less than idea. It also slightly feels like it's covering up a deeper problem.
kevinslashslash commented
Relevant stack trace
java.util.MissingResourceException: Can't find resource for bundle org.ocpsoft.prettytime.i18n.Resources, key ePattern
at java.util.ResourceBundle.getObject(ResourceBundle.java:445)
at java.util.ResourceBundle.getObject(ResourceBundle.java:439)
at java.util.ResourceBundle.getString(ResourceBundle.java:402)
at org.ocpsoft.prettytime.i18n.Resources_de$DeTimeFormat.<init>(Resources_de:141)
at org.ocpsoft.prettytime.i18n.Resources_de.getFormatFor(Resources_de:133)
at org.ocpsoft.prettytime.impl.ResourcesTimeFormat.setLocale(ResourcesTimeFormat:52)
at org.ocpsoft.prettytime.impl.ResourcesTimeFormat.setLocale(ResourcesTimeFormat:15)
at org.ocpsoft.prettytime.PrettyTime.registerUnit(PrettyTime:1473)
at org.ocpsoft.prettytime.PrettyTime.addUnit(PrettyTime:1613)
at org.ocpsoft.prettytime.PrettyTime.initTimeUnits(PrettyTime:1597)
at org.ocpsoft.prettytime.PrettyTime.<init>(PrettyTime:98)
at org.ocpsoft.prettytime.PrettyTime.<init>(PrettyTime:86)
```
Mrjpjay commented
Same issue
lincolnthree commented
Happy to accept a PR for these issues. Thanks!