From: Henning R. <hr...@ne...> - 2007-10-03 10:33:51
|
Hello all, I'm trying to extract a user defined Any type. There are only two kind of types, NotUsed and StringInfo. The only type passed around is the StringInfo which is pushed by an omniORB eventservice. If I just extract the StringInfo using StringInfoHelper, everything works fine. If I try to extra the Any (containing a StringInfo type) into a NotUsed type then the program throws an exception I cannot catch apparantly, and the eventservice disconnects me. If I try to determine the type of the Any using type() then equal() returns false for both types (even though I know the type is StringInfo). Does anyone have a suggestion how to do this? The code for my push operation is listed below and is made after an example from the iona website. Might this be because I'm trying to interact with omniEvents? Any suggestions are much appreciated, Regards Henning Source code: IDL: struct StringInfo { string who; string what; short id; }; struct NotUsed { string s1; short s2; short s3; string s4; }; Java: public void push(Any data) { StringInfo msg; NotUsed nu; try { if (data.type().equal(StringInfoHelper.type())) { msg = StringInfoHelper.extract(data); System.out.println("StringInfo"); } else if (data.type().equal(NotUsedHelper.type())) { nu = NotUsedHelper.extract(data); System.out.println("NotUsed"); } else { System.out.println("Unknown"); } } catch (BAD_OPERATION e) { System.out.println("Bad op"); } catch (Exception e) { System.out.println("Error"); } } |