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

The following examples show how to use com.sun.corba.se.impl.encoding.CodeSetComponentInfo. 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: CDRInputObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the default CDR factory behavior to get the
 * negotiated code sets from the connection.
 *
 * These are only called once per message, the first time needed.
 *
 * In the local case, there is no Connection, so use the
 * local code sets.
 */
protected CodeSetConversion.BTCConverter createCharBTCConverter() {
    CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

    // If the connection doesn't have its negotiated
    // code sets by now, fall back on the defaults defined
    // in CDRInputStream.
    if (codesets == null)
        return super.createCharBTCConverter();

    OSFCodeSetRegistry.Entry charSet
        = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

    if (charSet == null)
        throw wrapper.unknownCodeset( charSet ) ;

    return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
}
 
Example #2
Source File: CDRInputObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the default CDR factory behavior to get the
 * negotiated code sets from the connection.
 *
 * These are only called once per message, the first time needed.
 *
 * In the local case, there is no Connection, so use the
 * local code sets.
 */
protected CodeSetConversion.BTCConverter createCharBTCConverter() {
    CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

    // If the connection doesn't have its negotiated
    // code sets by now, fall back on the defaults defined
    // in CDRInputStream.
    if (codesets == null)
        return super.createCharBTCConverter();

    OSFCodeSetRegistry.Entry charSet
        = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

    if (charSet == null)
        throw wrapper.unknownCodeset( charSet ) ;

    return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
}
 
Example #3
Source File: SocketOrChannelConnectionImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public CodeSetComponentInfo.CodeSetContext getCodeSetContext() {
    // Needs to be synchronized for the following case when the client
    // doesn't send the code set context twice, and we have two threads
    // in ServerRequestDispatcher processCodeSetContext.
    //
    // Thread A checks to see if there is a context, there is none, so
    //     it calls setCodeSetContext, getting the synch lock.
    // Thread B checks to see if there is a context.  If we didn't synch,
    //     it might decide to outlaw wchar/wstring.
    if (codeSetContext == null) {
        synchronized(this) {
            return codeSetContext;
        }
    }

    return codeSetContext;
}
 
Example #4
Source File: CDRInputObject.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Override the default CDR factory behavior to get the
 * negotiated code sets from the connection.
 *
 * These are only called once per message, the first time needed.
 *
 * In the local case, there is no Connection, so use the
 * local code sets.
 */
protected CodeSetConversion.BTCConverter createCharBTCConverter() {
    CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

    // If the connection doesn't have its negotiated
    // code sets by now, fall back on the defaults defined
    // in CDRInputStream.
    if (codesets == null)
        return super.createCharBTCConverter();

    OSFCodeSetRegistry.Entry charSet
        = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

    if (charSet == null)
        throw wrapper.unknownCodeset( charSet ) ;

    return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
}
 
Example #5
Source File: CDROutputObject.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Override the default CDR factory behavior to get the
 * negotiated code sets from the connection.
 *
 * These are only called once per message, the first time needed.
 *
 * In the local case, there is no Connection, so use the
 * local code sets.
 */
protected CodeSetConversion.CTBConverter createCharCTBConverter() {
    CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

    // If the connection doesn't have its negotiated
    // code sets by now, fall back on the defaults defined
    // in CDRInputStream.
    if (codesets == null)
        return super.createCharCTBConverter();

    OSFCodeSetRegistry.Entry charSet
        = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

    if (charSet == null)
        throw wrapper.unknownCodeset( charSet ) ;

    return CodeSetConversion.impl().getCTBConverter(charSet,
                                                    isLittleEndian(),
                                                    false);
}
 
Example #6
Source File: SocketOrChannelConnectionImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public CodeSetComponentInfo.CodeSetContext getCodeSetContext() {
    // Needs to be synchronized for the following case when the client
    // doesn't send the code set context twice, and we have two threads
    // in ServerRequestDispatcher processCodeSetContext.
    //
    // Thread A checks to see if there is a context, there is none, so
    //     it calls setCodeSetContext, getting the synch lock.
    // Thread B checks to see if there is a context.  If we didn't synch,
    //     it might decide to outlaw wchar/wstring.
    if (codeSetContext == null) {
        synchronized(this) {
            return codeSetContext;
        }
    }

    return codeSetContext;
}
 
Example #7
Source File: CDRInputObject.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Override the default CDR factory behavior to get the
 * negotiated code sets from the connection.
 *
 * These are only called once per message, the first time needed.
 *
 * In the local case, there is no Connection, so use the
 * local code sets.
 */
protected CodeSetConversion.BTCConverter createCharBTCConverter() {
    CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

    // If the connection doesn't have its negotiated
    // code sets by now, fall back on the defaults defined
    // in CDRInputStream.
    if (codesets == null)
        return super.createCharBTCConverter();

    OSFCodeSetRegistry.Entry charSet
        = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

    if (charSet == null)
        throw wrapper.unknownCodeset( charSet ) ;

    return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
}
 
