sun.corba.SharedSecrets Java Examples

The following examples show how to use sun.corba.SharedSecrets. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StubIORImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public  void doRead( java.io.ObjectInputStream stream )
    throws IOException, ClassNotFoundException
{
    // read the IOR from the ObjectInputStream
    int typeLength = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, typeLength);
    typeData = new byte[typeLength];
    stream.readFully(typeData);

    int numProfiles = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, int[].class, numProfiles);
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, numProfiles);
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = stream.readInt();
        int dataSize = stream.readInt();
        SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, dataSize);
        profileData[i] = new byte[dataSize];
        stream.readFully(profileData[i]);
    }
}
 
Example #2
Source File: StubIORImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public  void doRead( java.io.ObjectInputStream stream )
    throws IOException, ClassNotFoundException
{
    // read the IOR from the ObjectInputStream
    int typeLength = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, typeLength);
    typeData = new byte[typeLength];
    stream.readFully(typeData);

    int numProfiles = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, int[].class, numProfiles);
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, numProfiles);
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = stream.readInt();
        int dataSize = stream.readInt();
        SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, dataSize);
        profileData[i] = new byte[dataSize];
        stream.readFully(profileData[i]);
    }
}
 
Example #3
Source File: StubIORImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public  void doRead( java.io.ObjectInputStream stream )
    throws IOException, ClassNotFoundException
{
    // read the IOR from the ObjectInputStream
    int typeLength = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, typeLength);
    typeData = new byte[typeLength];
    stream.readFully(typeData);

    int numProfiles = stream.readInt();
    SharedSecrets.getJavaOISAccess().checkArray(stream, int[].class, numProfiles);
    SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, numProfiles);
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = stream.readInt();
        int dataSize = stream.readInt();
        SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, dataSize);
        profileData[i] = new byte[dataSize];
        stream.readFully(profileData[i]);
    }
}
 
Example #4
Source File: ParserTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIIOPPrimaryToContactInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iiopPrimaryToContactInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
                    return iiopPrimaryToContactInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #5
Source File: ParserTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeSocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> socketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
                    return socketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #6
