The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: java xAPlib bug



Screw it


if (trimmedSection.compareToIgnoreCase("xap-header")
== 0) {
trimmedSection = trimmedSection.toLowerCase();
}

changed to

trimmedSection = trimmedSection.toLowerCase();

ALWAYS lowercase the section ! This bug is not specific to xap-header.

I'm done with this -

So anyone using this library or have I picked up an old borked one :/




Shaf Ali wrote:
> And here's the fix but I also noticed that the message blocks are not
> in order but thats not a major issue :)
>
>
> xAPParser.java
>
>                    // Shaf fix
>
>                    String trimmedSection=iSection.toString().trim();
>
>                    if
> (trimmedSection.compareToIgnoreCase("xap-header") == 0) {
>                        trimmedSection = trimmedSection.toLowerCase();
>                    }
>
>                    String trimmedKeyname=iKeyname.toString().trim();
>                    String trimmedKeyvalue=iKeyvalue.toString().trim();
>                   //                   
System.out.println("Section
> ["+trimmedSection.trim()+"]");                   //
> System.out.println("Name
["+trimmedKeyname.trim()+"]");
> //                    System.out.println("Value
> ["+trimmedKeyvalue.trim()+"]");
>                                                          iNVPair=new
> xAPNameValuePair(trimmedSection, trimmedKeyname,trimmedKeyvalue
> );                                      // End Shaf
>
> from
>
>                    String trimmedSection=iSection.toString();
>                    String trimmedKeyname=iKeyname.toString();
>                    String trimmedKeyvalue=iKeyvalue.toString();
>                   //                   
System.out.println("Section
> ["+trimmedSection.trim()+"]");                   //
> System.out.println("Name
["+trimmedKeyname.trim()+"]");
> //                    System.out.println("Value
> ["+trimmedKeyvalue.trim()+"]");
>                                                          iNVPair=new
> xAPNameValuePair(trimmedSection.trim(),
> trimmedKeyname.trim(),trimmedKeyvalue.trim() );
>
>
>
>
>
> Shaf Ali wrote:
>> Caused by hard coded references to 'xap-header'
>>
>> Some/most xAP apps identify the header as 'xAP-header'
>>
>> Oh well
>>
>>
>> Shaf Ali wrote:
>>> Anyone still use this lib ?
>>> (http://patrick.lidstone.net/haweb/java.htm)
>>>
>>> Thought I'd give my Java some oiling the trace is at the
bottom.
>>>
>>> Here's the breakpoint
>>>
>>> this    xAPParser  (id=20)      gBlockCursor    null
>>> gNVBlockCursor    null      iMessageItems   
HashMap<K,V>  (id=33)
>>> aNVPair    xAPNameValuePair  (id=24)      iBlock   
"xAP-header"
>>>        count    10          hash    -1579644813         
offset
>>> 0          value    char[11]  (id=48)      iName   
"hop"
>>> iValue    "1"   iNVPairSet    null  Heres the quick
hack I'll see
>>> what the cause is.
>>>
>>> xAPMessageObject.java
>>>
>>>        // block must now exist, add pair
>>>        // 20070226 shaf hack : hmmm I wouldn't be too sure if
I were
>>> you
>>> //        iNVPairSet.add(aNVPair);
>>>        if (iNVPairSet != null) {
>>>            iNVPairSet.add(aNVPair);                  }
>>>
>>>
>>> =========== Got a xAP message
>>> Null source
>>> Null class
>>> firstblock = [xap-hbeat]
>>> =========== End xAP message
>>>
>>> [xap-header] debug[name] : v
>>> [xap-header] debug[valu] : 12
>>> [xap-header] debug[name] : hop
>>> [xap-header] debug[valu] : 1
>>> [xap-header] debug[name] : uid
>>> [xap-header] debug[valu] : FF342300
>>> [xap-header] debug[name] : Class
>>> [xap-header] debug[valu] : Web.Service
>>> [xap-header] debug[name] : Source
>>> [xap-header] debug[valu] : mi4.news.FRESH
>>> [Server.Start] debug[name] : Name
>>> [Server.Start] debug[valu] : News
>>> [Server.Start] debug[name] : Desc
>>> [Server.Start] debug[valu] : News feed viewer
>>> Exception in thread "Thread-0"
java.lang.NullPointerException
>>>        at
>>>
xAPlib.xAPMessageObject.addNameValuePair(xAPMessageObject.java:58)
>>>        at xAPlib.xAPParser.<init>(xAPParser.java:104)
>>>        at
ListenAndParse$1.myEventOccurred(ListenAndParse.java:40)
>>>        at xAPlib.xAPNetwork.fireMyEvent(xAPNetwork.java:69)
>>>        at xAPlib.xAPNetwork.run(xAPNetwork.java:140)
>>>
>>>
>>>
>>
>>
>
>




xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.