Bug 255006 - [Discovery][SLP] Fail to handle string attributes containing comma
Summary: [Discovery][SLP] Fail to handle string attributes containing comma
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.protocols (show other bugs)
Version: 2.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Markus Kuppe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 251329
  Show dependency tree
 
Reported: 2008-11-12 05:30 EST by Markus Kuppe CLA
Modified: 2008-12-03 07:44 EST (History)
1 user (show)

See Also:


Attachments
mylyn/context/zip (834 bytes, application/octet-stream)
2008-11-14 03:07 EST, Markus Kuppe CLA
no flags Details
patch (72.19 KB, patch)
2008-12-02 11:38 EST, Markus Kuppe CLA
no flags Details | Diff
mylyn/context/zip (9.37 KB, application/octet-stream)
2008-12-03 07:44 EST, Markus Kuppe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2008-11-12 05:30:39 EST
attributeid=foo,bar is parsed as [(attribute=foo), (bar)]. This causes the upper layers to discard the ServiceUrl.
Comment 1 Markus Kuppe CLA 2008-11-14 03:07:35 EST
Released a change that doesn't fix the root cause, but safeguards consumers from broken attributes
Comment 2 Markus Kuppe CLA 2008-11-14 03:07:37 EST
Created attachment 117874 [details]
mylyn/context/zip
Comment 3 Thomas Kiesslich CLA 2008-11-25 04:20:22 EST
There is maybe another bug with handling ":" in the attributes. I get that error.


ch.ethz.iks.slp.ServiceLocationException: service url is malformed: [service:osgi:6x://mhhb3j0c/?scope=UNDEFINED:UNDEFINED:5da1e680-f1e0-11d9-bbed-0002a5d5c51b:5da1e680-f1e0-11d9-bbed-1112a5d5c51b,objectClass=6x,version=0.0.0]. 
	at ch.ethz.iks.slp.ServiceURL.<init>(ServiceURL.java:148)
	at org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.createServiceURL(SLPServiceDescriptionAdapter.java:338)
	at org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.addInterfacesAndVersionsToProperties(SLPServiceDescriptionAdapter.java:116)
	at org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.<init>(SLPServiceDescriptionAdapter.java:78)
	at org.osgi.impl.service.discovery.slp.SLPHandlerImpl.publishService(SLPHandlerImpl.java:205)
Comment 4 Markus Kuppe CLA 2008-12-01 07:27:24 EST
(In reply to comment #1)
> Released a change that doesn't fix the root cause, but safeguards consumers
> from broken attributes

Backported this change to release_2_1 and release_2_0 too.

Comment 5 Markus Kuppe CLA 2008-12-01 11:24:05 EST
I've narrowed it down to ch.ethz.iks.slp.impl.SLPMessage.stringToList(String, String) not recognizing the ABNF grammar [1] of attributes.

[1] http://tools.ietf.org/html/rfc2608#page-10 
Comment 6 Markus Kuppe CLA 2008-12-02 11:38:32 EST
Created attachment 119288 [details]
patch

Adds a (generated) parser for attributes to jSLP based on the ABND defined in the RFC.
Comment 7 Markus Kuppe CLA 2008-12-03 06:39:16 EST
(In reply to comment #3)
> There is maybe another bug with handling ":" in the attributes. I get that
> error.
> 
> 
> ch.ethz.iks.slp.ServiceLocationException: service url is malformed:
> []. 
>         at ch.ethz.iks.slp.ServiceURL.<init>(ServiceURL.java:148)
>         at
> org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.createServiceURL(SLPServiceDescriptionAdapter.java:338)
>         at
> org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.addInterfacesAndVersionsToProperties(SLPServiceDescriptionAdapter.java:116)
>         at
> org.osgi.impl.service.discovery.slp.SLPServiceDescriptionAdapter.<init>(SLPServiceDescriptionAdapter.java:78)
>         at
> org.osgi.impl.service.discovery.slp.SLPHandlerImpl.publishService(SLPHandlerImpl.java:205)
> 

Service attributes cannot be passed to the ServiceURL. The url just accepts "service:osgi:6x://mhhb3j0c" and attributes and scope can be passed to ch.ethz.iks.slp.Advertiser.register(ServiceURL, List, Dictionary).
Comment 8 Markus Kuppe CLA 2008-12-03 06:43:13 EST
(In reply to comment #3)
> ch.ethz.iks.slp.ServiceLocationException: service url is malformed:
> [service:osgi:6x://mhhb3j0c/?scope=UNDEFINED:UNDEFINED:5da1e680-f1e0-11d9-bbed-0002a5d5c51b:5da1e680-f1e0-11d9-bbed-1112a5d5c51b,objectClass=6x,version=0.0.0]. 

Btw. that's malformed because string misses the port like e.g. "mhhb3j0c:123". If the port would be set, "?scope..." would be takes as a service path (not attributes!).
Comment 9 Markus Kuppe CLA 2008-12-03 07:44:01 EST
Fix released to HEAD (/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/attr/README.txt explains how to generate the parser).
Comment 10 Markus Kuppe CLA 2008-12-03 07:44:05 EST
Created attachment 119370 [details]
mylyn/context/zip