Java Code Examples for org.omg.CORBA.MARSHAL

The following examples show how to use org.omg.CORBA.MARSHAL. These examples are extracted from open source projects. 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
public Any read_any() {
    Any any = orb.create_any();
    TypeCodeImpl tc = new TypeCodeImpl(orb);

    // read off the typecode

    // REVISIT We could avoid this try-catch if we could peek the typecode
    // kind off this stream and see if it is a tk_value.  Looking at the
    // code we know that for tk_value the Any.read_value() below
    // ignores the tc argument anyway (except for the kind field).
    // But still we would need to make sure that the whole typecode,
    // including encapsulations, is read off.
    try {
        tc.read_value(parent);
    } catch (MARSHAL ex) {
        if (tc.kind().value() != TCKind._tk_value)
            throw ex;
        // We can be sure that the whole typecode encapsulation has been
        // read off.
        dprintThrowable(ex);
    }
    // read off the value of the any
    any.read_value(parent, tc);

    return any;
}
 
Example 2
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 6 votes vote down vote up
public final int read(byte data[], int offset, int length) throws IOException{
    try{
        readObjectState.readData(this);

        orbStream.read_octet_array(data, offset, length);
        return length;
    } catch (MARSHAL marshalException) {
        if (marshalException.minor
            == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
            setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
            return -1;
        }

        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e) ;
        throw exc ;
    }

}
 
Example 3
public final int skipBytes(int len) throws IOException{
    try{
        readObjectState.readData(this);

        byte buf[] = new byte[len];
        orbStream.read_octet_array(buf, 0, len);
        return len;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);

        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e) ;
        throw exc ;
    }
}
 
Example 4
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 6 votes vote down vote up
public final int skipBytes(int len) throws IOException{
    try{
        readObjectState.readData(this);

        byte buf[] = new byte[len];
        orbStream.read_octet_array(buf, 0, len);
        return len;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);

        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e) ;
        throw exc ;
    }
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: IIOPInputStream.java    License: MIT License 6 votes vote down vote up
public final int skipBytes(int len) throws IOException{
    try{
        readObjectState.readData(this);

        byte buf[] = new byte[len];
        orbStream.read_octet_array(buf, 0, len);
        return len;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);

        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e) ;
        throw exc ;
    }
}
 
Example 6
Source Project: jdk8u60   Source File: ORBImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 7
public Any read_any() {
    Any any = orb.create_any();
    TypeCodeImpl tc = new TypeCodeImpl(orb);

    // read off the typecode

    // REVISIT We could avoid this try-catch if we could peek the typecode
    // kind off this stream and see if it is a tk_value.  Looking at the
    // code we know that for tk_value the Any.read_value() below
    // ignores the tc argument anyway (except for the kind field).
    // But still we would need to make sure that the whole typecode,
    // including encapsulations, is read off.
    try {
        tc.read_value(parent);
    } catch (MARSHAL ex) {
        if (tc.kind().value() != TCKind._tk_value)
            throw ex;
        // We can be sure that the whole typecode encapsulation has been
        // read off.
        dprintThrowable(ex);
    }
    // read off the value of the any
    any.read_value(parent, tc);

    return any;
}
 
Example 8
public final int read(byte data[], int offset, int length) throws IOException{
    try{
        readObjectState.readData(this);

        orbStream.read_octet_array(data, offset, length);
        return length;
    } catch (MARSHAL marshalException) {
        if (marshalException.minor
            == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
            setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
            return -1;
        }

        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e) ;
        throw exc ;
    }

}
 
Example 9
Source Project: JDKSourceCode1.8   Source File: IIOPInputStream.java    License: MIT License 5 votes vote down vote up
public final byte readByte() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_octet();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;

    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 10
