org.omg.CORBA.SystemException Java Examples

The following examples show how to use org.omg.CORBA.SystemException. 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: CorbaContactInfoListIteratorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public boolean reportException(ContactInfo contactInfo,
                               RuntimeException ex)
{
    this.failureContactInfo = (CorbaContactInfo)contactInfo;
    this.failureException = ex;
    if (ex instanceof COMM_FAILURE) {
        SystemException se = (SystemException) ex;
        if (se.completed == CompletionStatus.COMPLETED_NO) {
            if (hasNext()) {
                return true;
            }
            if (contactInfoList.getEffectiveTargetIOR() !=
                contactInfoList.getTargetIOR())
            {
                // retry from root ior
                updateEffectiveTargetIOR(contactInfoList.getTargetIOR());
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: TransientNamingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example #3
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
* Destroys the NamingContext.
*/
 public void Destroy() throws SystemException
 {
     // XXX note that orb.disconnect is illegal here, since the
     // POA is used.  However, there may be some associated state
     // that needs to be cleaned up in ServerManagerImpl which we will
     // look into further at another time.
     /*
     // XXX This needs to be replaced by cleaning up the
     // file that backs up the naming context.  No explicit
     // action is necessary at the POA level, since this is
     // created with the non-retain policy.
     /*
     try { orb.disconnect(
         theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
     } catch( org.omg.CORBA.SystemException e ) {
         throw e;
     } catch( Exception e ) {
         throw updateWrapper.transNcDestroyGotEx( e ) ;
     }
     */
 }
 
Example #4
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example #5
Source File: TransientNamingContext.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example #6
Source File: Util.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * The <tt>isLocal</tt> method has the same semantics as the
 * ObjectImpl._is_local method, except that it can throw a RemoteException.
 * (no it doesn't but the spec says it should.)
 *
 * The <tt>_is_local()</tt> method is provided so that stubs may determine
 * if a particular object is implemented by a local servant and hence local
 * invocation APIs may be used.
 *
 * @param stub the stub to test.
 *
 * @return The <tt>_is_local()</tt> method returns true if
 * the servant incarnating the object is located in the same process as
 * the stub and they both share the same ORB instance.  The <tt>_is_local()</tt>
 * method returns false otherwise. The default behavior of <tt>_is_local()</tt> is
 * to return false.
 *
 * @throws RemoteException The Java to IDL specification does to
 * specify the conditions that cause a RemoteException to be thrown.
 */
public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
{
    boolean result = false ;

    try {
        org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
        if (delegate instanceof CorbaClientDelegate) {
            // For the Sun ORB
            CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
            ContactInfoList cil = cdel.getContactInfoList() ;
            if (cil instanceof CorbaContactInfoList) {
                CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
                LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
                result = lcs.useLocalInvocation( null ) ;
            }
        } else {
            // For a non-Sun ORB
            result = delegate.is_local( stub ) ;
        }
    } catch (SystemException e) {
        throw javax.rmi.CORBA.Util.mapSystemException(e);
    }

    return result ;
}
 
Example #7
Source File: Util.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example #8
Source File: CorbaContactInfoListIteratorImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean reportException(ContactInfo contactInfo,
                               RuntimeException ex)
{
    this.failureContactInfo = (CorbaContactInfo)contactInfo;
    this.failureException = ex;
    if (ex instanceof COMM_FAILURE) {
        SystemException se = (SystemException) ex;
        if (se.completed == CompletionStatus.COMPLETED_NO) {
            if (hasNext()) {
                return true;
            }
            if (contactInfoList.getEffectiveTargetIOR() !=
                contactInfoList.getTargetIOR())
            {
                // retry from root ior
                updateEffectiveTargetIOR(contactInfoList.getTargetIOR());
                return true;
            }
        }
    }
    return false;
}
 
Example #9
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
                                       SystemException ex,
                                       ServiceContexts serviceContexts)
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos);
    ex.printStackTrace(pw);
    pw.flush(); // NOTE: you must flush or baos will be empty.
    EncapsOutputStream encapsOutputStream =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
    encapsOutputStream.putEndian();
    encapsOutputStream.write_wstring(baos.toString());
    UnknownServiceContext serviceContext =
        new UnknownServiceContext(ExceptionDetailMessage.value,
                                  encapsOutputStream.toByteArray());
    serviceContexts.put(serviceContext);
}
 
Example #10
Source File: TransientNamingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example #11
Source File: PIHandlerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Handles exceptions for the starting and intermediate points for
 * server request interceptors.  This is common code that has been
 * factored out into this utility method.
 * <p>
 * This method will NOT work for ending points.
 */
private void serverPIHandleExceptions( ServerRequestInfoImpl info )
{
    int endingPointCall = info.getEndingPointCall();
    if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) {
        // If a system exception was thrown, throw it to caller:
        throw (SystemException)info.getException();
    }
    else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) &&
             (info.getForwardRequestException() != null) )
    {
        // If an interceptor throws a forward request, convert it
        // into a ForwardException for easier handling:
        IOR ior = info.getForwardRequestIOR();
        throw new ForwardException( orb, ior );
    }
}
 
Example #12
Source File: ServiceContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example #13
Source File: SocketFactoryContactInfoListIteratorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public boolean reportException(ContactInfo contactInfo,
                               RuntimeException ex)
{
    this.failureContactInfo = (CorbaContactInfo)contactInfo;
    this.failureException = ex;
    if (ex instanceof org.omg.CORBA.COMM_FAILURE) {

        if (ex.getCause() instanceof GetEndPointInfoAgainException) {
            socketInfoCookie =
                ((GetEndPointInfoAgainException) ex.getCause())
                .getEndPointInfo();
            return true;
        }

        SystemException se = (SystemException) ex;
        if (se.completed == CompletionStatus.COMPLETED_NO) {
            if (contactInfoList.getEffectiveTargetIOR() !=
                contactInfoList.getTargetIOR())
            {
                // retry from root ior
                contactInfoList.setEffectiveTargetIOR(
                    contactInfoList.getTargetIOR());
                return true;
            }
        }
    }
    return false;
}
 
Example #14
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example #15
Source File: UnknownServiceContext.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void write( OutputStream os , GIOPVersion gv)
    throws SystemException
{
    os.write_long( id ) ;
    os.write_long( data.length ) ;
    os.write_octet_array( data, 0, data.length ) ;
}
 
Example #16
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example #17
Source File: ServiceContext.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/** Write the service context to an output stream.  This method
 * must be used for writing the service context to a request or reply
 * header.
 */
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
    EncapsOutputStream os =
        sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
    os.putEndian() ;
    writeData( os ) ;
    byte[] data = os.toByteArray() ;

    s.write_long(getId());
    s.write_long(data.length);
    s.write_octet_array(data, 0, data.length);
}
 
Example #18
Source File: ORBUtility.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static SystemException extractSystemException(Any any) {
    InputStream in = any.create_input_stream();
    ORB orb = (ORB)(in.orb());
    if ( ! isSystemExceptionTypeCode(any.type(), orb)) {
        throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
    }
    return ORBUtility.readSystemException(in);
}
 
Example #19
Source File: IIOPProfileImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Return the servant for this IOR, if it is local AND if the OA that
 * implements this objref supports direct access to servants outside of an
 * invocation.
 * XXX revisit: do we want this at all?  If we do, it might move to the
 * ObjectKeyTemplate instead.
 */
public java.lang.Object getServant()
{
    if (!isLocal())
        return null ;

    RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
    ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(
        oktemp.getSubcontractId() ) ;

    ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
    ObjectAdapter oa = null ;

    try {
        oa = oaf.find( oaid ) ;
    } catch (SystemException exc) {
        // Could not find the OA, so just return null.
        // This usually happens when POAs are being deleted,
        // and the POA always return null for getLocalServant anyway.
        wrapper.getLocalServantFailure( exc, oaid.toString() ) ;
        return null ;
    }

    byte[] boid = oid.getId() ;
    java.lang.Object servant = oa.getLocalServant( boid ) ;
    return servant ;
}
 
