Java Code Examples for org.omg.CORBA.SystemException

The following are top voted examples for showing how to use org.omg.CORBA.SystemException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: twainBDirect   File: AppDev.java   Source Code and License 6 votes vote down vote up
/**
 * @deprecated 
 */
private static void loadLibrary() {
    //--agregar dlls faltantes para utilizar jtwain
    String arch = System.getenv("PROCESSOR_ARCHITECTURE");
    String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");
    String realArch = arch.endsWith(ARCHITECTURE_X32) || wow64Arch != null && wow64Arch.endsWith(ARCHITECTURE_X32) ? ARCHITECTURE_X32 : "64";
    if (System.getProperty("os.name").startsWith("Windows")) {
        try {
            if (realArch.equals(ARCHITECTURE_X32)) {
                System.load(LIB_X32 + NAME);
                System.out.println("cargada lib twain x32 ");
            } else {
                System.load(LIB_X64 + NAME);
                System.out.println("cargada lib twain x64 ");
            }
        } catch (SystemException e) {
            System.out.println(e.getMessage());
        }
    }
}
 
Example 2
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 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 3
Project: OpenJSharp   File: TransientNamingContext.java   Source Code and License 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 4
Project: OpenJSharp   File: NamingContextImpl.java   Source Code and License 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 5
Project: OpenJSharp   File: Util.java   Source Code and License 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 6
Project: OpenJSharp   File: Util.java   Source Code and License 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 7
Project: OpenJSharp   File: CorbaContactInfoListIteratorImpl.java   Source Code and License 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 8
Project: OpenJSharp   File: PIHandlerImpl.java   Source Code and License 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 9
Project: openjdk-jdk10   File: PIHandlerImpl.java   Source Code and License 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 10
Project: openjdk-jdk10   File: TransientNamingContext.java   Source Code and License 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
Project: openjdk-jdk10   File: TransientNamingContext.java   Source Code and License 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 12
Project: openjdk-jdk10   File: NamingContextImpl.java   Source Code and License 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 13
Project: openjdk-jdk10   File: Util.java   Source Code and License 6 votes vote down vote up
/**
 * The {@code isLocal} 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 {@code _is_local()} 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 {@code _is_local()} 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 {@code _is_local()}
 * method returns false otherwise. The default behavior of {@code _is_local()} 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 14
Project: openjdk-jdk10   File: Util.java   Source Code and License 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 15
Project: openjdk-jdk10   File: CorbaContactInfoListIteratorImpl.java   Source Code and License 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 16
Project: lams   File: JndiRmiClientInterceptor.java   Source Code and License 5 votes vote down vote up
/**
 * Convert the given CORBA SystemException that happened during remote access
 * to Spring's RemoteAccessException if the method signature does not declare
 * RemoteException. Else, return the SystemException wrapped in a RemoteException.
 * @param method the invoked method
 * @param ex the RemoteException that happened
 * @return the exception to be thrown to the caller
 */
private Exception convertCorbaAccessException(SystemException ex, Method method) {
	if (ReflectionUtils.declaresException(method, RemoteException.class)) {
		// A traditional RMI service: wrap CORBA exceptions in standard RemoteExceptions.
		return new RemoteException("Failed to access CORBA service [" + getJndiName() + "]", ex);
	}
	else {
		if (isConnectFailure(ex)) {
			return new RemoteConnectFailureException("Could not connect to CORBA service [" + getJndiName() + "]", ex);
		}
		else {
			return new RemoteAccessException("Could not access CORBA service [" + getJndiName() + "]", ex);
		}
	}
}
 
