Java Code Examples for com.sun.corba.se.impl.orbutil.ORBUtility.readSystemException()

The following are Jave code examples for showing how to use readSystemException() of the com.sun.corba.se.impl.orbutil.ORBUtility class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: OpenJSharp   File: CorbaServerRequestDispatcherImpl.java   Source Code and License Vote up 4 votes
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 2
Project: openjdk-jdk10   File: CorbaServerRequestDispatcherImpl.java   Source Code and License Vote up 4 votes
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}