Type of CommandType (short or long) ?

Julien Nabet serval2412 at yahoo.fr
Mon Apr 26 09:20:29 UTC 2021


Hello Lionel,

On pc Debian x86-64 with master sources updated today, after these steps:

- Open Writer

- Tools/Bibliography Database

- Close Bibliography database

I noticed this log repeated 3 times.

warn:unotools.config:30371:30371:unotools/source/config/configitem.cxx:487: 
Exception from PutProperties com.sun.star.lang.IllegalArgumentException 
message: configmgr inappropriate property value 
/home/julien/lo/libreoffice/configmgr/source/access.cxx:1497 
ArgumentPosition: -1

Taking a look at utl::ConfigItem::PutProperties, here what I got:

(gdb) p rNames
$54 = uno::Sequence of length 8 = {"CurrentDataSource/DataSourceName", 
"CurrentDataSource/Command", "CurrentDataSource/CommandType", 
"BeamerHeight", "ViewHeight", "QueryText", "QueryField",
   "ShowColumnAssignmentWarning"}
(gdb) p rValues
$55 = uno::Sequence of length 8 = {uno::Any("string": "Bibliography"), 
uno::Any("string": "biblio"), uno::Any("long": 0), uno::Any("hyper": 0), 
uno::Any("hyper": 0), uno::Any("string": ""),
   uno::Any("string": "Identifier"), uno::Any("boolean": 1 '\001')}

Then for:

#3  0x00007f49e39db589 in configmgr::Access::replaceByName 
(this=0x77282a0, aName="CommandType", aElement=uno::Any("long": 0)) at 
configmgr/source/access.cxx:1068
1068                child->setProperty(aElement, &localMods);

I saw that the throw was during:

