[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [equinox-dev] EventAdmin and topic legality
|
Ah. That is 3.1 which included 4.0 version of Event.java which had this
problem with being too strict. This was fixed in OSGi 4.0.1. Try the
latest org.eclipse.osgi.services from 3.3 for 4.0.1 files which contain
the fix.
BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx
office: +1 386 848 3788
mobile: +1 386 848 3788
"Michael Furtak" <mfurtak@xxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
01/30/2007 11:01 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
To
"Equinox development mailing list" <equinox-dev@xxxxxxxxxxx>
cc
Subject
RE: [equinox-dev] EventAdmin and topic legality
Hmm. I just downloaded a fresh copy of
org.eclipse.osgi.services_3.1.100.v20060601.jar from the downloads
section of the Equinox site. I assume that is the correct source for
the Event class in question? I then ran the following:
package com.cra.test;
import org.osgi.service.event.Event;
public class TopicTest
{
public static void main(String[] args)
{
System.out.println(new Event("com/cra/foobar", null).getTopic());
System.out.println(new Event("com/cra/foo-bar", null).getTopic());
System.out.println(new Event("com/cra/2foobar", null).getTopic());
System.out.println(new Event("com/cra/_foobar", null).getTopic());
}
}
That produced the following:
com/cra/foobar
Exception in thread "main" java.lang.IllegalArgumentException: invalid
topic
at
org.osgi.service.event.Event.validateToken(Event.java:187)
at
org.osgi.service.event.Event.validateTopicName(Event.java:161)
at org.osgi.service.event.Event.<init>(Event.java:46)
at com.cra.test.TopicTest.main(TopicTest.java:13)
-Mike
-----Original Message-----
From: equinox-dev-bounces@xxxxxxxxxxx
[mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of BJ Hargrave
Sent: Tuesday, January 30, 2007 10:13 AM
To: Equinox development mailing list
Subject: RE: [equinox-dev] EventAdmin and topic legality
What version of Equinox are you using? I ran this code using the latest
Event.java and all the examples are fine topics:
package com.ibm.test;
import org.osgi.service.event.Event;
public class TopicTest {
public static void main(String[] args) {
System.out.println(new Event("com/cra/foobar", null
).getTopic());
System.out.println(new Event("com/cra/foo-bar", null
).getTopic());
System.out.println(new Event("com/cra/2foobar", null
).getTopic());
System.out.println(new Event("com/cra/_foobar", null
).getTopic());
}
}
produces:
com/cra/foobar
com/cra/foo-bar
com/cra/2foobar
com/cra/_foobar
BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx
office: +1 386 848 3788
mobile: +1 386 848 3788
"Michael Furtak" <mfurtak@xxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
01/30/2007 09:56 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
To
"Equinox development mailing list" <equinox-dev@xxxxxxxxxxx>
cc
Subject
RE: [equinox-dev] EventAdmin and topic legality
My impression that the implementation was stricter than the spec was
just based upon my interpretation of what should be a valid topic under
the spec.
For control, the following topic does work for me:
"com/cra/foobar"
Example topics that I have tried, but do not work include:
"com/cra/foo-bar"
"com/cra/2foobar"
"com/cra/_foobar"
They all produce a stack trace identical to the one in my original
message. Should those topics be valid to your knowledge?
Thanks,
-Mike
-----Original Message-----
From: equinox-dev-bounces@xxxxxxxxxxx
[mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of BJ Hargrave
Sent: Tuesday, January 30, 2007 9:42 AM
To: Equinox development mailing list
Subject: Re: [equinox-dev] EventAdmin and topic legality
Line 187 in Event.java indicates that the token is the empty string.
This
implies that you have 2 (or more) adjacent slashes in the topic name:
e.g.
foo//bar.
What leads you to believe the Equinox EventAdmin impl is more strict in
the token grammar? The test for valid token is in
or.osgi.service.event.Event which is from OSGi.
BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx
office: +1 386 848 3788
mobile: +1 386 848 3788
"Michael Furtak" <mfurtak@xxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
01/30/2007 09:26 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
To
<equinox-dev@xxxxxxxxxxx>
cc
Subject
[equinox-dev] EventAdmin and topic legality
Good morning.
Forgive my posting if this is not the right forum to be asking these
questions. If so, redirection would be appreciated.
I'm having a spot of trouble with the Equinox EventAdmin. It seems like
the Equinox EventAdmin will not accept a topic that contains certain
tokens, producing:
Exception in thread "Thread-0" java.lang.IllegalArgumentException:
invalid
topic
at org.osgi.service.event.Event.validateToken(Event.java:187)
at
org.osgi.service.event.Event.validateTopicName(Event.java:161)
at org.osgi.service.event.Event.<init>(Event.java:46)
...
The core OSGi spec defines a token as one or more alphanumerics,
underscores, or dashes (1.4.2 - General Syntax Definitions). Based on
my
investigation, the Equinox implementation seems to have a more strict
interpretation of what is a valid token. Dashes seem to be completely
disallowed. Numbers and underscores can be present, but cannot be the
first character in a token. Overall this seems similar to Java variable
naming rules, but I was curious whether my interpretation of the spec is
incorrect or if there was a reason for the discrepancy.
Many thanks,
-Mike Furtak_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev