You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Dieter Verslype <di...@intec.ugent.be> on 2007/10/03 14:42:27 UTC

UPnP Basedriver bug?

Hello felix-dev,

I noticed some errorous behaviour in the UPnP Basedriver. I'm not sure 
if I did something wrong, but I found a way to fix it. Cause and fix 
described below:

In org.apache.felix.upnp.basedriver.exportGeneralActionListener, after 
successfull invocation of an Action (Dictionary invoke(Dictionary)), the 
basedriver tries to extract the values of the outargs from the 
dictionary and put them in the ArgumentList object of Action. Here 
arises a problem when an Action has in-out arguments. In the 
ArgumentList these are treated seperatly (2 Argument objects with the 
same name, but different argument direction).
 
When the basedriver wants to set the value for out argument, it does 
ArgumentList.getArgument(argumentName) and finds the in argument rather 
then the out argument! So the out argument is never set, resulting in a 
constant null as value for the out argument.
 
My proposal for a fix:
 
on line 123:
[code]arg = al.getArgument(outArg[j]); //can be null, tries getting the 
argument (which can be wrong)[/code]
 
replace by:
[code]
arg = null;
for (int n = 0; n < al.size(); n++) {
Argument a = al.getArgument(n);
String aName = a.getName();
if (aName == null || a.isInDirection())
continue;
if (aName.equals(outArg[j]) == true) {
arg = a;
break;
}
}
[/code]
 
Do you agree on this one?

regards,

Dieter Verslype (aka dvrslype)
IBCN - INTEC
University of Ghent
http://www.ibcn.intec.ugent.be/

Re: UPnP Basedriver bug?

Posted by Stefano Lenzi <ki...@interfree.it>.
Stefano Lenzi wrote:
> I've just created the JIRA-391 issue which rehears to this e-mail 
> thread, and I'm going to patch the UPnP Base Driver.
> 
> Ciao,
> Stefano "Kismet" Lenzi

I've applied the patch to SVN version of the software. The code now uses 
getInArgmuntList and getOutArgumentList instead of a general 
getArgumentList.

Let me know if now it works, so I'll close the issue as resolved.

Ciao,
Stefano "Kismet" Lenzi

> 
> Francesco Furfari wrote:
>> Dear Dieter,
>>
>> You are right, the bug is known and was reported the first time by 
>> Nico Goeminne (University of Ghent too ;-) ), anyway  thanks again for 
>> reporting it. At first glance my idea would be to enhance the 
>> ArgumentList  interface to simplify the selection of arguments.
>> In any case a patch will be added ASAP.
>>
>> best regards,
>> francesco
>>
>> Dieter Verslype wrote:
>>> Hello felix-dev,
>>>
>>> I noticed some errorous behaviour in the UPnP Basedriver. I'm not 
>>> sure if I did something wrong, but I found a way to fix it. Cause and 
>>> fix described below:
>>>
>>> In org.apache.felix.upnp.basedriver.exportGeneralActionListener, 
>>> after successfull invocation of an Action (Dictionary 
>>> invoke(Dictionary)), the basedriver tries to extract the values of 
>>> the outargs from the dictionary and put them in the ArgumentList 
>>> object of Action. Here arises a problem when an Action has in-out 
>>> arguments. In the ArgumentList these are treated seperatly (2 
>>> Argument objects with the same name, but different argument direction).
>>>
>>> When the basedriver wants to set the value for out argument, it does 
>>> ArgumentList.getArgument(argumentName) and finds the in argument 
>>> rather then the out argument! So the out argument is never set, 
>>> resulting in a constant null as value for the out argument.
>>>
>>> My proposal for a fix:
>>>
>>> on line 123:
>>> [code]arg = al.getArgument(outArg[j]); //can be null, tries getting 
>>> the argument (which can be wrong)[/code]
>>>
>>> replace by:
>>> [code]
>>> arg = null;
>>> for (int n = 0; n < al.size(); n++) {
>>> Argument a = al.getArgument(n);
>>> String aName = a.getName();
>>> if (aName == null || a.isInDirection())
>>> continue;
>>> if (aName.equals(outArg[j]) == true) {
>>> arg = a;
>>> break;
>>> }
>>> }
>>> [/code]
>>>
>>> Do you agree on this one?
>>>
>>> regards,
>>>
>>> Dieter Verslype (aka dvrslype)
>>> IBCN - INTEC
>>> University of Ghent
>>> http://www.ibcn.intec.ugent.be/
>>
>>
> 
> 
> 


