changeset 6383:431c2b754123

8012243: about 30% regression on specjvm2008.serial on 7u25 comparing 7u21 Reviewed-by: alanb, skoivu, smarks, mchung
author dfuchs
date Wed, 01 May 2013 00:49:21 +0200
parents 2dc2b6b34b00
children c448f31eb138
files src/share/classes/java/io/ObjectStreamClass.java src/share/classes/java/io/ObjectStreamField.java
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/io/ObjectStreamClass.java	Tue Feb 12 16:11:40 2013 +0400
+++ b/src/share/classes/java/io/ObjectStreamClass.java	Wed May 01 00:49:21 2013 +0200
@@ -266,9 +266,11 @@
         if (cl == null) {
             return null;
         }
-        Class<?> caller = Reflection.getCallerClass();
-        if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
-            ReflectUtil.checkPackageAccess(cl);
+        if (System.getSecurityManager() != null) {
+            Class<?> caller = Reflection.getCallerClass();
+            if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
+                ReflectUtil.checkPackageAccess(cl);
+            }
         }
         return cl;
     }
--- a/src/share/classes/java/io/ObjectStreamField.java	Tue Feb 12 16:11:40 2013 +0400
+++ b/src/share/classes/java/io/ObjectStreamField.java	Wed May 01 00:49:21 2013 +0200
@@ -162,9 +162,11 @@
      */
     @CallerSensitive
     public Class<?> getType() {
-        Class<?> caller = Reflection.getCallerClass();
-        if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) {
-            ReflectUtil.checkPackageAccess(type);
+        if (System.getSecurityManager() != null) {
+            Class<?> caller = Reflection.getCallerClass();
+            if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) {
+                ReflectUtil.checkPackageAccess(type);
+            }
         }
         return type;
     }