Example 17
Project: OpenJSharp   File: ServiceContext.java   Source Code and License 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
Project: OpenJSharp   File: UnknownServiceContext.java   Source Code and License 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 19
Project: openjdk-jdk10   File: ClientRequestInfoImpl.java   Source Code and License 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 20
Project: OpenJSharp   File: SocketFactoryContactInfoListIteratorImpl.java   Source Code and License 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 21
Project: openjdk-jdk10   File: IIOPProfileImpl.java   Source Code and License 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 22
Project: OpenJSharp   File: BufferManagerWriteStream.java   Source Code and License 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 23
Project: OpenJSharp   File: ORBUtility.java   Source Code and License 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 24
Project: OpenJSharp   File: ORBUtility.java   Source Code and License 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 25
Project: OpenJSharp   File: ORBUtility.java   Source Code and License 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 26
Project: OpenJSharp   File: ClientRequestInfoImpl.java   Source Code and License 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 27
Project: OpenJSharp   File: IIOPProfileImpl.java   Source Code and License 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 28
Project: OpenJSharp   File: Util.java   Source Code and License 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 29
Project: openjdk-jdk10   File: ServiceContext.java   Source Code and License 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 30
Project: openjdk-jdk10   File: UnknownServiceContext.java   Source Code and License 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 31
Project: openjdk-jdk10   File: CorbaMessageMediatorImpl.java   Source Code and License 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 32
Project: openjdk-jdk10   File: Util.java   Source Code and License 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 33
Project: openjdk-jdk10   File: SocketFactoryContactInfoListIteratorImpl.java   Source Code and License 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 34
Project: openjdk-jdk10   File: BufferManagerWriteStream.java   Source Code and License 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 35
Project: openjdk-jdk10   File: ORBUtility.java   Source Code and License 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 36
Project: openjdk-jdk10   File: ORBUtility.java   Source Code and License 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 37
Project: openjdk-jdk10   File: ORBUtility.java   Source Code and License 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 38
Project: OpenJSharp   File: CorbaProtocolHandler.java   Source Code and License 4 votes vote down vote up
public CorbaMessageMediator createSystemExceptionResponse(
CorbaMessageMediator messageMediator,
SystemException ex,
ServiceContexts svc);
 
Example 39
Project: OpenJSharp   File: UEInfoServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData( OutputStream os ) throws SystemException
{
    os.write_value( (Serializable)unknown ) ;
}
 
Example 40
Project: OpenJSharp   File: CodeSetServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData( OutputStream os ) throws SystemException
{
    csc.write( (MarshalOutputStream)os ) ;
}
 
Example 41
Project: OpenJSharp   File: SendingContextServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData( OutputStream os ) throws SystemException
{
    ior.write( os ) ;
}
 
Example 42
Project: OpenJSharp   File: UnknownServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData( OutputStream os ) throws SystemException
{
}
 
Example 43
Project: OpenJSharp   File: MaxStreamFormatVersionServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData(OutputStream os) throws SystemException
{
    os.write_octet(maxStreamFormatVersion);
}
 
Example 44
Project: OpenJSharp   File: ORBVersionServiceContext.java   Source Code and License 4 votes vote down vote up
public void writeData( OutputStream os ) throws SystemException
{
    version.write( os ) ;
}
 
