diff options
Diffstat (limited to 'libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java')
-rw-r--r-- | libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java index 6e2ef060b9a..86bf8c55dfd 100644 --- a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java @@ -38,6 +38,8 @@ exception statement from your version. */ package org.omg.CosNaming; +import gnu.CORBA.Minor; + import org.omg.CORBA.Any; import org.omg.CORBA.BAD_OPERATION; import org.omg.CORBA.BAD_PARAM; @@ -78,6 +80,7 @@ public abstract class NamingContextExtHelper { BAD_OPERATION bad = new BAD_OPERATION("NamingContextExt expected"); bad.initCause(ex); + bad.minor = Minor.Any; throw bad; } } @@ -122,6 +125,35 @@ public abstract class NamingContextExtHelper return new _NamingContextExtStub(delegate); } } + + /** + * Narrow the given object to the NamingContextExt. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. + * + * @param obj the object to cast. + * + * @return the casted NamingContextExt + * + * @since 1.5 + * + * @see OMG issue 4158. + */ + public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContextExt) + return (NamingContextExt) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextExtStub(delegate); + } + } /** * Read the extended naming context from the given CDR input stream. |