You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Lorenz Breu <br...@hot-shot.com> on 2008/12/19 16:03:54 UTC

lookup returns an entry it shouldn't??

hi guys

while testing my application that uses ADS as a backend (embedded) i 
noticed the following weird behaviour and would like to ask if it is my 
bad, or the apache's...

added the following attribute type:

entry = directory.newEntry(new 
LdapDN("m-oid="+SCHEMA_UIDS.get("slpIntegerAttribute")+", 
ou=attributeTypes, cn=slpService, ou=schema"));
entry.add("objectClass", "top","metaAttributeType", "metaTop");
entry.add("m-oid", SCHEMA_UIDS.get("slpIntegerAttribute"));
entry.add("m-name","slpIntegerAttribute");
entry.add("m-description", "The precursor for all new integer attribute 
types");
entry.add("m-equality","integerMatch");
entry.add("m-syntax", "1.3.6.1.4.1.1466.115.121.1.27");
directory.getAdminSession().add(entry);


then added a new attribute "slpInteger-number" with "SUP 
slpIntegerAttribute" (is correctly added to the registry):

then added a new entry that looks like this:

[STORE]: storing service service:osgi://hugentobler:124 as entry ServerEntry
    dn[]: slpserviceurl=service:osgi://hugentobler:124,dc=slpservices
    objectClass: slpService
    objectClass: extensibleObject
    slpInteger-number: 42
    slpInteger-number: 1337
    slpScopeList: default
    slpAttributeList: (number=42, 1337)
    slpScope: default
    slpServiceUrl: service:osgi://hugentobler:124

AND NOW I SEARCH WITH THE FOLLOWING FILTER:
String filter = 
(&(slpScope=default)(&(slpServiceUrl=service:osgi*)(|(slpInteger-number>=3000)(slpInteger-number<=40))))

with the following code:
List<Service> results = new ArrayList<Service>();
CoreSession session = directory.getAdminSession();
ServerLdapContext ctx = new ServerLdapContext(directory,session,new 
LdapDN("dc=slpservices"));
NamingEnumeration<SearchResult> list = ctx.search("", filter,new 
SearchControls());



=> THIS RETURNS THE AFOREMENTIONED ENTRY!!!
but it shouldn't, as the last disjunction is false, as both numbers are 
between 40 and 3000...

can anybody see where i went wrong?? or is there an error in the filter 
parsing within ADS?


cheers,
lorenz


Re: lookup returns an entry it shouldn't??

Posted by Alex Karasulu <ak...@gmail.com>.
Ok thanks.  Please make sure that you are using the latest ADS branch (trunk
I believe) to provide your patches.  This way we can make the changes fast
and get our a release with the fixes you need.

Regards,
Alex

On Wed, Dec 24, 2008 at 5:25 PM, Lorenz Breu <br...@hot-shot.com> wrote:

> Yes, there is definitely something wrong with the way ADS compares
> integers. I have JIRA'ed the issue.
>
> I have also hacked together a quick solution and some tests that seem to
> suggest the fix works for now... I hope I can release the code soon, as
> I always have to check with the ETH as I am stuck in the middle of my
> MSc thesis.
>
> lorenz
>

Re: lookup returns an entry it shouldn't??

Posted by Lorenz Breu <br...@hot-shot.com>.
Yes, there is definitely something wrong with the way ADS compares
integers. I have JIRA'ed the issue.

I have also hacked together a quick solution and some tests that seem to
suggest the fix works for now... I hope I can release the code soon, as
I always have to check with the ETH as I am stuck in the middle of my
MSc thesis.

lorenz

Re: lookup returns an entry it shouldn't??

Posted by Alex Karasulu <ak...@gmail.com>.
I just noticed this email. Did you get a response to this email?

Alex

On Fri, Dec 19, 2008 at 10:03 AM, Lorenz Breu <br...@hot-shot.com> wrote:

> hi guys
>
> while testing my application that uses ADS as a backend (embedded) i
> noticed the following weird behaviour and would like to ask if it is my bad,
> or the apache's...
>
> added the following attribute type:
>
> entry = directory.newEntry(new
> LdapDN("m-oid="+SCHEMA_UIDS.get("slpIntegerAttribute")+", ou=attributeTypes,
> cn=slpService, ou=schema"));
> entry.add("objectClass", "top","metaAttributeType", "metaTop");
> entry.add("m-oid", SCHEMA_UIDS.get("slpIntegerAttribute"));
> entry.add("m-name","slpIntegerAttribute");
> entry.add("m-description", "The precursor for all new integer attribute
> types");
> entry.add("m-equality","integerMatch");
> entry.add("m-syntax", "1.3.6.1.4.1.1466.115.121.1.27");
> directory.getAdminSession().add(entry);
>
>
> then added a new attribute "slpInteger-number" with "SUP
> slpIntegerAttribute" (is correctly added to the registry):
>
> then added a new entry that looks like this:
>
> [STORE]: storing service service:osgi://hugentobler:124 as entry
> ServerEntry
>   dn[]: slpserviceurl=service:osgi://hugentobler:124,dc=slpservices
>   objectClass: slpService
>   objectClass: extensibleObject
>   slpInteger-number: 42
>   slpInteger-number: 1337
>   slpScopeList: default
>   slpAttributeList: (number=42, 1337)
>   slpScope: default
>   slpServiceUrl: service:osgi://hugentobler:124
>
> AND NOW I SEARCH WITH THE FOLLOWING FILTER:
> String filter =
> (&(slpScope=default)(&(slpServiceUrl=service:osgi*)(|(slpInteger-number>=3000)(slpInteger-number<=40))))
>
> with the following code:
> List<Service> results = new ArrayList<Service>();
> CoreSession session = directory.getAdminSession();
> ServerLdapContext ctx = new ServerLdapContext(directory,session,new
> LdapDN("dc=slpservices"));
> NamingEnumeration<SearchResult> list = ctx.search("", filter,new
> SearchControls());
>
>
>
> => THIS RETURNS THE AFOREMENTIONED ENTRY!!!
> but it shouldn't, as the last disjunction is false, as both numbers are
> between 40 and 3000...
>
> can anybody see where i went wrong?? or is there an error in the filter
> parsing within ADS?
>
>
> cheers,
> lorenz
>
>