wizards/com/sun/star/wizards/common/NumberFormatter.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 535d4e6dae24973f5bea80643b691c706a3b4efa
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Tue Mar 12 20:03:14 2019 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Wed Mar 13 07:08:22 2019 +0100

    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 <lio...@mamane.lu>

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;
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to