Example 45
Project: openjdk-jdk10   File: PIHandlerImpl.java   Source Code and License 4 votes vote down vote up
public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
{
    if( !hasServerInterceptors ) return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();

    // REVISIT: This needs to be done "early" for the following workaround.
    info.setReplyMessage( replyMessage );

    // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
    // but needs to be here for now.  See comment in that method for why.
    info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );

    // It is possible we might have entered this method more than
    // once (e.g. if an ending point threw a SystemException, then
    // a new ServerResponseImpl is created).
    if( !info.getAlreadyExecuted() ) {
        int replyStatus = replyMessage.getReplyStatus();

        // Translate ReplyMessage.replyStatus into PI replyStatus:
        // Note: this is also an assertion to make sure a valid
        // replyStatus is passed in (IndexOutOfBoundsException will be
        // thrown otherwise)
        short piReplyStatus =
            REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];

        // Make forwarded IOR available to interceptors, if applicable:
        if( ( piReplyStatus == LOCATION_FORWARD.value ) ||
            ( piReplyStatus == TRANSPORT_RETRY.value ) )
        {
            info.setForwardRequest( replyMessage.getIOR() );
        }

        // REVISIT: Do early above for now.
        // Make reply message available to interceptors:
        //info.setReplyMessage( replyMessage );

        // Remember exception so we can tell if an interceptor changed it.
        Exception prevException = info.getException();

        // _REVISIT_ We do not have access to the User Exception at
        // this point, so treat it as an UNKNOWN for now.
        // Note that if this is a DSI call, we do have the user exception.
        if( !info.isDynamic() &&
            (piReplyStatus == USER_EXCEPTION.value) )
        {
            info.setException( omgWrapper.unknownUserException(
                CompletionStatus.COMPLETED_MAYBE ) ) ;
        }

        // Invoke the ending interception points:
        info.setReplyStatus( piReplyStatus );
        interceptorInvoker.invokeServerInterceptorEndingPoint( info );
        short newPIReplyStatus = info.getReplyStatus();
        Exception newException = info.getException();

        // Check reply status.  If an interceptor threw a SystemException
        // and it is different than the one that we came in with,
        // rethrow it so the proper response can be constructed:
        if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) &&
            ( newException != prevException ) )
        {
            throw (SystemException)newException;
        }

        // If we are to forward the location:
        if( newPIReplyStatus == LOCATION_FORWARD.value ) {
            if( piReplyStatus != LOCATION_FORWARD.value ) {
                // Treat a ForwardRequest as a ForwardException.
                IOR ior = info.getForwardRequestIOR();
                throw new ForwardException( orb, ior ) ;
            }
            else if( info.isForwardRequestRaisedInEnding() ) {
                // Treat a ForwardRequest by changing the IOR.
                replyMessage.setIOR( info.getForwardRequestIOR() );
            }
        }
    }
}
 
Example 46
Project: OpenJSharp   File: CorbaConnection.java   Source Code and License 4 votes vote down vote up
public void purgeCalls(SystemException systemException,
boolean die, boolean lockHeld);
 
Example 47
Project: OpenJSharp   File: CorbaClientRequestDispatcherImpl.java   Source Code and License 4 votes vote down vote up
protected void continueOrThrowSystemOrRemarshal(
    CorbaMessageMediator messageMediator, Exception exception)
    throws
        SystemException, RemarshalException
{

    ORB orb = (ORB) messageMediator.getBroker();

    if( exception == null ) {

        // do nothing.

    } else if( exception instanceof RemarshalException ) {

        // REVISIT - unify with PI handling
        orb.getInvocationInfo().setIsRetryInvocation(true);

        // NOTE - We must unregister the waiter NOW for this request
        // since the retry will result in a new request id.  Therefore
        // the old request id would be lost and we would have a memory
        // leak in the responseWaitingRoom.
        unregisterWaiter(orb);

        if (orb.subcontractDebugFlag) {
            dprint(".continueOrThrowSystemOrRemarshal: "
                   + opAndId(messageMediator)
                   + ": throwing Remarshal");
        }

        throw (RemarshalException)exception;

    } else {

        if (orb.subcontractDebugFlag) {
            dprint(".continueOrThrowSystemOrRemarshal: "
                   + opAndId(messageMediator)
                   + ": throwing sex:"
                   + exception);
        }

        throw (SystemException)exception;
    }
}
 
Example 48
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemExceptionReply()
{
    return replyHeader.getSystemException(replyExceptionDetailMessage);
}
 
