jdk/src/java.base/share/classes/java/lang/System.java
changeset 43221 eef9383d25cb
parent 42338 a60f280f803c
child 43891 59f9fbf2b7f0
child 43712 5dfd0950317c
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Thu Jan 19 18:03:24 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Thu Jan 19 13:50:02 2017 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -310,12 +310,13 @@
      * @see SecurityManager#checkPermission
      * @see java.lang.RuntimePermission
      */
-    public static
-    void setSecurityManager(final SecurityManager s) {
-        try {
-            s.checkPackageAccess("java.lang");
-        } catch (Exception e) {
-            // no-op
+    public static void setSecurityManager(final SecurityManager s) {
+        if (s != null) {
+            try {
+                s.checkPackageAccess("java.lang");
+            } catch (Exception e) {
+                // no-op
+            }
         }
         setSecurityManager0(s);
     }