[ https://issues.apache.org/jira/browse/DIRAPI-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny updated DIRAPI-317: ------------------------------------- Fix Version/s: (was: 2.0.0) 2.0.0.AM3 > Non thread-safe tests could lead to errors while running them > ------------------------------------------------------------- > > Key: DIRAPI-317 > URL: https://issues.apache.org/jira/browse/DIRAPI-317 > Project: Directory Client API > Issue Type: Bug > Affects Versions: 2.0.0.AM1 > Reporter: Emmanuel Lecharny > Priority: Major > Fix For: 2.0.0.AM3 > > > From time to time, we might get a test failure, like teh one reported on > Jenkins : > {noformat} > java.lang.NullPointerException > at > org.apache.directory.api.ldap.model.name.MultiThreadedTest.testNormalizeEquals(MultiThreadedTest.java:116) > {noformat} > This is due to the fact that we are modifying a static variable (the irony > ;-) : > {code:java} > public class MultiThreadedTest > { > @Rule > public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( 100, > 1000 ); > private static Dn sharedDn; > ... > @BeforeClass > public static void setup() throws Exception > { > schemaManager = new DefaultSchemaManager(); > referenceDn = new Dn( schemaManager, "dc=example,dc=com" ); > sharedDn = new Dn( schemaManager, "dc=example,dc=com" ); > ... > } > ... > @Test > public void testNormalizeHashCode() throws Exception > { > assertEquals( referenceAva.hashCode(), sharedAva.hashCode() ); > sharedRdn = new Rdn( schemaManager, sharedRdn ); > assertEquals( referenceRdn.hashCode(), sharedRdn.hashCode() ); > sharedDn = new Dn( schemaManager, sharedDn ); <------- This is > *very* wrong > assertEquals( referenceDn.hashCode(), sharedDn.hashCode() ); > } > ... > {code} > Many of the tests are updating the {{sharedDn}} - and some of the other > static declarations -, which may lead to invalid tests, as all the tests are > ran concurrently. > This has to be fixed. -- This message was sent by Atlassian JIRA (v7.6.3#76005)