本文整理汇总了Java中org.omg.CORBA.UnknownUserException类的典型用法代码示例。如果您正苦于以下问题:Java UnknownUserException类的具体用法?Java UnknownUserException怎么用?Java UnknownUserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnknownUserException类属于org.omg.CORBA包,在下文中一共展示了UnknownUserException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUserException
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
/**
* Test catching the user exception, thrown on the remote side.
*/
public void testUserException()
{
System.out.println("**** Test user exception:");
ExceptionList exList = orb.create_exception_list();
exList.add(WeThrowThisExceptionHelper.type());
Request rq =
object._create_request(null, "throwException", orb.create_list(1), null,
exList, null
);
rq.add_in_arg().insert_long(123);
rq.invoke();
UnknownUserException uku = (UnknownUserException) rq.env().exception();
WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
System.out.println(" Our user exception, field " + our_exception.ourField +
", has been thrown on remote side."
);
}
示例2: received_exception
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
/** @inheritDoc */
public Any received_exception()
{
if (m_exception_id == null)
return null;
if (m_sys_ex != null)
{
Any a = orb.create_any();
ObjectCreator.insertSysException(a, m_sys_ex);
return a;
}
Exception mex = m_environment.exception();
UnknownUserException ex = (UnknownUserException) mex;
if (ex == null)
return null;
else
return ex.except;
}
示例3: if
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
public static org.omg.CORBA.UnknownUserException
read(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.TypeCode[] types)
{
String name = in.read_string();
try {
if (types != null)
for (int i = 0; i < types.length; i++) {
if (types[i].kind().value() != TCKind._tk_except)
throw new
BAD_PARAM("Bad ExceptionList: not Exception TypeCode");
if (name.equals(types[i].name())) {
Any any = in.orb().create_any();
any.read_value(in, types[i]);
return new UnknownUserException(any);
}
}
}
catch (BadKind bk) {}
throw new UNKNOWN("Unexpected exception: " + name);
}
示例4: unmarshalDIIUserException
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
public Exception unmarshalDIIUserException(String repoId, InputStream is)
{
if (! isDIIRequest()) {
return null;
}
ExceptionList _exceptions = diiRequest.exceptions();
try {
// Find the typecode for the exception
for (int i=0; i<_exceptions.count() ; i++) {
TypeCode tc = _exceptions.item(i);
if ( tc.id().equals(repoId) ) {
// Since we dont have the actual user exception
// class, the spec says we have to create an
// UnknownUserException and put it in the
// environment.
Any eany = orb.create_any();
eany.read_value(is, (TypeCode)tc);
return new UnknownUserException(eany);
}
}
} catch (Exception b) {
throw wrapper.unexpectedDiiException(b);
}
// must be a truly unknown exception
return wrapper.unknownCorbaExc( CompletionStatus.COMPLETED_MAYBE);
}
示例5: set_exception
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
/**
* Set the exception that has been thrown.
*/
public void set_exception(Any exc)
{
request.env().exception(new UnknownUserException(exc));
}
示例6: invoke
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
/**
* Make an invocation and store the result in the fields of this Request. Used
* with DII only.
*/
public void invoke()
{
InvokeHandler handler = object.getHandler(operation(), cookie, false);
if (handler instanceof DynamicImpHandler)
{
DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;
if (serverRequest == null)
{
serverRequest = new LocalServerRequest(this);
}
try
{
poa.m_orb.currents.put(Thread.currentThread(), this);
dyn.invoke(serverRequest);
}
finally
{
poa.m_orb.currents.remove(Thread.currentThread());
}
}
else
{
org.omg.CORBA.portable.InputStream input = v_invoke(handler);
if (!exceptionReply)
{
NamedValue arg;
// Read return value, if set.
if (m_result != null)
{
m_result.value().read_value(input, m_result.value().type());
}
// Read returned parameters, if set.
if (m_args != null)
{
for (int i = 0; i < m_args.count(); i++)
{
try
{
arg = m_args.item(i);
// Both ARG_INOUT and ARG_OUT have this binary flag set.
if ((arg.flags() & ARG_OUT.value) != 0)
{
arg.value().read_value(input, arg.value().type());
}
}
catch (Bounds ex)
{
Unexpected.error(ex);
}
}
}
}
else// User exception reply
{
// Prepare an Any that will hold the exception.
gnuAny exc = new gnuAny();
exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
}
}
}
示例7: setUserException
import org.omg.CORBA.UnknownUserException; //导入依赖的package包/类
public void setUserException(Any exc)
{
m_environment.exception(new UnknownUserException(exc));
}