[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Socket protocol and plugin info



Hi Oliver,
thanks for the suggestion.
I have changed the code to:

// String tmp =
pluginInfo.getParameters().getProperty("useUdpForOneway",
""+this.useUdpForOneway);
// this.useUdpForOneway = Boolean.valueOf(tmp).booleanValue();
this.useUdpForOneway = this.glob.get("useUdpForOneWay",
this.useUdpForOneway, null, pluginInfo);

which should work. I would not commit the change however, I will test it
on the weekend and commit it only after successful tests.

Regards
Michele


Fels, Oliver wrote:
> Hi folks.
> 
> While around with the socket protocol, I have come across the
> SocketConnection.init(Global, PluginInfo) method which is laid out as
> follows:
> 
>   public void init(org.xmlBlaster.util.Global glob, PluginInfo
> pluginInfo) throws XmlBlasterException 
>  {
>       this.glob = (glob == null) ? Global.instance() : glob;
> 
>       this.pluginInfo = pluginInfo;
>       String tmp =
> pluginInfo.getParameters().getProperty("useUdpForOneway",
> ""+this.useUdpForOneway);
>       this.useUdpForOneway = Boolean.valueOf(tmp).booleanValue();
>       if (log.isLoggable(Level.FINER)) log.finer("Entering
> init(useUdpForOneway="+this.useUdpForOneway+")");
>       // Put this instance in the NameService, will be looked up by
> SocketCallbackImpl
>  
> this.glob.addObjectEntry("org.xmlBlaster.client.protocol.socket.SocketCo
> nnection", this);
>   }
> 
> The difficult part is if not relying on a XmlBlasterAccess object but
> directly working with the SocketConnection class.
> In this case there is no PluginInfo object which leads to a
> NullPointerException when fetching the useUdpForOneWay parameter.
> I believe someone has already thought about this scenario because
> getVersion handles a non-existent PluginInfo:
> 
>    public String getVersion() 
>    {
>       return (this.pluginInfo == null) ? "1.0" :
> this.pluginInfo.getVersion();
>    }
> 
> So that looks somehow like a bug. One solution could be to move the
> useUdpForOneway property into Global, the other to catch this faulty
> condition by testing the PluginInfo object for null reference.
> 
> Any comments ?
> 
> Best regards,
> 
> Oliver
>