Skip to content

JUnitXMLReporter does not synchronize the two synchronized collections when iterating #830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

emopers
Copy link
Contributor

@emopers emopers commented Oct 19, 2015

In lines 177 and 180 of JUnitXMLReporter, synchronized collections m_configIssues and m_allTests
are both iterated in an unsynchronized manner, but according to Oracle Java 7 API specification
(http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)),
although a synchronizedList is thread-safe for list manipulations like insertion and deletion,
manual synchronization is required when the collection is iterated.
Failure to do so might result in non-deterministic behavior.
This pull request adds a fix by synchronizing m_configIssues and m_allTests when iterating.

cbeust added a commit that referenced this pull request Oct 19, 2015
…on_17

JUnitXMLReporter does not synchronize the two synchronized collections when iterating
@cbeust cbeust merged commit b815c3c into testng-team:master Oct 19, 2015
@cbeust
Copy link
Collaborator

cbeust commented Oct 19, 2015

Thanks!

@emopers emopers deleted the Collections_SynchronizedCollection_17 branch December 28, 2015 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants