Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: work in progress

...

Issues caused because of not checking for null, leading to compromise.

Noncompliant Code Example

Code Block
     AccessController.doPrivileged(new PrivilegedAction<Void>() {
                public Void run() {
                    ...
                }
            }, acc);

 

Compliant Solution

Code Block
        if (acc == null) {
            throw new SecurityException("Missing AccessControlContext");
        }
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
                public Void run() {
                    ...
                }
            }, acc);

Noncompliant Code Example

Code Block
System.setSecurityManager(null);