Problem when reading an xml file

I have this kind of logs in the deployer when marshalling an xml property
file :

0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propAutoLoadScript: incompatible type (string).
0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propAutoLoadStateMachines: incompatible type (string).
0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propEnableLog: incompatible type (bool).
0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propCanFestivalDriverName: incompatible type (string).
0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propBusName: incompatible type (string).
0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
propBaudRate: incompatible type (string).
Properties loaded successfully from script/conf/Can1.xml

This code and the xml used to work in 2.1. The last line is my own log.

Here is extract of my configure code :

marshalling = this->getProvider<RTT::Marshalling>("marshalling");
if( marshalling != NULL)
{
if( marshalling->readProperties(fileName) == false )
{
LOG(Error) << "Configure failed, error while reading or file
not found " << fileName << endlog();
res &= false;
}
//on a reussit à charger les propriétés !
else
{
LOG(Info) << "Properties loaded successfully from " <<
fileName << endlog();
res &= true;
}
}

Here is extract of my constructor :
addProperty("propAutoLoadScript", propAutoLoadScript)
.doc("...");
addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines)
.doc("...");
addProperty("propEnableLog", propEnableLog)
.doc("...");

Here is an extract of my headers :
string propAutoLoadScript;
string propAutoLoadStateMachines;
bool propEnableLog;

So the readProperties function seems to have return true while
rtt/Property.hpp l145 complains :

Property( base::PropertyBase* source)
: base::PropertyBase(source ? source->getName() : "", source ?
source->getDescription() : ""),
_value( source ?
internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSource().get()
) : 0 )
{
if ( source && ! _value ) {
log(Error) <<"Can not initialize Property from
"<<source->getName() <<": ";
if ( source->getDataSource() )
log() << "incompatible type ("<<
source->getDataSource()->getTypeName() << ")."<<endlog();
else
log() << "source Property was not ready."< }
}

Does anyone know what's happening ?
>

Problem when reading an xml file

On Thursday 03 March 2011 23:56:40 Willy Lambert wrote:
> I have this kind of logs in the deployer when marshalling an xml property
> file :
>
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadScript: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadStateMachines: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propEnableLog: incompatible type (bool).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propCanFestivalDriverName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBusName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBaudRate: incompatible type (string).
> Properties loaded successfully from script/conf/Can1.xml

These errors are false and can be ignored. The configuration *did* succeed. I
have pushed a patch to the algorithm such that they disappear. It was the
composition algorithm testing for a PropertyBag, and the constructor of
Property complaining. That's probably why the unit tests didn't catch it: we
don't check for error messages, only for correctness :-)

>
>
> This code and the xml used to work in 2.1. The last line is my own log.
>
> Here is extract of my configure code :
>
> marshalling = this->getProvider<RTT::Marshalling>("marshalling");
> if( marshalling != NULL)
> {
> if( marshalling->readProperties(fileName) == false )
> {
> LOG(Error) << "Configure failed, error while reading or
> file not found " << fileName << endlog();
> res &= false;
> }
> //on a reussit à charger les propriétés !
> else
> {
> LOG(Info) << "Properties loaded successfully from " <<
> fileName << endlog();
> res &= true;
> }
> }
>
> Here is extract of my constructor :
> addProperty("propAutoLoadScript", propAutoLoadScript)
> .doc("...");
> addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines)
> .doc("...");
> addProperty("propEnableLog", propEnableLog)
> .doc("...");
>
> Here is an extract of my headers :
> string propAutoLoadScript;
> string propAutoLoadStateMachines;
> bool propEnableLog;
>
>
> So the readProperties function seems to have return true while
> rtt/Property.hpp l145 complains :
>
> Property( base::PropertyBase* source)
>
> : base::PropertyBase(source ? source->getName() : "", source ?
>
> source->getDescription() : ""),
> _value( source ?
> internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSourc
> e().get() ) : 0 )
> {
> if ( source && ! _value ) {
> log(Error) <<"Can not initialize Property from
> "<<source->getName() <<": ";
> if ( source->getDataSource() )
> log() << "incompatible type ("<<
> source->getDataSource()->getTypeName() << ")."<<endlog();
> else
> log() << "source Property was not ready."<<endlog();
> }
> }
>
>
> Does anyone know what's happening ?

