[portal-commits] JBoss Portal SVN: r11899 - branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/workflow.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Fri Sep 12 13:25:06 EDT 2008
Author: sohil.shah at jboss.com
Date: 2008-09-12 13:25:06 -0400 (Fri, 12 Sep 2008)
New Revision: 11899
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
Log:
JBPORTAL-2109 - CMS Security Issue with LDAP/Clustered mode (solving issue with JNDI lookups on slave nodes)
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java 2008-09-12 16:43:15 UTC (rev 11898)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java 2008-09-12 17:25:06 UTC (rev 11899)
@@ -27,6 +27,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.naming.InitialContext;
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
@@ -107,14 +108,25 @@
/** @return */
public static CMS getCMSService()
{
+ CMS cms = null;
try
{
MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- return (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
+ cms = (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
}
catch (Exception e)
- {
- throw new RuntimeException(e);
+ {
+ try
+ {
+ //Give it a last try and look up in the JNDI tree (this happens in the test suite, where there is no mbean server)
+ cms = (CMS)new InitialContext().lookup("java:/portal/CMS");
+ }
+ catch(Exception ex)
+ {
+ //This failed too....This is a real failure and throw an exception
+ throw new RuntimeException(ex);
+ }
}
+ return cms;
}
}
More information about the portal-commits
mailing list