Example #8
Source File: SocketOrChannelConnectionImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #9
Source File: SocketOrChannelConnectionImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #10
Source File: CodeSetsComponentImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
{
    if (orb == null)
        csci = new CodeSetComponentInfo();
    else
        csci = orb.getORBData().getCodeSetComponentInfo();
}
 
Example #11
Source File: CDRInputObject.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected CodeSetConversion.BTCConverter createWCharBTCConverter() {

        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, we have to throw an exception.
        // See CORBA formal 00-11-03 13.9.2.6.
        if (codesets == null) {
            if (getConnection().isServer())
                throw omgWrapper.noClientWcharCodesetCtx() ;
            else
                throw omgWrapper.noServerWcharCodesetCmp() ;
        }

        OSFCodeSetRegistry.Entry wcharSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());

        if (wcharSet == null)
            throw wrapper.unknownCodeset( wcharSet ) ;

        // For GIOP 1.2 and UTF-16, use big endian if there is no byte
        // order marker.  (See issue 3405b)
        //
        // For GIOP 1.1 and UTF-16, use the byte order the stream if
        // there isn't (and there shouldn't be) a byte order marker.
        //
        // GIOP 1.0 doesn't have wchars.  If we're talking to a legacy ORB,
        // we do what our old ORBs did.
        if (wcharSet == OSFCodeSetRegistry.UTF_16) {
            if (getGIOPVersion().equals(GIOPVersion.V1_2))
                return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
        }

        return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
    }
 
Example #12
Source File: ParserTable.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private Operation makeCSOperation()
{
    Operation csop = new Operation() {
        public Object operate( Object value )
        {
            String val = (String)value ;
            return CodeSetComponentInfo.createFromString( val ) ;
        }
    } ;

    return csop ;
}
 
Example #13
Source File: SocketOrChannelConnectionImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #14
Source File: CodeSetsComponentImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
{
    if (orb == null)
        csci = new CodeSetComponentInfo();
    else
        csci = orb.getORBData().getCodeSetComponentInfo();
}
 
Example #15
Source File: SocketOrChannelConnectionImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #16
Source File: SocketOrChannelConnectionImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #17
Source File: SocketOrChannelConnectionImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
    // Double check whether or not we need to do this
    if (codeSetContext == null) {

        if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
            OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
            // If the client says it's negotiated a code set that
            // isn't a fallback and we never said we support, then
            // it has a bug.
            throw wrapper.badCodesetsFromClient() ;
        }

        codeSetContext = csc;
    }
}
 
Example #18
Source File: ParserTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeCSOperation()
{
    Operation csop = new Operation() {
        public Object operate( Object value )
        {
            String val = (String)value ;
            return CodeSetComponentInfo.createFromString( val ) ;
        }
    } ;

    return csop ;
}
 
Example #19
Source File: CDRInputObject.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected CodeSetConversion.BTCConverter createWCharBTCConverter() {

        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, we have to throw an exception.
        // See CORBA formal 00-11-03 13.9.2.6.
        if (codesets == null) {
            if (getConnection().isServer())
                throw omgWrapper.noClientWcharCodesetCtx() ;
            else
                throw omgWrapper.noServerWcharCodesetCmp() ;
        }

        OSFCodeSetRegistry.Entry wcharSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());

        if (wcharSet == null)
            throw wrapper.unknownCodeset( wcharSet ) ;

        // For GIOP 1.2 and UTF-16, use big endian if there is no byte
        // order marker.  (See issue 3405b)
        //
        // For GIOP 1.1 and UTF-16, use the byte order the stream if
        // there isn't (and there shouldn't be) a byte order marker.
        //
        // GIOP 1.0 doesn't have wchars.  If we're talking to a legacy ORB,
        // we do what our old ORBs did.
        if (wcharSet == OSFCodeSetRegistry.UTF_16) {
            if (getGIOPVersion().equals(GIOPVersion.V1_2))
                return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
        }

        return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
    }
 
Example #20
Source File: ParserTable.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private Operation makeCSOperation()
{
    Operation csop = new Operation() {
        public Object operate( Object value )
        {
            String val = (String)value ;
            return CodeSetComponentInfo.createFromString( val ) ;
        }
    } ;

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

    return csop ;
}
 
Example #22
Source File: CDRInputObject.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected CodeSetConversion.BTCConverter createWCharBTCConverter() {

        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, we have to throw an exception.
        // See CORBA formal 00-11-03 13.9.2.6.
        if (codesets == null) {
            if (getConnection().isServer())
                throw omgWrapper.noClientWcharCodesetCtx() ;
            else
                throw omgWrapper.noServerWcharCodesetCmp() ;
        }

        OSFCodeSetRegistry.Entry wcharSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());

        if (wcharSet == null)
            throw wrapper.unknownCodeset( wcharSet ) ;

        // For GIOP 1.2 and UTF-16, use big endian if there is no byte
        // order marker.  (See issue 3405b)
        //
        // For GIOP 1.1 and UTF-16, use the byte order the stream if
        // there isn't (and there shouldn't be) a byte order marker.
        //
        // GIOP 1.0 doesn't have wchars.  If we're talking to a legacy ORB,
        // we do what our old ORBs did.
        if (wcharSet == OSFCodeSetRegistry.UTF_16) {
            if (getGIOPVersion().equals(GIOPVersion.V1_2))
                return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
        }

        return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
    }
 
