+1 on all of Emmanuel's points. Let me add one additional option.
We could write some protective code to detect when the BasicAttributes is created without the
boolean argument for ignoring case. We should have some kind of RuntimeException for it.
Could be a ConfigurationException maybe? Don't know exactly but basically we need:
BasicAttributes attrs = ...
if ( ! attrs.isCaseIgnored() )
throw new "something that tells the user to correct this miss configuration of BasicAttributes";
you can raise a JIRA, because we should not allow NPE in the server.
Now, regarding Attributes(), you should *always* pass true as an
argument. This is a major drawback of JNDI as a generic API for
directory, because it does not take into account the underlying
directory it has to deal with. There is nothing we can do about it,
except fixing NPEs, when it comes to use ADS embedded (meaning :
without the network layer which automatically substitutes
BasicAttributes to a more ldap compliant BasicAttributesImpl...)
On 6/1/07, Simon.Temple@saaconsultants.com
< Simon.Temple@saaconsultants.com> wrote:
> We've found a problem with DS 1.0.2. This problem only exists when running
> with DS embedded in the same VM.
> Running the same code remotely (outside of DS VM) works fine.
> Example code:
> Attributes attrs = new BasicAttributes();
> attrs.put("objectClass", "organizationalUnit");
> attrs.put("description", "Test OU");
> DirContext subContext = context.createSubcontext("ou=Test",
> Exception from createSubcontext():
> Caused by: java.lang.NullPointerException
> org.apache.directory.server.core.schema.SchemaService.assertAllAttributesAllowed (SchemaService.java:1806)
> org.apache.directory.server.core.schema.SchemaService.add(SchemaService.java :1636)
> ... 130 more
> If you change the BasicAttributes() constructor call to:
> Attributes attrs = new BasicAttributes( true );
> it works fine.
> This issue means we cannot use DS 1.0.2. Should I raise a JIRA entry yet or
> should I hold off until you guys have had chance to check my findings?
> Many Thanks