Source Project: jdk1.8-source-analysis   Source File: OMGSystemException.java    License: Apache License 2.0 5 votes vote down vote up
public MARSHAL unableLocateValueFactory( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( UNABLE_LOCATE_VALUE_FACTORY, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.FINE )) {
        Object[] parameters = null ;
        doLog( Level.FINE, "OMG.unableLocateValueFactory",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 11
public final short readShort() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_short();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 12
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public final int readUnsignedByte() throws IOException{
    try{
        readObjectState.readData(this);

        return (orbStream.read_octet() << 0) & 0x000000FF;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 13
Source Project: JDKSourceCode1.8   Source File: OMGSystemException.java    License: MIT License 5 votes vote down vote up
public MARSHAL unsupportedFormatVersion( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( UNSUPPORTED_FORMAT_VERSION, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "OMG.unsupportedFormatVersion",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 14
Source Project: JDKSourceCode1.8   Source File: UtilSystemException.java    License: MIT License 5 votes vote down vote up
public MARSHAL invalidIndirection( CompletionStatus cs, Throwable t, Object arg0) {
    MARSHAL exc = new MARSHAL( INVALID_INDIRECTION, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = new Object[1] ;
        parameters[0] = arg0 ;
        doLog( Level.WARNING, "UTIL.invalidIndirection",
            parameters, UtilSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 15
Source Project: JDKSourceCode1.8   Source File: OMGSystemException.java    License: MIT License 5 votes vote down vote up
public MARSHAL rmiiiopOptionalDataIncompatible3( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE3, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.FINE )) {
        Object[] parameters = null ;
        doLog( Level.FINE, "OMG.rmiiiopOptionalDataIncompatible3",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 16
Source Project: JDKSourceCode1.8   Source File: UtilSystemException.java    License: MIT License 5 votes vote down vote up
public MARSHAL unableLocateValueHelper( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( UNABLE_LOCATE_VALUE_HELPER, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "UTIL.unableLocateValueHelper",
            parameters, UtilSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 17
public final byte readByte() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_octet();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;

    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 18
Source Project: jdk1.8-source-analysis   Source File: OMGSystemException.java    License: Apache License 2.0 5 votes vote down vote up
public MARSHAL wcharBadGiopVersionSent( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( WCHAR_BAD_GIOP_VERSION_SENT, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "OMG.wcharBadGiopVersionSent",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 19
public final int readUnsignedShort() throws IOException{
    try{
        readObjectState.readData(this);

        return (orbStream.read_ushort() << 0) & 0x0000FFFF;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 20
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public final float readFloat() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_float();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 21
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public final short readShort() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_short();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 22
Source Project: JDKSourceCode1.8   Source File: IIOPInputStream.java    License: MIT License 5 votes vote down vote up
public final boolean readBoolean() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_boolean();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;

    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 23
public final double readDouble() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_double();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 24
Source Project: jdk1.8-source-analysis   Source File: OMGSystemException.java    License: Apache License 2.0 5 votes vote down vote up
public MARSHAL unsupportedFormatVersion( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( UNSUPPORTED_FORMAT_VERSION, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "OMG.unsupportedFormatVersion",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 25
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public final String readUTF() throws IOException{
    try{
        readObjectState.readData(this);

        return internalReadUTF(orbStream);
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 26
Source Project: JDKSourceCode1.8   Source File: CDRInputStream_1_0.java    License: MIT License 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 27
Source Project: JDKSourceCode1.8   Source File: OMGSystemException.java    License: MIT License 5 votes vote down vote up
public MARSHAL rmiiiopOptionalDataIncompatible2( CompletionStatus cs, Throwable t ) {
    MARSHAL exc = new MARSHAL( RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE2, cs ) ;
    if (t != null)
        exc.initCause( t ) ;
    
    if (logger.isLoggable( Level.WARNING )) {
        Object[] parameters = null ;
        doLog( Level.WARNING, "OMG.rmiiiopOptionalDataIncompatible2",
            parameters, OMGSystemException.class, exc ) ;
    }
    
    return exc ;
}
 
Example 28
Source Project: JDKSourceCode1.8   Source File: IIOPInputStream.java    License: MIT License 5 votes vote down vote up
public final char readChar() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_wchar();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;

    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 29
Source Project: jdk8u60   Source File: IIOPInputStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public final int readInt() throws IOException{
    try{
        readObjectState.readData(this);

        return orbStream.read_long();
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}
 
Example 30
public final int readUnsignedShort() throws IOException{
    try{
        readObjectState.readData(this);

        return (orbStream.read_ushort() << 0) & 0x0000FFFF;
    } catch (MARSHAL marshalException) {
        handleOptionalDataMarshalException(marshalException, false);
        throw marshalException;
    } catch(Error e) {
        IOException exc = new IOException(e.getMessage());
        exc.initCause(e);
        throw exc ;
    }
}