aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java')
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
index 204d9f05872..64f7b4dfa51 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.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 BindingIteratorHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Binding iterator expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -121,6 +124,35 @@ public abstract class BindingIteratorHelper
return new _BindingIteratorStub(delegate);
}
}
+
+ /**
+ * Narrow the given object to the BindingIterator. 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 binding iterator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof BindingIterator)
+ return (BindingIterator) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _BindingIteratorStub(delegate);
+ }
+ }
/**
* Read the exception from the given CDR stream.