Source File: ParserTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeContactInfoListFactoryOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> contactInfoListFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (CorbaContactInfoListFactory.class.isAssignableFrom(
                    contactInfoListFactoryClass)) {
                    return contactInfoListFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalContactInfoListFactoryType(
                        contactInfoListFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badContactInfoListFactory( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #7
Source File: OperationFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Object operate( Object value )
{
    String className = getString( value ) ;

    try {
        Class<?> result =
            SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
        return result ;
    } catch (Exception exc) {
        ORBUtilSystemException wrapper = ORBUtilSystemException.get(
            CORBALogDomains.ORB_LIFECYCLE ) ;
        throw wrapper.couldNotLoadClass( exc, className ) ;
    }
}
 
Example #8
Source File: MessageBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static SystemException getSystemException(
    String exClassName, int minorCode, CompletionStatus completionStatus,
    String message, ORBUtilSystemException wrapper)
{
    SystemException sysEx = null;

    try {
        Class<?> clazz =
            SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
        if (message == null) {
            sysEx = (SystemException) clazz.newInstance();
        } else {
            Class[] types = { String.class };
            Constructor constructor = clazz.getConstructor(types);
            Object[] args = { message };
            sysEx = (SystemException)constructor.newInstance(args);
        }
    } catch (Exception someEx) {
        throw wrapper.badSystemExceptionInReply(
            CompletionStatus.COMPLETED_MAYBE, someEx );
    }

    sysEx.minor = minorCode;
    sysEx.completed = completionStatus;

    return sysEx;
}
 
Example #9
Source File: ParserTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIORToSocketInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iorToSocketInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
                    return iorToSocketInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #10
Source File: ParserTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIIOPPrimaryToContactInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iiopPrimaryToContactInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
                    return iiopPrimaryToContactInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #11
Source File: ParserTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeContactInfoListFactoryOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> contactInfoListFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (CorbaContactInfoListFactory.class.isAssignableFrom(
                    contactInfoListFactoryClass)) {
                    return contactInfoListFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalContactInfoListFactoryType(
                        contactInfoListFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badContactInfoListFactory( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #12
Source File: OperationFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object operate( Object value )
{
    String className = getString( value ) ;

    try {
        Class<?> result =
            SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
        return result ;
    } catch (Exception exc) {
        ORBUtilSystemException wrapper = ORBUtilSystemException.get(
            CORBALogDomains.ORB_LIFECYCLE ) ;
        throw wrapper.couldNotLoadClass( exc, className ) ;
    }
}
 
Example #13
Source File: ParserTable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeSocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> socketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
                    return socketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #14
Source File: ParserTable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIIOPPrimaryToContactInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iiopPrimaryToContactInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
                    return iiopPrimaryToContactInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #15
Source File: ParserTable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIORToSocketInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iorToSocketInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
                    return iorToSocketInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #16
Source File: ParserTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeSocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> socketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
                    return socketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #17
Source File: ParserTable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeLegacySocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> legacySocketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
                    return legacySocketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #18
Source File: ParserTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIORToSocketInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iorToSocketInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
                    return iorToSocketInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #19
Source File: ParserTable.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeLegacySocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> legacySocketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
                    return legacySocketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #20
Source File: ParserTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeLegacySocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> legacySocketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
                    return legacySocketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #21
Source File: MessageBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static SystemException getSystemException(
    String exClassName, int minorCode, CompletionStatus completionStatus,
    String message, ORBUtilSystemException wrapper)
{
    SystemException sysEx = null;

    try {
        Class<?> clazz =
            SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
        if (message == null) {
            sysEx = (SystemException) clazz.newInstance();
        } else {
            Class[] types = { String.class };
            Constructor constructor = clazz.getConstructor(types);
            Object[] args = { message };
            sysEx = (SystemException)constructor.newInstance(args);
        }
    } catch (Exception someEx) {
        throw wrapper.badSystemExceptionInReply(
            CompletionStatus.COMPLETED_MAYBE, someEx );
    }

    sysEx.minor = minorCode;
    sysEx.completed = completionStatus;

    return sysEx;
}
 
Example #22
Source File: OperationFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Object operate( Object value )
{
    String className = getString( value ) ;

    try {
        Class<?> result =
            SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
        return result ;
    } catch (Exception exc) {
        ORBUtilSystemException wrapper = ORBUtilSystemException.get(
            CORBALogDomains.ORB_LIFECYCLE ) ;
        throw wrapper.couldNotLoadClass( exc, className ) ;
    }
}
 
Example #23
Source File: ParserTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeContactInfoListFactoryOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> contactInfoListFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (CorbaContactInfoListFactory.class.isAssignableFrom(
                    contactInfoListFactoryClass)) {
                    return contactInfoListFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalContactInfoListFactoryType(
                        contactInfoListFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badContactInfoListFactory( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #24
Source File: ParserTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIIOPPrimaryToContactInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iiopPrimaryToContactInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
                    return iiopPrimaryToContactInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #25
Source File: ParserTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeIORToSocketInfoOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> iorToSocketInfoClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
                    return iorToSocketInfoClass.newInstance();
                } else {
                    throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
            }
        }
    } ;

    return op ;
}
 
Example #26
Source File: ParserTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeSocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> socketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
                    return socketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #27
Source File: ParserTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeLegacySocketFactoryOperation()
{
    Operation sfop = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> legacySocketFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
                    return legacySocketFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badCustomSocketFactory( ex, param ) ;
            }
        }
    } ;

    return sfop ;
}
 
Example #28
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static SystemException getSystemException(
    String exClassName, int minorCode, CompletionStatus completionStatus,
    String message, ORBUtilSystemException wrapper)
{
    SystemException sysEx = null;

    try {
        Class<?> clazz =
            SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
        if (message == null) {
            sysEx = (SystemException) clazz.newInstance();
        } else {
            Class[] types = { String.class };
            Constructor constructor = clazz.getConstructor(types);
            Object[] args = { message };
            sysEx = (SystemException)constructor.newInstance(args);
        }
    } catch (Exception someEx) {
        throw wrapper.badSystemExceptionInReply(
            CompletionStatus.COMPLETED_MAYBE, someEx );
    }

    sysEx.minor = minorCode;
    sysEx.completed = completionStatus;

    return sysEx;
}
 
Example #29
Source File: OperationFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Object operate( Object value )
{
    String className = getString( value ) ;

    try {
        Class<?> result =
            SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
        return result ;
    } catch (Exception exc) {
        ORBUtilSystemException wrapper = ORBUtilSystemException.get(
            CORBALogDomains.ORB_LIFECYCLE ) ;
        throw wrapper.couldNotLoadClass( exc, className ) ;
    }
}
 
Example #30
Source File: ParserTable.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeContactInfoListFactoryOperation()
{
    Operation op = new Operation() {
        public Object operate( Object value )
        {
            String param = (String)value ;

            try {
                Class<?> contactInfoListFactoryClass =
                    SharedSecrets.getJavaCorbaAccess().loadClass(param);
                // For security reasons avoid creating an instance if
                // this socket factory class is not one that would fail
                // the class cast anyway.
                if (CorbaContactInfoListFactory.class.isAssignableFrom(
                    contactInfoListFactoryClass)) {
                    return contactInfoListFactoryClass.newInstance();
                } else {
                    throw wrapper.illegalContactInfoListFactoryType(
                        contactInfoListFactoryClass.toString() ) ;
                }
            } catch (Exception ex) {
                // ClassNotFoundException, IllegalAccessException,
                // InstantiationException, SecurityException or
                // ClassCastException
                throw wrapper.badContactInfoListFactory( ex, param ) ;
            }
        }
    } ;

    return op ;
}