Peter

Problem when reading an xml file

2011/3/4 Peter Soetens <peter [..] ...>

> On Thursday 03 March 2011 23:56:40 Willy Lambert wrote:
> > I have this kind of logs in the deployer when marshalling an xml property
> > file :
> >
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propAutoLoadScript: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propAutoLoadStateMachines: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propEnableLog: incompatible type (bool).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propCanFestivalDriverName: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propBusName: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> from
> > propBaudRate: incompatible type (string).
> > Properties loaded successfully from script/conf/Can1.xml
>
> These errors are false and can be ignored. The configuration *did* succeed.
> I
> have pushed a patch to the algorithm such that they disappear. It was the
> composition algorithm testing for a PropertyBag, and the constructor of
> Property complaining. That's probably why the unit tests didn't catch it:
> we
> don't check for error messages, only for correctness :-)
>
>
great, thanks for support, I'll ignore this until I update my rtt branches

> >
> >
> > This code and the xml used to work in 2.1. The last line is my own log.
> >
> > Here is extract of my configure code :
> >
> > marshalling = this->getProvider<RTT::Marshalling>("marshalling");
> > if( marshalling != NULL)
> > {
> > if( marshalling->readProperties(fileName) == false )
> > {
> > LOG(Error) << "Configure failed, error while reading or
> > file not found " << fileName << endlog();
> > res &= false;
> > }
> > //on a reussit à charger les propriétés !
> > else
> > {
> > LOG(Info) << "Properties loaded successfully from " <<
> > fileName << endlog();
> > res &= true;
> > }
> > }
> >
> > Here is extract of my constructor :
> > addProperty("propAutoLoadScript", propAutoLoadScript)
> > .doc("...");
> >
> addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines)
> > .doc("...");
> > addProperty("propEnableLog", propEnableLog)
> > .doc("...");
> >
> > Here is an extract of my headers :
> > string propAutoLoadScript;
> > string propAutoLoadStateMachines;
> > bool propEnableLog;
> >
> >
> > So the readProperties function seems to have return true while
> > rtt/Property.hpp l145 complains :
> >
> > Property( base::PropertyBase* source)
> >
> > : base::PropertyBase(source ? source->getName() : "", source
> ?
> >
> > source->getDescription() : ""),
> > _value( source ?
> >
> internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSourc
> > e().get() ) : 0 )
> > {
> > if ( source && ! _value ) {
> > log(Error) <<"Can not initialize Property from
> > "<<source->getName() <<": ";
> > if ( source->getDataSource() )
> > log() << "incompatible type ("<<
> > source->getDataSource()->getTypeName() << ")."<<endlog();
> > else
> > log() << "source Property was not ready."<<endlog();
> > }
> > }
> >
> >
> > Does anyone know what's happening ?
>
> Peter
>

Problem when reading an xml file

On Thursday 03 March 2011 23:56:40 Willy Lambert wrote:
> I have this kind of logs in the deployer when marshalling an xml property
> file :
>
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadScript: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadStateMachines: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propEnableLog: incompatible type (bool).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propCanFestivalDriverName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBusName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBaudRate: incompatible type (string).
> Properties loaded successfully from script/conf/Can1.xml

That's clearly a regression. I don't see any mistake in your code or xml file.

The only time I have seen this 'dynamic_cast' fail is when different libraries
linked with the RTT typekit. We removed this linking again, but some
additional linking might be done depending on your manifest.xml file (in
comparison to 2.1).

What's in your manifest.xml ?

What does 'ldd libcomponent.so' give ?

