https://bugs.documentfoundation.org/show_bug.cgi?id=161007

Julien Nabet <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected],
                   |                            |[email protected]

--- Comment #7 from Julien Nabet <[email protected]> ---
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I noticed these on console:
warn:bridges:27028:27028:bridges/source/jni_uno/jni_base.h:105: unexpected java
exception occurred
Exception in thread "Thread-7"
warn:bridges:27028:27028:bridges/source/jni_uno/jni_java2uno.cxx:553: Java
calling UNO method getPropertyValue: error examining java exception object!
warn:toolkit:27028:27028:toolkit/source/helper/listenermultiplexer.cxx:128:
ActionListenerMultiplexer::actionPerformed: caught an exception!
com.sun.star.uno.RuntimeException message: "[jni_uno bridge error] Java calling
UNO method getPropertyValue: error examining java exception object!
java stack trace:
com.sun.star.uno.RuntimeException: [jni_uno bridge error] Java calling UNO
method getPropertyValue: error examining java exception object!
        at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
        at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:185)
        at jdk.proxy1/jdk.proxy1.$Proxy13.getPropertyValue(Unknown Source)
        at
com.sun.star.wizards.db.FieldColumn.initializeFormatKeys(FieldColumn.java:154)
        at
com.sun.star.wizards.db.FieldColumn.getFieldType(FieldColumn.java:96)
        at
com.sun.star.wizards.db.FieldColumn.getTyperelatedFieldData(FieldColumn.java:216)
        at
com.sun.star.wizards.db.FieldColumn.initializeFormatKeys(FieldColumn.java:155)
        at
com.sun.star.wizards.db.FieldColumn.getFieldType(FieldColumn.java:96)
        at
com.sun.star.wizards.db.FieldColumn.getTyperelatedFieldData(FieldColumn.java:216)
        at
com.sun.star.wizards.db.FieldColumn.initializeFormatKeys(FieldColumn.java:155)
        at
com.sun.star.wizards.db.FieldColumn.getFieldType(FieldColumn.java:96)
        at
com.sun.star.wizards.db.FieldColumn.getTyperelatedFieldData(FieldColumn.java:216)
        at
com.sun.star.wizards.db.FieldColumn.initializeFormatKeys(FieldColumn.java:155)
        at
com.sun.star.wizards.db.FieldColumn.getFieldType(FieldColumn.java:96)
etc.

In initializeFormatKeys method in FieldColumn.java, LO goes until
155             getTyperelatedFieldData();
(see
https://opengrok.libreoffice.org/xref/core/wizards/com/sun/star/wizards/db/FieldColumn.java?r=510b9557#155)

in getTyperelatedFieldData, we got:
    211     private void getTyperelatedFieldData()
    212     {
    213         int StandardFormatKey = 0;
    214         try
    215         {
    216             switch ( getFieldType() )

so getFieldType() is called, we got there:
     91     public int getFieldType()
     92     {           
     93         if (m_nFieldType == 0)
     94         {
     95             DBMetaData.CommandObject oTable =
m_aCommandMetaData.getTableByName(m_sCommandName);
     96             initializeFormatKeys(m_aCommandMetaData,
oTable.getColumns());
     97         }
     98         return m_nFieldType;
     99     }

but since m_nFieldType is equal to 0, LO goes to the line 96 and we enter a
never ending loop.

m_nFieldType is equal to 0 after Henry's patch but I don't think his patch is
the pb, I rather think it revealed a pb.
Indeed the patch changed by default return value of "getFunctionReturnType"
from DataType::VARCHAR (value 12) to DataType::SQLNULL (value 0)
But, it's just a default value and when giving a try on Gdb, I noticed that
when the function was called with "_sFunctionName" = "AVG", 
LO doesn't go into this line:
else
if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_AVG,pContext)))
nType = DataType::DOUBLE;
(see
https://opengrok.libreoffice.org/xref/core/connectivity/source/parse/sqlnode.cxx?r=aa80eaee#2578)

That's because TokenIDToStr(SQL_TOKEN_AVG,pContext) returns "Average" not
"AVG".
Indeed TokenIDToStr relies on RID_RSC_SQL_INTERNATIONAL
38     NC_("RID_RSC_SQL_INTERNATIONAL", "Average"),
see
https://opengrok.libreoffice.org/xref/core/svx/inc/fmstring.hrc?r=dcea29c2#38

So this change:
diff --git a/svx/inc/fmstring.hrc b/svx/inc/fmstring.hrc
index d630f354b879..4b0c7005f3f0 100644
--- a/svx/inc/fmstring.hrc
+++ b/svx/inc/fmstring.hrc
@@ -35,7 +35,7 @@ const TranslateId RID_RSC_SQL_INTERNATIONAL[] =
     NC_("RID_RSC_SQL_INTERNATIONAL", "BETWEEN"),
     NC_("RID_RSC_SQL_INTERNATIONAL", "OR"),
     NC_("RID_RSC_SQL_INTERNATIONAL", "AND"),
-    NC_("RID_RSC_SQL_INTERNATIONAL", "Average"),
+    NC_("RID_RSC_SQL_INTERNATIONAL", "AVG"),
     NC_("RID_RSC_SQL_INTERNATIONAL", "Count"),
     NC_("RID_RSC_SQL_INTERNATIONAL", "Maximum"),
     NC_("RID_RSC_SQL_INTERNATIONAL", "Minimum"),

allows to return DataType::DOUBLE (value 8) instead of 0 for "AVG" keyword and
the bug can't be reproduced.

Does it seem ok to you?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to