com.sun.corba.se.impl.encoding.EncapsInputStream Java Examples

The following examples show how to use com.sun.corba.se.impl.encoding.EncapsInputStream. 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: INSURLOperationImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #2
Source File: CorbaClientRequestDispatcherImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #3
Source File: INSURLOperationImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #4
Source File: CorbaClientRequestDispatcherImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #5
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #6
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #7
Source File: CorbaClientRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #8
Source File: INSURLOperationImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #9
Source File: INSURLOperationImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #10
Source File: CorbaClientRequestDispatcherImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #11
Source File: INSURLOperationImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** This static method takes a Stringified IOR and converts it into IOR object.
  * It is the caller's responsibility to only pass strings that start with "IOR:".
  */
private org.omg.CORBA.Object getIORFromString( String str )
{
    // Length must be even for str to be valid
    if ( (str.length() & 1) == 1 )
        throw wrapper.badStringifiedIorLen() ;

    byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE];
    for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) {
         buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
         buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
    }
    EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
            orb.getORBData().getGIOPVersion());
    s.consumeEndian();
    return s.read_Object() ;
}
 
Example #12
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #13
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void getExceptionDetailMessage(
    CorbaMessageMediator  messageMediator,
    ORBUtilSystemException wrapper)
{
    ServiceContext sc = messageMediator.getReplyServiceContexts()
        .get(ExceptionDetailMessage.value);
    if (sc == null)
        return ;

    if (! (sc instanceof UnknownServiceContext)) {
        throw wrapper.badExceptionDetailMessageServiceContextType();
    }
    byte[] data = ((UnknownServiceContext)sc).getData();
    EncapsInputStream in =
            EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
                                  data, data.length);
    in.consumeEndian();

    String msg =
          "----------BEGIN server-side stack trace----------\n"
        + in.read_wstring() + "\n"
        + "----------END server-side stack trace----------";

    messageMediator.setReplyExceptionDetailMessage(msg);
}
 
Example #14
Source File: IIOPProfileImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
{
    this( orb ) ;

    if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
        profile.profile_data == null) {
        throw wrapper.invalidTaggedProfile() ;
    }

    EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
            profile.profile_data.length);
    istr.consumeEndian();
    init( istr ) ;
}
 
Example #15
Source File: AnyImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream() {
    final org.omg.CORBA.portable.InputStream is = super
            .create_input_stream();
    AnyInputStream aIS = AccessController
            .doPrivileged(new PrivilegedAction<AnyInputStream>() {
                @Override
                public AnyInputStream run() {
                    return new AnyInputStream(
                            (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
                }
            });
    return aIS;
}
 
Example #16
Source File: AnyImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.portable.InputStream create_input_stream() {
    final org.omg.CORBA.portable.InputStream is = super
            .create_input_stream();
    AnyInputStream aIS = AccessController
            .doPrivileged(new PrivilegedAction<AnyInputStream>() {
                @Override
                public AnyInputStream run() {
                    return new AnyInputStream(
                            (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
                }
            });
    return aIS;
}
 
Example #17
Source File: EncapsInputStreamFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}
 
Example #18
Source File: EncapsInputStreamFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example #19
Source File: EncapsInputStreamFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size);
                }
            });
}
 
Example #20
Source File: EncapsulationUtility.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Helper method to read the octet array from is, deencapsulate it,
* and return
* as another InputStream.  This must be called inside the
* constructor of a derived class to obtain the correct stream
* for unmarshalling data.
*/
static public InputStream getEncapsulationStream( InputStream is )
{
    byte[] data = readOctets( is ) ;
    EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
            data.length ) ;
    result.consumeEndian() ;
    return result ;
}
 
Example #21
Source File: EncapsulationUtility.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Helper method to read the octet array from is, deencapsulate it,
* and return
* as another InputStream.  This must be called inside the
* constructor of a derived class to obtain the correct stream
* for unmarshalling data.
*/
static public InputStream getEncapsulationStream( InputStream is )
{
    byte[] data = readOctets( is ) ;
    EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
            data.length ) ;
    result.consumeEndian() ;
    return result ;
}
 
Example #22
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size,
        final GIOPVersion version, final CodeBase codeBase) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size, version,
                            codeBase);
                }
            });
}
 
Example #23
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size, version);
                }
            });
}
 
Example #24
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final EncapsInputStream eis) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(eis);
                }
            });
}
 
Example #25
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, data, size);
                }
            });
}
 
Example #26
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}
 
Example #27
Source File: EncapsInputStreamFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example #28
Source File: IIOPProfileImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile)
{
    this( orb ) ;

    if (profile == null || profile.tag != TAG_INTERNET_IOP.value ||
        profile.profile_data == null) {
        throw wrapper.invalidTaggedProfile() ;
    }

    EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
            profile.profile_data.length);
    istr.consumeEndian();
    init( istr ) ;
}
 
Example #29
Source File: EncapsInputStreamFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
        final boolean littleEndian, final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, buf, size,
                            littleEndian, version);
                }
            });
}
 
Example #30
Source File: EncapsInputStreamFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static EncapsInputStream newEncapsInputStream(
        final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
        final int size, final boolean littleEndian,
        final GIOPVersion version) {
    return AccessController
            .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
                @Override
                public EncapsInputStream run() {
                    return new EncapsInputStream(orb, byteBuffer, size,
                            littleEndian, version);
                }
            });
}