Example #20
Source File: BufferManagerWriteStream.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #21
Source File: SocketFactoryContactInfoListIteratorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reportException(ContactInfo contactInfo,
                               RuntimeException ex)
{
    this.failureContactInfo = (CorbaContactInfo)contactInfo;
    this.failureException = ex;
    if (ex instanceof org.omg.CORBA.COMM_FAILURE) {

        if (ex.getCause() instanceof GetEndPointInfoAgainException) {
            socketInfoCookie =
                ((GetEndPointInfoAgainException) ex.getCause())
                .getEndPointInfo();
            return true;
        }

        SystemException se = (SystemException) ex;
        if (se.completed == CompletionStatus.COMPLETED_NO) {
            if (contactInfoList.getEffectiveTargetIOR() !=
                contactInfoList.getTargetIOR())
            {
                // retry from root ior
                contactInfoList.setEffectiveTargetIOR(
                    contactInfoList.getTargetIOR());
                return true;
            }
        }
    }
    return false;
}
 
Example #22
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps a SystemException to a RemoteException.
 * @param ex the SystemException to map.
 * @return the mapped exception.
 */
public static RemoteException mapSystemException(SystemException ex) {

    if (utilDelegate != null) {
        return utilDelegate.mapSystemException(ex);
    }
    return null;
}
 
Example #23
Source File: BufferManagerWriteStream.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #24
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
Example #25
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public static SystemException extractSystemException(Any any) {
    InputStream in = any.create_input_stream();
    ORB orb = (ORB)(in.orb());
    if ( ! isSystemExceptionTypeCode(any.type(), orb)) {
        throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
    }
    return ORBUtility.readSystemException(in);
}
 
Example #26
Source File: ORBUtility.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to a stream.
 * @param strm The OutputStream to use for marshaling.
 */
public static void writeSystemException(SystemException ex, OutputStream strm)
{
    String s;

    s = repositoryIdOf(ex.getClass().getName());
    strm.write_string(s);
    strm.write_long(ex.minor);
    strm.write_long(ex.completed.value());
}
 
Example #27
Source File: Util.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Maps a SystemException to a RemoteException.
 * @param ex the SystemException to map.
 * @return the mapped exception.
 */
public static RemoteException mapSystemException(SystemException ex) {

    if (utilDelegate != null) {
        return utilDelegate.mapSystemException(ex);
    }
    return null;
}
 
Example #28
Source File: ORBUtility.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
Example #29
Source File: ClientRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * The CORBA::RepositoryId of the exception to be returned to the client.
 */
public String received_exception_id (){
    checkAccess( MID_RECEIVED_EXCEPTION_ID );

    if( cachedReceivedExceptionId == null ) {
        String result = null;

        if( exception == null ) {
            // Note: exception should never be null here since we will
            // throw a BAD_INV_ORDER if this is not called from
            // receive_exception.
            throw wrapper.exceptionWasNull() ;
        } else if( exception instanceof SystemException ) {
            String name = exception.getClass().getName();
            result = ORBUtility.repositoryIdOf(name);
        } else if( exception instanceof ApplicationException ) {
            result = ((ApplicationException)exception).getId();
        }

        // _REVISIT_ We need to be able to handle a UserException in the
        // DII case.  How do we extract the ID from a UserException?

        cachedReceivedExceptionId = result;
    }

    return cachedReceivedExceptionId;
}
 
Example #30
Source File: IIOPProfileImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/** Return the servant for this IOR, if it is local AND if the OA that
 * implements this objref supports direct access to servants outside of an
 * invocation.
 * XXX revisit: do we want this at all?  If we do, it might move to the
 * ObjectKeyTemplate instead.
 */
public java.lang.Object getServant()
{
    if (!isLocal())
        return null ;

    RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
    ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(
        oktemp.getSubcontractId() ) ;

    ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
    ObjectAdapter oa = null ;

    try {
        oa = oaf.find( oaid ) ;
    } catch (SystemException exc) {
        // Could not find the OA, so just return null.
        // This usually happens when POAs are being deleted,
        // and the POA always return null for getLocalServant anyway.
        wrapper.getLocalServantFailure( exc, oaid.toString() ) ;
        return null ;
    }

    byte[] boid = oid.getId() ;
    java.lang.Object servant = oa.getLocalServant( boid ) ;
    return servant ;
}