Rajalakshmi,
We do need a defect logged for this (if there isn't already one), but there are also some different code paths you can take to achieve the same results which will work until this issue is resolved. Try this:
IEntity person = context.getEntity("uid=riyer,o=JNDITest");
IAttribute tele = context.buildAttribute(URI.create("telephoneNumber"));
tele.addSimpleValue(ITypedValue.STRING_TYPE_URI, "25691129")
person.removeAttributeValue(tele);
You can also use person.getAttribute(URI.create("telephoneNumber")); to get the telephone attribute and either remove it, or from it, find the telephone number you want and remove that.
Jim
>>> Rajalakshmi S Iyer <iyer_rajalakshmi@xxxxxxxxxx> 05/19/08 1:08 AM >>>
Hello,
I am trying to remove an attribute's specified value from an Entity using the JNDI context provider. Here is the code:
IEntity person = context.getEntity("uid=riyer,o=JNDITest"); person.removeAttributeValue(new URI("telephoneNumber"), "25691129");
It is failing with a NullPointerException. The stack trace shows:
java.lang.NullPointerException at org.eclipse.higgins.idas.spi.BasicAttribute.<init>( BasicAttribute.java:105) at org.eclipse.higgins.idas.spi.BasicAttributeSet.removeAttributeValue( BasicAttributeSet.java:175) at org.eclipse.higgins.idas.spi.BasicEntity.removeAttributeValue( BasicEntity.java:228) at org.eclipse.higgins.idas.cp.jndi.JNDIEntity.removeAttributeValue( JNDIEntity.java:401) at org.eclipse.higgins.idas.cp.jndi.test.JNDICPTest.testRemoveAttributeValueFromPerson( JNDICPTest.java:108)
The problem lies in the BasicAttribute constructor:
public BasicAttribute( URI attrID, Object data, IAttributeContainer container, IContext context) throws IdASException { _context = context; // Turn the value into an IAttribute IAttributeValueModel valueModel = this .getModel().getValueModel(); .....
Here, the getModel() call is attempted on an uninitialized instance. It might be needed to modify this API to pass the Object data type as an argument.
Is this a known problem? If not, should I go ahead and create a bug report for the same?
Thanks, Best regards, Rajalakshmi Iyer
_______________________________________________ higgins-dev mailing list higgins-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/higgins-dev
|