Kaydet (Commit) 535d4e6d authored tarafından Julien Nabet's avatar Julien Nabet

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: 's avatarLionel Elie Mamane <lionel@mamane.lu>
üst 78971bf2
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment