You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by ri...@apache.org on 2006/11/17 20:09:32 UTC

svn commit: r476293 - in /incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb: OB/PolicyFactoryManager.java PortableInterceptor/ServerRequestInfo_impl.java

Author: rickmcguire
Date: Fri Nov 17 12:09:31 2006
New Revision: 476293

URL: http://svn.apache.org/viewvc?view=rev&rev=476293
Log:
YOKO-219 ServerRequestInfo.get_server_policy() incorrectly throwing an exception.


Modified:
    incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java
    incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/PortableInterceptor/ServerRequestInfo_impl.java

Modified: incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java?view=diff&rev=476293&r1=476292&r2=476293
==============================================================================
--- incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java (original)
+++ incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/OB/PolicyFactoryManager.java Fri Nov 17 12:09:31 2006
@@ -114,4 +114,19 @@
             outVec.copyInto(out.value);
         }
     }
+
+    /**
+     * Test if a policy type is valid for the current
+     * context.
+     *
+     * @param type   The policy type number.
+     *
+     * @return true if the policy is a registered type, false for
+     *         unknown types.
+     */
+    public boolean isPolicyRegistered(int type) {
+        Integer itype = new Integer(type);
+
+        return policyFactoryTableInternal_.containsKey(itype) || policyFactoryTableExternal_.containsKey(itype);
+    }
 }

Modified: incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/PortableInterceptor/ServerRequestInfo_impl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/PortableInterceptor/ServerRequestInfo_impl.java?view=diff&rev=476293&r1=476292&r2=476293
==============================================================================
--- incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/PortableInterceptor/ServerRequestInfo_impl.java (original)
+++ incubator/yoko/trunk/core/src/main/java/org/apache/yoko/orb/PortableInterceptor/ServerRequestInfo_impl.java Fri Nov 17 12:09:31 2006
@@ -250,9 +250,18 @@
     // send_reply: yes send_exception: yes send_other: yes
     //
     public org.omg.CORBA.Policy get_server_policy(int type) {
-        for (int i = 0; i < policies_.length; i++)
-            if (policies_[i].policy_type() == type)
+        for (int i = 0; i < policies_.length; i++) {
+            if (policies_[i].policy_type() == type) {
                 return policies_[i];
+            }
+        }
+
+        // if the target policy was not in the current policy list, check to see
+        // if the type has even been registered.  If it is valid, return null
+        // to indicate we ain't got one.
+        if (orbInstance_.getPolicyFactoryManager().isPolicyRegistered(type)) {
+            return null;
+        }
 
         throw new org.omg.CORBA.INV_POLICY(
                 org.apache.yoko.orb.OB.MinorCodes