src/share/classes/sun/applet/AppletPanel.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1198     // Flag to indicate if applet is targeted for JDK 1.2.
1199     private boolean jdk12Applet = false;
1200 
1201     /**
1202      * Determine JDK level of an applet.
1203      */
1204     private void findAppletJDKLevel(Applet applet)
1205     {
1206         // To determine the JDK level of an applet, the
1207         // most reliable way is to check the major version
1208         // of the applet class file.
1209 
1210         // synchronized on applet class object, so calling from
1211         // different instances of the same applet will be
1212         // serialized.
1213         Class appletClass = applet.getClass();
1214 
1215         synchronized(appletClass)  {
1216             // Determine if the JDK level of an applet has been
1217             // checked before.
1218             Boolean jdk11Target = (Boolean) loader.isJDK11Target(appletClass);
1219             Boolean jdk12Target = (Boolean) loader.isJDK12Target(appletClass);
1220 
1221             // if applet JDK level has been checked before, retrieve
1222             // value and return.
1223             if (jdk11Target != null || jdk12Target != null) {
1224                 jdk11Applet = (jdk11Target == null) ? false : jdk11Target.booleanValue();
1225                 jdk12Applet = (jdk12Target == null) ? false : jdk12Target.booleanValue();
1226                 return;
1227             }
1228 
1229             String name = appletClass.getName();
1230 
1231             // first convert any '.' to '/'
1232             name = name.replace('.', '/');
1233 
1234             // append .class
1235             final String resourceName = name + ".class";
1236 
1237             byte[] classHeader = new byte[8];
1238 
1239             try (InputStream is = AccessController.doPrivileged(


   1 /*
   2  * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1198     // Flag to indicate if applet is targeted for JDK 1.2.
1199     private boolean jdk12Applet = false;
1200 
1201     /**
1202      * Determine JDK level of an applet.
1203      */
1204     private void findAppletJDKLevel(Applet applet)
1205     {
1206         // To determine the JDK level of an applet, the
1207         // most reliable way is to check the major version
1208         // of the applet class file.
1209 
1210         // synchronized on applet class object, so calling from
1211         // different instances of the same applet will be
1212         // serialized.
1213         Class appletClass = applet.getClass();
1214 
1215         synchronized(appletClass)  {
1216             // Determine if the JDK level of an applet has been
1217             // checked before.
1218             Boolean jdk11Target = loader.isJDK11Target(appletClass);
1219             Boolean jdk12Target = loader.isJDK12Target(appletClass);
1220 
1221             // if applet JDK level has been checked before, retrieve
1222             // value and return.
1223             if (jdk11Target != null || jdk12Target != null) {
1224                 jdk11Applet = (jdk11Target == null) ? false : jdk11Target.booleanValue();
1225                 jdk12Applet = (jdk12Target == null) ? false : jdk12Target.booleanValue();
1226                 return;
1227             }
1228 
1229             String name = appletClass.getName();
1230 
1231             // first convert any '.' to '/'
1232             name = name.replace('.', '/');
1233 
1234             // append .class
1235             final String resourceName = name + ".class";
1236 
1237             byte[] classHeader = new byte[8];
1238 
1239             try (InputStream is = AccessController.doPrivileged(