diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2019-03-12 20:03:14 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2019-03-13 07:08:22 +0100 |
commit | 535d4e6dae24973f5bea80643b691c706a3b4efa (patch) | |
tree | 66bbaf21d1851ea81f76c987f65171fd659cdb94 /wizards/com | |
parent | 78971bf2793e8f79b54e220305fe7d44760385bf (diff) |
Fix wizards/NumberFormatter.java
Create a brand new odb file (embedded HSQLDB)
Create a simple table in it
Launch Query wizard, you'll see these on console:
...
at com.sun.proxy.$Proxy69.addNew(Unknown Source)
at com.sun.star.wizards.common.NumberFormatter.defineNumberFormat(NumberFormatter.java:96)
at com.sun.star.wizards.ui.FilterComponent.addNumberFormats(FilterComponent.java:504)
at com.sun.star.wizards.query.QueryWizard.buildSteps(QueryWizard.java:233)
...
...
at com.sun.proxy.$Proxy69.addNew(Unknown Source)
at com.sun.star.wizards.common.NumberFormatter.defineNumberFormat(NumberFormatter.java:96)
at com.sun.star.wizards.ui.FilterComponent.addNumberFormats(FilterComponent.java:506)
at com.sun.star.wizards.query.QueryWizard.buildSteps(QueryWizard.java:233)
...
Root cause is FilterComponent.java uses "YYYY-MM-DD" and "YYYY-MM-DD HH:MM:SS" (lines 504 and 506)
If it's ok for English locales, xNumberFormats.queryKey calls fail at least for French locales.
Use addNewConverted instead of addNew method to take into account the difference of locales
and avoid these stacktraces
Change-Id: I5ef6325b8a213ae6758e378c4d3b8560c117042f
Reviewed-on: https://gerrit.libreoffice.org/69131
Tested-by: Jenkins
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'wizards/com')
-rw-r--r-- | wizards/com/sun/star/wizards/common/NumberFormatter.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index dfbd742aef8e..9a6ca217e6c9 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -48,6 +48,7 @@ public class NumberFormatter private XNumberFormatTypes xNumberFormatTypes; private XPropertySet xNumberFormatSettings; private final Locale aLocale; + static private final Locale enLocale = new Locale( "en", "US", "" ); public NumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception @@ -93,7 +94,7 @@ public class NumberFormatter int NewFormatKey = xNumberFormats.queryKey(_FormatString, aLocale, true); if (NewFormatKey == -1) { - NewFormatKey = xNumberFormats.addNew(_FormatString, aLocale); + NewFormatKey = xNumberFormats.addNewConverted(_FormatString, enLocale, aLocale); } return NewFormatKey; } |