Re: UPnP Basedriver bug?

Posted by Stefano Lenzi <ki...@interfree.it>.
I've just created the JIRA-391 issue which rehears to this e-mail 
thread, and I'm going to patch the UPnP Base Driver.

Ciao,
Stefano "Kismet" Lenzi

Francesco Furfari wrote:
> Dear Dieter,
> 
> You are right, the bug is known and was reported the first time by Nico 
> Goeminne (University of Ghent too ;-) ), anyway  thanks again for 
> reporting it. At first glance my idea would be to enhance the 
> ArgumentList  interface to simplify the selection of arguments.
> In any case a patch will be added ASAP.
> 
> best regards,
> francesco
> 
> Dieter Verslype wrote:
>> Hello felix-dev,
>>
>> I noticed some errorous behaviour in the UPnP Basedriver. I'm not sure 
>> if I did something wrong, but I found a way to fix it. Cause and fix 
>> described below:
>>
>> In org.apache.felix.upnp.basedriver.exportGeneralActionListener, after 
>> successfull invocation of an Action (Dictionary invoke(Dictionary)), 
>> the basedriver tries to extract the values of the outargs from the 
>> dictionary and put them in the ArgumentList object of Action. Here 
>> arises a problem when an Action has in-out arguments. In the 
>> ArgumentList these are treated seperatly (2 Argument objects with the 
>> same name, but different argument direction).
>>
>> When the basedriver wants to set the value for out argument, it does 
>> ArgumentList.getArgument(argumentName) and finds the in argument 
>> rather then the out argument! So the out argument is never set, 
>> resulting in a constant null as value for the out argument.
>>
>> My proposal for a fix:
>>
>> on line 123:
>> [code]arg = al.getArgument(outArg[j]); //can be null, tries getting 
>> the argument (which can be wrong)[/code]
>>
>> replace by:
>> [code]
>> arg = null;
>> for (int n = 0; n < al.size(); n++) {
>> Argument a = al.getArgument(n);
>> String aName = a.getName();
>> if (aName == null || a.isInDirection())
>> continue;
>> if (aName.equals(outArg[j]) == true) {
>> arg = a;
>> break;
>> }
>> }
>> [/code]
>>
>> Do you agree on this one?
>>
>> regards,
>>
>> Dieter Verslype (aka dvrslype)
>> IBCN - INTEC
>> University of Ghent
>> http://www.ibcn.intec.ugent.be/
> 
> 


Re: UPnP Basedriver bug?

Posted by Francesco Furfari <fr...@isti.cnr.it>.
Dear Dieter,

You are right, the bug is known and was reported the first time by Nico 
Goeminne (University of Ghent too ;-) ), anyway  thanks again for 
reporting it. At first glance my idea would be to enhance the 
ArgumentList  interface to simplify the selection of arguments.
In any case a patch will be added ASAP.

best regards,
francesco

Dieter Verslype wrote:
> Hello felix-dev,
> 
> I noticed some errorous behaviour in the UPnP Basedriver. I'm not sure 
> if I did something wrong, but I found a way to fix it. Cause and fix 
> described below:
> 
> In org.apache.felix.upnp.basedriver.exportGeneralActionListener, after 
> successfull invocation of an Action (Dictionary invoke(Dictionary)), the 
> basedriver tries to extract the values of the outargs from the 
> dictionary and put them in the ArgumentList object of Action. Here 
> arises a problem when an Action has in-out arguments. In the 
> ArgumentList these are treated seperatly (2 Argument objects with the 
> same name, but different argument direction).
> 
> When the basedriver wants to set the value for out argument, it does 
> ArgumentList.getArgument(argumentName) and finds the in argument rather 
> then the out argument! So the out argument is never set, resulting in a 
> constant null as value for the out argument.
> 
> My proposal for a fix:
> 
> on line 123:
> [code]arg = al.getArgument(outArg[j]); //can be null, tries getting the 
> argument (which can be wrong)[/code]
> 
> replace by:
> [code]
> arg = null;
> for (int n = 0; n < al.size(); n++) {
> Argument a = al.getArgument(n);
> String aName = a.getName();
> if (aName == null || a.isInDirection())
> continue;
> if (aName.equals(outArg[j]) == true) {
> arg = a;
> break;
> }
> }
> [/code]
> 
> Do you agree on this one?
> 
> regards,
> 
> Dieter Verslype (aka dvrslype)
> IBCN - INTEC
> University of Ghent
> http://www.ibcn.intec.ugent.be/