corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java
changeset 22361 ac542ac9f21d
parent 5555 b2b5ed3f0d0d
equal deleted inserted replaced
22173:f130ca87de66 22361:ac542ac9f21d
     1 /*
     1 /*
     2  * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2013 Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.corba.se.impl.presentation.rmi ;
    26 package com.sun.corba.se.impl.presentation.rmi ;
    27 
    27 
       
    28 import java.io.SerializablePermission;
    28 import java.lang.reflect.InvocationHandler ;
    29 import java.lang.reflect.InvocationHandler ;
    29 import java.lang.reflect.Proxy ;
    30 import java.lang.reflect.Proxy ;
    30 
    31 
    31 import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
    32 import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
    32 import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
    33 import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
    36 
    37 
    37 public abstract class StubFactoryDynamicBase extends StubFactoryBase
    38 public abstract class StubFactoryDynamicBase extends StubFactoryBase
    38 {
    39 {
    39     protected final ClassLoader loader ;
    40     protected final ClassLoader loader ;
    40 
    41 
    41     public StubFactoryDynamicBase( PresentationManager.ClassData classData,
    42     private static Void checkPermission() {
    42         ClassLoader loader )
    43         SecurityManager sm = System.getSecurityManager();
    43     {
    44         if (sm != null) {
    44         super( classData ) ;
    45             sm.checkPermission(new SerializablePermission(
       
    46                     "enableSubclassImplementation"));
       
    47         }
       
    48         return null;
       
    49     }
    45 
    50 
       
    51     private StubFactoryDynamicBase(Void unused,
       
    52             PresentationManager.ClassData classData, ClassLoader loader) {
       
    53         super(classData);
    46         // this.loader must not be null, or the newProxyInstance call
    54         // this.loader must not be null, or the newProxyInstance call
    47         // will fail.
    55         // will fail.
    48         if (loader == null) {
    56         if (loader == null) {
    49             ClassLoader cl = Thread.currentThread().getContextClassLoader();
    57             ClassLoader cl = Thread.currentThread().getContextClassLoader();
    50             if (cl == null)
    58             if (cl == null)
    53         } else {
    61         } else {
    54             this.loader = loader ;
    62             this.loader = loader ;
    55         }
    63         }
    56     }
    64     }
    57 
    65 
       
    66     public StubFactoryDynamicBase( PresentationManager.ClassData classData,
       
    67         ClassLoader loader )
       
    68     {
       
    69         this (checkPermission(), classData, loader);
       
    70     }
       
    71 
    58     public abstract org.omg.CORBA.Object makeStub() ;
    72     public abstract org.omg.CORBA.Object makeStub() ;
    59 }
    73 }