Example #23
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Handles setting the connection's code sets if required.
 * Returns true if the CodeSetContext was in the request, false
 * otherwise.
 */
protected boolean processCodeSetContext(
    CorbaMessageMediator request, ServiceContexts contexts)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".processCodeSetContext->: " + opAndId(request));
        }

        ServiceContext sc = contexts.get(
            CodeSetServiceContext.SERVICE_CONTEXT_ID);
        if (sc != null) {
            // Somehow a code set service context showed up in the local case.
            if (request.getConnection() == null) {
                return true;
            }

            // If it's GIOP 1.0, it shouldn't have this context at all.  Our legacy
            // ORBs sent it and we need to know if it's here to make ORB versioning
            // decisions, but we don't use the contents.
            if (request.getGIOPVersion().equals(GIOPVersion.V1_0)) {
                return true;
            }

            CodeSetServiceContext cssc = (CodeSetServiceContext)sc ;
            CodeSetComponentInfo.CodeSetContext csctx = cssc.getCodeSetContext();

            // Note on threading:
            //
            // getCodeSetContext and setCodeSetContext are synchronized
            // on the Connection.  At worst, this will result in
            // multiple threads entering this block and calling
            // setCodeSetContext but not actually changing the
            // values on the Connection.
            //
            // Alternative would be to lock the connection for the
            // whole block, but it's fine either way.

            // The connection's codeSetContext is null until we've received a
            // request with a code set context with the negotiated code sets.
            if (((CorbaConnection)request.getConnection())
                .getCodeSetContext() == null)
            {

                // Use these code sets on this connection
                if (orb.subcontractDebugFlag) {
                    dprint(".processCodeSetContext: " + opAndId(request)
                           + ": Setting code sets to: " + csctx);
                }

                ((CorbaConnection)request.getConnection())
                    .setCodeSetContext(csctx);

                // We had to read the method name using ISO 8859-1
                // (which is the default in the CDRInputStream for
                // char data), but now we may have a new char
                // code set.  If it isn't ISO8859-1, we must tell
                // the CDR stream to null any converter references
                // it has created so that it will reacquire
                // the code sets again using the new info.
                //
                // This should probably compare with the stream's
                // char code set rather than assuming it's ISO8859-1.
                // (However, the operation name is almost certainly
                // ISO8859-1 or ASCII.)
                if (csctx.getCharCodeSet() !=
                    OSFCodeSetRegistry.ISO_8859_1.getNumber()) {
                    ((MarshalInputStream)request.getInputObject())
                        .resetCodeSetConverters();
                }
            }
        }

        // If no code set information is ever sent from the client,
        // the server will use ISO8859-1 for char and throw an
        // exception for any wchar transmissions.
        //
        // In the local case, we use ORB provided streams for
        // marshaling and unmarshaling.  Currently, they use
        // ISO8859-1 for char/string and UTF16 for wchar/wstring.
        return sc != null ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".processCodeSetContext<-: " + opAndId(request));
        }
    }
}
 
Example #24
Source File: CodeSetsComponentImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public CodeSetsComponentImpl()
{
    // Uses our default code sets (see CodeSetComponentInfo)
    csci = new CodeSetComponentInfo() ;
}
 
Example #25
Source File: CDRInputObject.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private CodeSetComponentInfo.CodeSetContext getCodeSets() {
    if (getConnection() == null)
        return CodeSetComponentInfo.LOCAL_CODE_SETS;
    else
        return getConnection().getCodeSetContext();
}
 
Example #26
Source File: CDRInputObject.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private CodeSetComponentInfo.CodeSetContext getCodeSets() {
    if (getConnection() == null)
        return CodeSetComponentInfo.LOCAL_CODE_SETS;
    else
        return getConnection().getCodeSetContext();
}
 
Example #27
Source File: ORBDataParserImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the prefered code sets for connections. Should the client send the code set service context on every
 * request?
 */
public CodeSetComponentInfo getCodeSetComponentInfo()
{
    return codesets;
}
 
Example #28
Source File: CDRInputObject.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private CodeSetComponentInfo.CodeSetContext getCodeSets() {
    if (getConnection() == null)
        return CodeSetComponentInfo.LOCAL_CODE_SETS;
    else
        return getConnection().getCodeSetContext();
}
 
Example #29
Source File: CodeSetsComponentImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public CodeSetsComponentImpl()
{
    // Uses our default code sets (see CodeSetComponentInfo)
    csci = new CodeSetComponentInfo() ;
}
 
Example #30
Source File: CodeSetsComponentImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public CodeSetsComponentImpl()
{
    // Uses our default code sets (see CodeSetComponentInfo)
    csci = new CodeSetComponentInfo() ;
}