Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is imperative that the user manually synchronize on the returned map when iterating over any of its collection views... Failure to follow this advice may result in non-deterministic behavior.

When Synchronize on the Collection object when using synchronization wrappers, the synchronization object should be the Collection object. The . This synchronization is necessary to enforce atomicity (CON07-J. Do not assume that a grouping of calls to independently atomic methods is atomic).

...

Synchronizing on a collection view instead of the collection object provides a false sense of thread safety and may cause non-deterministic behavior.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

CON40-J

medium

probable

medium

P8

L2

Automated Detection

The following table summarizes the examples flagged as violations by FindBugs:

Noncompliant Code Example

Flagged

Checker

Message

Collection view

No

n/a

The following table summarizes the examples flagged as violations by SureLogic Flashlight:

Noncompliant Code Example

Flagged

Message

Collection view

No

No obvious issues

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...