Versions Compared

Key

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

...

This class definition does not violate guideline rule VNA02-J. Ensure that compound operations on shared variables are atomic, which only applies to classes that promise thread-safety. However, this class has a mutable static counter field that is modified by the publicly accessible incrementCounter() method. Consequently, this class cannot be used securely by trusted client code, if untrusted code can purposely fail to externally synchronize access to the field.

...

This compliant solution uses a static private final lock to protect the counter field and, consequently, does not depend on any external synchronization. This solution also complies with guideline rule LCK00-J. Use private final lock objects to synchronize classes that may interact with untrusted code.

...

Any vulnerabilities resulting from the violation of this guideline rule are listed on the CERT website.

...