Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
-
Studio version 1.1.0.v20080303, ADS version 1.5.1.
Description
First I imported car-schema.ldif (see attachment) into ADS. Then I used this JNDI code to create a car entry:
Attributes attributes = new BasicAttributes();
Attribute objectClassAttribute = new BasicAttribute( "objectClass" );
objectClassAttribute.add( "top" );
objectClassAttribute.add( "car" );
attributes.put( objectClassAttribute );
Attribute modelAttribute = new BasicAttribute( "model" );
modelAttribute.add( model );
attributes.put( modelAttribute );
Attribute makeYearAttribute = new BasicAttribute( "makeYear" );
makeYearAttribute.add( makeYear );
attributes.put( makeYearAttribute );
DirContext ctx = new InitialDirContext(env);
DirContext carCtx = ctx.createSubcontext( "cn=car", attributes );
carCtx.close();
ctx.close();
model and makeYear are String and int, respectively.
Then I get this exception:
Operation failed: javax.naming.directory.InvalidAttributeValueException: Malformed 'makeYear' attribute value; remaining name 'cn=car'javax.naming.directory.InvalidAttributeValueException: Malformed 'makeYear' attribute value; remaining name 'cn=car'
at com.sun.jndi.ldap.LdapClient.encodeAttribute(LdapClient.java:951)
at com.sun.jndi.ldap.LdapClient.add(LdapClient.java:999)
at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:770)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(ComponentDirContext.java:319)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:248)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.createSubcontext(PartialCompositeDirContext.java:236)
at javax.naming.directory.InitialDirContext.createSubcontext(InitialDirContext.java:178)
at Car.main(Car.java:104)
The value of attributes is:
{makeYear=makeYear: 1986, objectClass=objectClass: top, car, model=model: volvo}Any ideas of what could be the matter?