Example 49
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 4 votes vote down vote up
protected void handleThrowableDuringServerDispatch(
    CorbaMessageMediator messageMediator,
    Throwable throwable,
    CompletionStatus completionStatus,
    int iteration)
{
    if (iteration > 10) {
        if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
            dprint(".handleThrowableDuringServerDispatch: "
                   + opAndId(messageMediator)
                   + ": cannot handle: "
                   + throwable);
        }

        // REVISIT - should we close connection?
        RuntimeException rte =
            new RuntimeException("handleThrowableDuringServerDispatch: " +
                                 "cannot create response.");
        rte.initCause(throwable);
        throw rte;
    }

    try {
        if (throwable instanceof ForwardException) {
            ForwardException fex = (ForwardException)throwable ;
            createLocationForward( messageMediator, fex.getIOR(), null ) ;
            return;
        }

        if (throwable instanceof AddressingDispositionException) {
            handleAddressingDisposition(
                messageMediator,
                (AddressingDispositionException)throwable);
            return;
        }

        // Else.

        SystemException sex =
            convertThrowableToSystemException(throwable, completionStatus);

        createSystemExceptionResponse(messageMediator, sex, null);
        return;

    } catch (Throwable throwable2) {

        // User code (e.g., postinvoke, interceptors) may change
        // the exception, so we end up back here.
        // Report the changed exception.

        handleThrowableDuringServerDispatch(messageMediator,
                                            throwable2,
                                            completionStatus,
                                            iteration + 1);
        return;
    }
}
 
Example 50
Project: OpenJSharp   File: CorbaMessageMediatorImpl.java   Source Code and License 4 votes vote down vote up
public CorbaMessageMediator createSystemExceptionResponse(
    CorbaMessageMediator messageMediator,
    SystemException ex,
    ServiceContexts svc)
{
    if (messageMediator.getConnection() != null) {
        // It is possible that fragments of response have already been
        // sent.  Then an error may occur (e.g. marshaling error like
        // non serializable object).  In that case it is too late
        // to send the exception.  We just return the existing fragmented
        // stream here.  This will cause an incomplete last fragment
        // to be sent.  Then the other side will get a marshaling error
        // when attempting to unmarshal.

        // REVISIT: Impl - make interface method to do the following.
        CorbaMessageMediatorImpl mediator = (CorbaMessageMediatorImpl)
            ((CorbaConnection)messageMediator.getConnection())
            .serverRequestMapGet(messageMediator.getRequestId());

        OutputObject existingOutputObject = null;
        if (mediator != null) {
            existingOutputObject = mediator.getOutputObject();
        }

        // REVISIT: need to think about messageMediator containing correct
        // pointer to output object.
        if (existingOutputObject != null &&
            mediator.sentFragment() &&
            ! mediator.sentFullMessage())
        {
            return mediator;
        }
    }

    // Only do this if interceptors have been initialized on this request
    // and have not completed their lifecycle (otherwise the info stack
    // may be empty or have a different request's entry on top).
    if (messageMediator.executePIInResponseConstructor()) {
        // REVISIT: not necessary in framework now?
        // Inform Portable Interceptors of the SystemException.  This is
        // required to be done here because the ending interception point
        // is called in the when creating the response below
        // but we do not currently write the SystemException into the
        // response until after the ending point is called.
        ((ORB)messageMediator.getBroker()).getPIHandler().setServerPIInfo( ex );
    }

    if (((ORB)messageMediator.getBroker()).subcontractDebugFlag &&
        ex != null)
    {
        dprint(".createSystemExceptionResponse: "
               + opAndId(messageMediator),
               ex);
    }

    ServiceContexts serviceContexts =
        getServiceContextsForReply(messageMediator, svc);

    // NOTE: We MUST add the service context before creating
    // the response since service contexts are written to the
    // stream when the response object is created.

    addExceptionDetailMessage(messageMediator, ex, serviceContexts);

    CorbaMessageMediator response =
        createResponseHelper(messageMediator, serviceContexts, false);

    // NOTE: From here on, it is too late to add more service contexts.
    // They have already been serialized to the stream (and maybe fragments
    // sent).

    ORBUtility.writeSystemException(
        ex, (OutputStream)response.getOutputObject());

    return response;
}
 
Example 51
Project: OpenJSharp   File: LocateReplyMessage_1_2.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return MessageBase.getSystemException(
        exClassName, minorCode, completionStatus, message, wrapper);
}
 
