[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] some issues in creatingfilters

If the filter string is invalid, createFilter will throw an InvalidSyntaxException.

If that does not happen, then the filter string is fine.

From the code snippet, I don't know what the value of the mode variable is. What you should do is print out filter.toString() and see what the final filter is.

We also can't see what Dictionary or ServiceReference you are attempting to match against the filter against. So it is possible the nothing matches your filter.

Finally, I think the argument to the services console command must be a valid filter string. "-l bundleId" is not a valid filter string which is why you get an exception.

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the
OSGi Alliance

office: +1 386 848 1781
mobile: +1 386 848 3788

From: prof_trg <prof.target@xxxxxxxxx>
To: equinox-dev@xxxxxxxxxxx
Date: 2009/11/15 07:30
Subject: [equinox-dev] some issues in creatingfilters
Sent by: equinox-dev-bounces@xxxxxxxxxxx

I have some issues in creatingfilters..
in fact, only simple filters are accepted like :
filter = context.createFilter("(" + Constants.OBJECTCLASS + "=" +
IMyInterface.class.getName() + ")");
however, the filter has filtered nothing if the syntax is like the
following,  :
filter = context.createFilter("(&(" + Constants.OBJECTCLASS + "=" +
IMyInterface.class.getName() + ")" +
                                                                   "(" + mode + "=" +  true+ "))");
when I taped the command "services -l bundleID" , an exception occured;
error in character 1 "("...
So w*how can I validate the syntax of filters..and what is the origin of the
exception in your opinion (the previous syntax seems correct..)

View this message in context:
Sent from the Equinox - Dev mailing list archive at Nabble.com.

equinox-dev mailing list