本文整理汇总了Java中org.omg.CORBA.UserException类的典型用法代码示例。如果您正苦于以下问题:Java UserException类的具体用法?Java UserException怎么用?Java UserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserException类属于org.omg.CORBA包,在下文中一共展示了UserException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSystemException
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Test catching the system exception, thrown on the remote side.
*/
public void testSystemException()
{
System.out.println("**** Test system exception:");
try
{
// Negative parameter = system exception.
object.throwException(-55);
}
catch (BAD_OPERATION ex)
{
System.out.println(" The expected BAD_OPERATION, minor code " +
ex.minor + ", has been thrown on remote side."
);
}
catch (UserException uex)
{
throw new InternalError();
}
}
示例2: create_dyn_any
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Create the DynAny using the passed value as template and assign this value.
*/
public DynAny create_dyn_any(Any value)
throws InconsistentTypeCode
{
DynAny created = create_dyn_any_from_type_code(value.type());
try
{
created.from_any(value);
}
catch (UserException uex)
{
InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
t.initCause(uex);
throw t;
}
catch (Exception e)
{
throw new Unexpected(e);
}
return created;
}
示例3: readUserException
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Reads the user exception, having the given Id, from the input stream. The
* id is expected to be in the form like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
*
* @param idl the exception idl name.
* @param input the stream to read from.
*
* @return the loaded exception.
* @return null if the helper class cannot be found.
*/
public static UserException readUserException(String idl, InputStream input)
{
try
{
Class helperClass = findHelper(idl);
Method read = helperClass.getMethod("read",
new Class[] { org.omg.CORBA.portable.InputStream.class });
return (UserException) read.invoke(null, new Object[] { input });
}
catch (MARSHAL mex)
{
// This one is ok to throw
throw mex;
}
catch (Exception ex)
{
ex.printStackTrace();
return null;
}
}
示例4: readUserException
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Reads the user exception, having the given Id, from the input stream. The
* id is expected to be in the form like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
*
* @param idl the exception idl name.
* @param input the stream to read from.
*
* @return the loaded exception.
* @return null if the helper class cannot be found.
*/
public static UserException readUserException(String idl, InputStream input)
{
try
{
Class helperClass = findHelper(idl);
Method read = helperClass.getMethod("read",
new Class[] { org.omg.CORBA.portable.InputStream.class });
return (UserException) read.invoke(null, new Object[] { input });
}
catch (MARSHAL mex)
{
// This one is ok to throw
throw mex;
}
catch (Exception ex)
{
ex.printStackTrace();
return null;
}
}
示例5: createSSLTaggedComponent
import org.omg.CORBA.UserException; //导入依赖的package包/类
private void createSSLTaggedComponent(IIOPProfileTemplate profileTemplate, int port) throws UserException
{
SSL ssl = new SSL();
ssl.port = (short) port;
short sslOptions = Integrity.value | Confidentiality.value | DetectMisordering.value | DetectReplay.value
| EstablishTrustInTarget.value | EstablishTrustInClient.value;
ssl.target_supports = sslOptions;
ssl.target_requires = sslOptions;
GIOPVersion giopVersion = orb.getORBData().getGIOPVersion();
CDREncapsCodec codec = new CDREncapsCodec(orb, giopVersion.getMajor(),giopVersion.getMinor());
Any any = orb.create_any();
SSLHelper.insert(any, ssl);
byte[] componentData = codec.encode_value(any);
TaggedComponent sslTaggedComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData);
TaggedComponentFactoryFinder finder =
orb.getTaggedComponentFactoryFinder();
Object newTaggedComponent = finder.create( orb, sslTaggedComponent);
profileTemplate.add(newTaggedComponent);
}
示例6: write_TypeCode
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Write the TypeCode. This implementation delegates functionality
* to {@link cdrTypeCode}.
*
* @param x a TypeCode to write.
*/
public void write_TypeCode(TypeCode x)
{
try
{
TypeCodeHelper.write(this, x);
}
catch (UserException ex)
{
Unexpected.error(ex);
}
}
示例7: checkTypePossibility
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Checks if the given type can be encoded. Currently only checks for wide
* strings and wide chars for GIOP 1.0.
*
* @param t a typecode to chek.
*
* @throws InvalidTypeForEncoding if the typecode is not valid for the given
* version.
*/
private void checkTypePossibility(String name, TypeCode t)
throws InvalidTypeForEncoding
{
if (noWide)
{
try
{
int kind = t.kind().value();
if (kind == TCKind._tk_wchar || kind == TCKind._tk_wstring)
throw new InvalidTypeForEncoding(name + " wide char in " +
version
);
else if (kind == TCKind._tk_alias || kind == TCKind._tk_array ||
kind == TCKind._tk_sequence
)
checkTypePossibility("Array member", t.content_type());
else if (kind == TCKind._tk_struct || kind == TCKind._tk_union)
{
for (int i = 0; i < t.member_count(); i++)
{
checkTypePossibility(t.member_name(i), t.member_type(i));
}
}
}
catch (UserException ex)
{
InternalError ierr = new InternalError();
ierr.initCause(ex);
throw ierr;
}
}
}
示例8: insertException
import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
* Insert this exception into the given Any. On failure, insert the UNKNOWN
* exception.
*/
public static void insertException(Any into, Throwable exception)
{
boolean ok = false;
if (exception instanceof SystemException)
ok = insertSysException(into, (SystemException) exception);
else if (exception instanceof UserException)
ok = insertWithHelper(into, exception);
if (!ok)
ok = insertSysException(into, new UNKNOWN());
if (!ok)
throw new InternalError("Exception wrapping broken");
}
示例9: export
import org.omg.CORBA.UserException; //导入依赖的package包/类
public Object export(Remote server, Class<?> remoteClass)
throws RemoteException
{
try {
PortableRemoteObject.exportObject(server);
POA poa = getPOA();
Object servant = Util.getTie(server);
Object ref = poa.servant_to_reference((Servant)servant);
return PortableRemoteObject.narrow(ref, remoteClass);
} catch(UserException e) {
throw new ExportException("could not export corba stream servant", e);
}
}
示例10: invokeClientPIStartingPoint
import org.omg.CORBA.UserException; //导入依赖的package包/类
public void invokeClientPIStartingPoint()
throws RemarshalException
{
if( !hasClientInterceptors ) return;
if( !isClientPIEnabledForThisThread() ) return;
// Invoke the starting interception points and record exception
// and reply status info in the info object:
ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
interceptorInvoker.invokeClientInterceptorStartingPoint( info );
// Check reply status. If we will not have another chance later
// to invoke the client ending points, do it now.
short replyStatus = info.getReplyStatus();
if( (replyStatus == SYSTEM_EXCEPTION.value) ||
(replyStatus == LOCATION_FORWARD.value) )
{
// Note: Transport retry cannot happen here since this happens
// before the request hits the wire.
Exception exception = invokeClientPIEndingPoint(
convertPIReplyStatusToReplyMessage( replyStatus ),
info.getException() );
if( exception == null ) {
// Do not throw anything. Otherwise, it must be a
// SystemException, UserException or RemarshalException.
} if( exception instanceof SystemException ) {
throw (SystemException)exception;
} else if( exception instanceof RemarshalException ) {
throw (RemarshalException)exception;
} else if( (exception instanceof UserException) ||
(exception instanceof ApplicationException) ) {
// It should not be possible for an interceptor to throw
// a UserException. By asserting instead of throwing the
// UserException, we need not declare anything but
// RemarshalException in the throws clause.
throw wrapper.exceptionInvalid() ;
}
}
else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
throw wrapper.replyStatusNotInit() ;
}
}
示例11: raise_exception_with_list
import org.omg.CORBA.UserException; //导入依赖的package包/类
public void raise_exception_with_list(org.omg.CORBA.TypeCode[] exc_list)
throws org.omg.CORBA.UserException
{
throw new NO_IMPLEMENT();
}