>
>
> This code and the xml used to work in 2.1. The last line is my own log.
>
> Here is extract of my configure code :
>
> marshalling = this->getProvider<RTT::Marshalling>("marshalling");
> if( marshalling != NULL)
> {
> if( marshalling->readProperties(fileName) == false )
> {
> LOG(Error) << "Configure failed, error while reading or
> file not found " << fileName << endlog();
> res &= false;
> }
> //on a reussit à charger les propriétés !
> else
> {
> LOG(Info) << "Properties loaded successfully from " <<
> fileName << endlog();
> res &= true;
> }
> }
>
> Here is extract of my constructor :
> addProperty("propAutoLoadScript", propAutoLoadScript)
> .doc("...");
> addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines)
> .doc("...");
> addProperty("propEnableLog", propEnableLog)
> .doc("...");
>
> Here is an extract of my headers :
> string propAutoLoadScript;
> string propAutoLoadStateMachines;
> bool propEnableLog;
>
>
> So the readProperties function seems to have return true while
> rtt/Property.hpp l145 complains :
>
> Property( base::PropertyBase* source)
>
> : base::PropertyBase(source ? source->getName() : "", source ?
>
> source->getDescription() : ""),
> _value( source ?
> internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSourc
> e().get() ) : 0 )
> {
> if ( source && ! _value ) {
> log(Error) <<"Can not initialize Property from
> "<<source->getName() <<": ";
> if ( source->getDataSource() )
> log() << "incompatible type ("<<
> source->getDataSource()->getTypeName() << ")."<<endlog();
> else
> log() << "source Property was not ready."<<endlog();
> }
> }
>
>
> Does anyone know what's happening ?

Peter

Problem when reading an xml file

On Friday 04 March 2011 14:20:08 Peter Soetens wrote:
> On Thursday 03 March 2011 23:56:40 Willy Lambert wrote:
> > I have this kind of logs in the deployer when marshalling an xml property
> > file :
> >
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propAutoLoadScript: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propAutoLoadStateMachines: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propEnableLog: incompatible type (bool).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propCanFestivalDriverName: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propBusName: incompatible type (string).
> > 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property
> > from propBaudRate: incompatible type (string).
> > Properties loaded successfully from script/conf/Can1.xml
>
> That's clearly a regression. I don't see any mistake in your code or xml
> file.

I could reproduce this. I'm on it.

Peter

>
> The only time I have seen this 'dynamic_cast' fail is when different
> libraries linked with the RTT typekit. We removed this linking again, but
> some additional linking might be done depending on your manifest.xml file
> (in comparison to 2.1).
>
> What's in your manifest.xml ?
>
> What does 'ldd libcomponent.so' give ?
>
> > This code and the xml used to work in 2.1. The last line is my own log.
> >
> > Here is extract of my configure code :
> > marshalling = this->getProvider<RTT::Marshalling>("marshalling");
> > if( marshalling != NULL)
> > {
> >
> > if( marshalling->readProperties(fileName) == false )
> > {
> >
> > LOG(Error) << "Configure failed, error while reading or
> >
> > file not found " << fileName << endlog();
> >
> > res &= false;
> >
> > }
> > //on a reussit à charger les propriétés !
> > else
> > {
> >
> > LOG(Info) << "Properties loaded successfully from " <<
> >
> > fileName << endlog();
> >
> > res &= true;
> >
> > }
> >
> > }
> >
> > Here is extract of my constructor :
> > addProperty("propAutoLoadScript", propAutoLoadScript)
> >
> > .doc("...");
> >
> > addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines
> > )
> >
> > .doc("...");
> >
> > addProperty("propEnableLog", propEnableLog)
> >
> > .doc("...");
> >
> > Here is an extract of my headers :
> > string propAutoLoadScript;
> > string propAutoLoadStateMachines;
> > bool propEnableLog;
> >
> > So the readProperties function seems to have return true while
> >
> > rtt/Property.hpp l145 complains :
> > Property( base::PropertyBase* source)
> >
> > : base::PropertyBase(source ? source->getName() : "", source
> > : ?
> >
> > source->getDescription() : ""),
> >
> > _value( source ?
> >
> > internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSou
> > rc e().get() ) : 0 )
> >
> > {
> >
> > if ( source && ! _value ) {
> >
> > log(Error) <<"Can not initialize Property from
> >
> > "<<source->getName() <<": ";
> >
> > if ( source->getDataSource() )
> >
> > log() << "incompatible type ("<<
> >
> > source->getDataSource()->getTypeName() << ")."<<endlog();
> >
> > else
> >
> > log() << "source Property was not ready."<<endlog();
> >
> > }
> >
> > }
> >
> > Does anyone know what's happening ?
>
> Peter

Problem when reading an xml file

2011/3/3 Willy Lambert <lambert [dot] willy [..] ...>

> I have this kind of logs in the deployer when marshalling an xml property
> file :
>
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadScript: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propAutoLoadStateMachines: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propEnableLog: incompatible type (bool).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propCanFestivalDriverName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBusName: incompatible type (string).
> 0.041 [ ERROR ][PropertyLoader:configure] Can not initialize Property from
> propBaudRate: incompatible type (string).
> Properties loaded successfully from script/conf/Can1.xml
>
>
> This code and the xml used to work in 2.1. The last line is my own log.
>
> Here is extract of my configure code :
>
> marshalling = this->getProvider<RTT::Marshalling>("marshalling");
> if( marshalling != NULL)
> {
> if( marshalling->readProperties(fileName) == false )
> {
> LOG(Error) << "Configure failed, error while reading or
> file not found " << fileName << endlog();
> res &= false;
> }
> //on a reussit à charger les propriétés !
> else
> {
> LOG(Info) << "Properties loaded successfully from " <<
> fileName << endlog();
> res &= true;
> }
> }
>
> Here is extract of my constructor :
> addProperty("propAutoLoadScript", propAutoLoadScript)
> .doc("...");
> addProperty("propAutoLoadStateMachines",propAutoLoadStateMachines)
> .doc("...");
> addProperty("propEnableLog", propEnableLog)
> .doc("...");
>
> Here is an extract of my headers :
> string propAutoLoadScript;
> string propAutoLoadStateMachines;
> bool propEnableLog;
>
>
> So the readProperties function seems to have return true while
> rtt/Property.hpp l145 complains :
>
> Property( base::PropertyBase* source)
> : base::PropertyBase(source ? source->getName() : "", source ?
> source->getDescription() : ""),
> _value( source ?
> internal::AssignableDataSource<DataSourceType>::narrow(source->getDataSource().get()
> ) : 0 )
> {
> if ( source && ! _value ) {
> log(Error) <<"Can not initialize Property from
> "<<source->getName() <<": ";
> if ( source->getDataSource() )
> log() << "incompatible type ("<<
> source->getDataSource()->getTypeName() << ")."<<endlog();
> else
> log() << "source Property was not ready."<<endlog();
> }
> }
>
>
>
here is the property file I forgot :

<?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE properties SYSTEM "cpf.dtd"&gt;
<properties>
<simple name="propAutoLoadScript" type="string"><description>If non empty,
the component will automatically load this script during configure() (le
dossier ops est automatiquement ajouté, l'extension est mise par le
soft)<description><value><value><simple>
<simple name="propAutoLoadStateMachines" type="string"><description>If non
empty, the component will automatically load this state machine during
configure() (le dossier fsm-osd est automatiquement ajouté, l'extension est
mise par le soft)<description><value><value><simple>
<simple name="propEnableLog" type="boolean"><description>If set to true
the composant is allowed to write in the log file, if set to false it will
not log anything. Use it when a component is spamming log and this annoys
you<description><value>1<value><simple>
<simple name="propCanFestivalDriverName"
type="string"><value>/opt/can/canFestival/
libcanfestival_can_socket_3.ard-1.so<value><simple>
<simple name="propBusName" type="string"><value>can0<value><simple>
<simple name="propBaudRate" type="string"><value>250K<value><simple>
<properties>

> Does anyone know what's happening ?
>