Example 52
Project: OpenJSharp   File: ReplyMessage_1_0.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return MessageBase.getSystemException(
        exClassName, minorCode, completionStatus, message, wrapper);
}
 
Example 53
Project: OpenJSharp   File: LocateReplyMessage_1_0.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return null;  // 1.0 LocateReply body does not contain SystemException
}
 
Example 54
Project: OpenJSharp   File: ReplyMessage_1_2.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return MessageBase.getSystemException(
        exClassName, minorCode, completionStatus, message, wrapper);
}
 
Example 55
Project: OpenJSharp   File: LocateReplyMessage_1_1.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return null; // 1.0 LocateReply body does not contain SystemException
}
 
Example 56
Project: OpenJSharp   File: ReplyMessage_1_1.java   Source Code and License 4 votes vote down vote up
public SystemException getSystemException(String message) {
    return MessageBase.getSystemException(
        exClassName, minorCode, completionStatus, message, wrapper);
}
 
Example 57
Project: OpenJSharp   File: CorbaServerRequestDispatcherImpl.java   Source Code and License 4 votes vote down vote up
/** 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 58
Project: OpenJSharp   File: NullServantImpl.java   Source Code and License 4 votes vote down vote up
public NullServantImpl( SystemException ex )
{
    this.sysex = ex ;
}
 
Example 59
Project: OpenJSharp   File: NullServantImpl.java   Source Code and License 4 votes vote down vote up
public SystemException getException()
{
    return sysex ;
}
 
Example 60
Project: OpenJSharp   File: SocketOrChannelConnectionImpl.java   Source Code and License 4 votes vote down vote up
public void sendWithoutLock(OutputObject outputObject)
{
    // Don't we need to check for CloseConnection
    // here?  REVISIT

    // XREVISIT - Shouldn't the MessageMediator
    // be the one to handle writing the data here?

    try {

        // Write the fragment/message

        CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;
        cdrOutputObject.writeTo(this);
        // REVISIT - no flush?
        //socket.getOutputStream().flush();

    } catch (IOException e1) {

        /*
         * ADDED(Ram J) 10/13/2000 In the event of an IOException, try
         * sending a CancelRequest for regular requests / locate requests
         */

        // Since IIOPOutputStream's msgheader is set only once, and not
        // altered during sending multiple fragments, the original
        // msgheader will always have the requestId.
        // REVISIT This could be optimized to send a CancelRequest only
        // if any fragments had been sent already.

        /* REVISIT: MOVE TO SUBCONTRACT
        Message msg = os.getMessage();
        if (msg.getType() == Message.GIOPRequest ||
                msg.getType() == Message.GIOPLocateRequest) {
            GIOPVersion requestVersion = msg.getGIOPVersion();
            int requestId = MessageBase.getRequestId(msg);
            try {
                sendCancelRequest(requestVersion, requestId);
            } catch (IOException e2) {
                // most likely an abortive connection closure.
                // ignore, since nothing more can be done.
                if (orb.transportDebugFlag) {

            }
        }
        */

        // REVISIT When a send failure happens, purgeCalls() need to be
        // called to ensure that the connection is properly removed from
        // further usage (ie., cancelling pending requests with COMM_FAILURE
        // with an appropriate minor_code CompletionStatus.MAY_BE).

        // Relying on the IIOPOutputStream (as noted below) is not
        // sufficient as it handles COMM_FAILURE only for the final
        // fragment (during invoke processing). Note that COMM_FAILURE could
        // happen while sending the initial fragments.
        // Also the IIOPOutputStream does not properly close the connection.
        // It simply removes the connection from the table. An orderly
        // closure is needed (ie., cancel pending requests on the connection
        // COMM_FAILURE as well.

        // IIOPOutputStream will cleanup the connection info when it
        // sees this exception.
        SystemException exc = wrapper.writeErrorSend(e1);
        purgeCalls(exc, false, true);
        throw exc;
    }
}