Hi guys,
I'm sure you have already experienced this issue. From time to time (not
frequently), when running integration tests, I get such an error :
testComplexNotRefinement(org.apache.directory.server.core.subtree.RefinementEvaluatorTest)
Time elapsed: 0.016 sec <<< ERROR!
org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException:
The 'objectClass' AttributeType and values must both be String or binary
at
org.apache.directory.api.ldap.model.entry.AbstractValue.apply(AbstractValue.java:166)
at
org.apache.directory.api.ldap.model.entry.BinaryValue.<init>(BinaryValue.java:111)
at
org.apache.directory.api.ldap.model.entry.DefaultAttribute.createBinaryValue(DefaultAttribute.java:107)
at
org.apache.directory.api.ldap.model.entry.DefaultAttribute.add(DefaultAttribute.java:1150)
at
org.apache.directory.api.ldap.model.entry.DefaultAttribute.<init>(DefaultAttribute.java:300)
at
org.apache.directory.api.ldap.model.entry.DefaultAttribute.<init>(DefaultAttribute.java:273)
at
org.apache.directory.server.core.subtree.RefinementEvaluatorTest.testComplexNotRefinement(RefinementEvaluatorTest.java:239)
I don't think we should freak out, as this problems pretty much boils
down to a static variable being initialized many times in tests that are
run concurrently :
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
public class RefinementEvaluatorTest
...
private static AttributeType OBJECT_CLASS_AT;
...
@BeforeClass
public static void init() throws Exception
{
...
OBJECT_CLASS_AT = schemaManager.getAttributeType( "objectClass" );
...
At this point, we can fix that by making this variable non static and
initialize it in a @Before method instead of doing so in a @Before class.
Otherwise, the root cause is that we do this check :
boolean isHR =
attributeType.getSyntax().isHumanReadable();
if ( isHR != isHumanReadable() )
{
String message = "The '" +
attributeType.getName() + "' AttributeType and values must "
+ "both be String or binary";
LOG.error( message );
throw new LdapInvalidAttributeValueException(
ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
}
and it's perfectly plausible that between the initialization of the isHr
variable and the test, we have a new initialization of the
attributeType, resetting the isHr flag.
Just wznted to let you know...