#1  0x00007f49e39dd4b5 in configmgr::Access::checkValue (this=0xb86d9a0, 
value=uno::Any("long": 0), type=configmgr::TYPE_SHORT, nillable=true) at 
configmgr/source/access.cxx:1497
1497            throw css::lang::IllegalArgumentException(

git grepping about "CommandType", most of the times it's considered as long:

include/svx/dataaccessdescriptor.hxx:46: CommandType,          /// 
command type                (long)
offapi/com/sun/star/chart2/data/XDatabaseDataProvider.idl:131: 
[attribute,bound] long CommandType;
offapi/com/sun/star/document/Settings.idl:147:    [optional, property] 
long CurrentDatabaseCommandType;
offapi/com/sun/star/report/XReportDefinition.idl:192: [attribute,bound] 
long CommandType;
offapi/com/sun/star/sdb/DataAccessDescriptor.idl:123: [optional, 
property] long CommandType;
offapi/com/sun/star/sdb/RowSet.idl:301:    [property] long CommandType;
offapi/com/sun/star/sdb/XSingleSelectQueryAnalyzer.idl:218: void 
setCommand([in] string Command ,[in] long CommandType)
offapi/com/sun/star/sdb/application/DatabaseObject.idl:43: const long 
TABLE = com::sun::star::sdb::CommandType::TABLE;
offapi/com/sun/star/sdb/application/DatabaseObject.idl:47: const long 
QUERY = com::sun::star::sdb::CommandType::QUERY;
offapi/com/sun/star/sdb/tools/XObjectNames.idl:85:    string 
suggestName( [in] long CommandType, [in] string BaseName )
offapi/com/sun/star/sdb/tools/XObjectNames.idl:126:    boolean 
isNameUsed( [in] long CommandType, [in] string Name )
offapi/com/sun/star/sdb/tools/XObjectNames.idl:140:    boolean 
isNameValid( [in] long CommandType, [in] string Name )
offapi/com/sun/star/sdb/tools/XObjectNames.idl:156:    void 
checkNameForCreate( [in] long CommandType, [in] string Name )
offapi/com/sun/star/text/MailMerge.idl:95:    [property] long CommandType;
offapi/com/sun/star/text/fieldmaster/Database.idl:48: [property] long 
CommandType;
offapi/type_reference/offapi.idl:4809:     [property, optional] long 
CurrentDatabaseCommandType;
offapi/type_reference/offapi.idl:7008:     [property] long CommandType;
offapi/type_reference/offapi.idl:10050:     [property, optional] long 
CommandType;
offapi/type_reference/offapi.idl:14422:     [property] long CommandType;
offapi/type_reference/offapi.idl:15326:      [property] long CommandType;
oovbaapi/ooo/vba/powerpoint/MsoAnimCommandType.idl:22: const long 
msoAnimCommandTypeCall = 1;
oovbaapi/ooo/vba/powerpoint/MsoAnimCommandType.idl:23: const long 
msoAnimCommandTypeEvent = 0;
oovbaapi/ooo/vba/powerpoint/MsoAnimCommandType.idl:24: const long 
msoAnimCommandTypeVerb = 2;
test/source/text/textsettings.cxx:129: 
testLongOptionalProperty(xSettings, "CurrentDatabaseCommandType");
wizards/source/access2base/DataDef.xba:364:Dim lCommandType As Long, 
sCommand As String, oObject As Object,bPassThrough As Boolean
wizards/source/access2base/Database.xba:588:Dim lCommandType As Long, 
sCommand As String, oObject As Object
wizards/source/access2base/Recordset.xba:29:Private _CommandType        
     As Long
wizards/source/sfdocuments/SF_Calc.xba:1198:Dim lCommandType As Long    
     '    A com.sun.star.sheet.DataImportMode.xxx constant

but sometimes CommandType is considered as a short:

git grep -n CommandType|grep -v DataCommandType|grep -i short
extras/source/autotext/lang/de/crdbus50/KLA1/settings.xml:28: 
<config:config-item config:name="CurrentDatabaseCommandType" 
config:type="short">0</config:config-item>
extras/source/autotext/lang/de/crdbus50/KLA2/settings.xml:28: 
<config:config-item config:name="CurrentDatabaseCommandType" 
config:type="short">0</config:config-item>
extras/source/autotext/lang/de/crdbus50/KLA3/settings.xml:28: 
<config:config-item config:name="CurrentDatabaseCommandType" 
config:type="short">0</config:config-item>
extras/source/autotext/lang/de/crdbus50/MOD1/settings.xml:28: 
<config:config-item config:name="CurrentDatabaseCommandType" 
config:type="short">0</config:config-item>
extras/source/autotext/lang/de/crdbus50/MOD2/settings.xml:28: 
<config:config-item config:name="CurrentDatabaseCommandType" 
config:type="short">0</config:config-item>
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs:70: <prop 
oor:name="CommandType" oor:type="xs:short">
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs:279: 
<prop oor:name="CommandType" oor:type="xs:short">
officecfg/registry/schema/org/openoffice/Office/Writer.xcs:257: <prop 
oor:name="CommandType" oor:type="xs:short">
sw/source/core/doc/docfld.cxx:577:    aNewDBData.nCommandType = 
static_cast<short>(rNewName.getToken(0, DB_DELIM, nIdx).toInt32());
sw/source/core/unocore/unofield.cxx:1672: aData.nCommandType = 
m_pImpl->m_pProps->nSHORT1;
sw/source/core/unocore/unofield.cxx:1687: aData.nCommandType = 
m_pImpl->m_pProps->nSHORT1;
sw/source/core/unocore/unofield.cxx:1698: aData.nCommandType = 
m_pImpl->m_pProps->nSHORT1;
sw/source/core/unocore/unofield.cxx:1711: aData.nCommandType = 
m_pImpl->m_pProps->nSHORT1;
sw/source/uibase/dbui/mmconfigitem.cxx:520:            case 26 
:pValues[nProp] <<= static_cast<short>(m_aDBData.nCommandType);   break;

I tried this patch:

diff --git 
a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs 
b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
index e2591ee34aea..352fc9aca406 100644
--- a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
@@ -67,7 +67,7 @@
            <desc>Specifies the command to execute on the data source to 
retrieve the result set. This may be an SQL command or a table name or a 
query name.</desc>
          </info>
        </prop>
-      <prop oor:name="CommandType" oor:type="xs:short">
+      <prop oor:name="CommandType" oor:type="xs:long">
          <info>
            <desc>Determines the exact meaning of Command. Valid values 
are: 0 - Command is a table name 1 - Command is a query name 2 - Command 
is an SQL command.</desc>
          </info>
@@ -276,7 +276,7 @@
          <value/>
          <!-- JB: Empty default inserted into empty property node. 
Remove if NIL was intended -->
        </prop>
-      <prop oor:name="CommandType" oor:type="xs:short">
+      <prop oor:name="CommandType" oor:type="xs:long">
          <info>
            <desc>Determines the exact meaning of Command. Valid values 
are: 0 - Command is a table name 1 - Command is a query name 2 - Command 
is an SQL command.</desc>
          </info>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 1d54ace2d950..054393b89937 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -254,7 +254,7 @@
            <desc>Specifies the name of the database table or query.</desc>
          </info>
        </prop>
-      <prop oor:name="CommandType" oor:type="xs:short">
+      <prop oor:name="CommandType" oor:type="xs:long">
          <info>
            <desc>Specifies whether the data comes from a table or a 
query</desc>
          </info>

and now it seems to work.

and this additional patch builds:

diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 6829089fbb52..74483926e90e 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -574,7 +574,7 @@ void SwDoc::ChangeDBFields( const 
std::vector<OUString>& rOldNames,
      sal_Int32 nIdx{ 0 };
      aNewDBData.sDataSource = rNewName.getToken(0, DB_DELIM, nIdx);
      aNewDBData.sCommand = rNewName.getToken(0, DB_DELIM, nIdx);
-    aNewDBData.nCommandType = static_cast<short>(rNewName.getToken(0, 
DB_DELIM, nIdx).toInt32());
+    aNewDBData.nCommandType = rNewName.getToken(0, DB_DELIM, 
nIdx).toInt32();

      SwSectionFormats& rArr = GetSections();
      for (auto n = rArr.size(); n; )
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx 
b/sw/source/uibase/dbui/mmconfigitem.cxx
index 969ca4976d36..26462bccf41a 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -517,7 +517,7 @@ void  SwMailMergeConfigItem_Impl::ImplCommit()
              case 23: pValues[nProp] <<= m_sMailPassword;        break;
              case 24 :pValues[nProp] <<= 
m_aDBData.sDataSource;           break;
              case 25 :pValues[nProp] <<= 
m_aDBData.sCommand;              break;
-            case 26 :pValues[nProp] <<= 
static_cast<short>(m_aDBData.nCommandType);   break;
+            case 26 :pValues[nProp] <<= m_aDBData.nCommandType;   break;
              case 27 :pValues[nProp] <<= m_sFilter; break;
              case 28 :pValues[nProp] <<= m_aSavedDocuments; break;
              case 29: pValues[nProp] <<= m_bIsEMailSupported; break;

(perhaps replacing "short" by "long" in "extras" would be ok too)

Any thoughts here?

Julien




More information about the LibreOffice mailing list