Update of /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/resolver/soap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2537/tools/mx4j/tools/remote/resolver/soap
Modified Files:
SOAPResolver.java
Log Message:
Better runtime exception handling and wrapping the retrieval of the MBeanServer ID into a privileged block
Index: SOAPResolver.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/resolver/soap/SOAPResolver.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SOAPResolver.java 18 Sep 2003 18:44:57 -0000 1.4
--- SOAPResolver.java 1 Mar 2004 18:25:31 -0000 1.5
***************
*** 14,17 ****
--- 14,20 ----
import java.util.List;
import java.util.Map;
+ import java.security.AccessController;
+ import java.security.PrivilegedExceptionAction;
+ import java.security.PrivilegedActionException;
import javax.management.JMException;
***************
*** 120,132 ****
if (connectorID == null) connectorID = generateConnectorID();
! MBeanServer mbeanServer = (MBeanServer)server;
try
{
! String mbeanServerId = (String)mbeanServer.getAttribute(new ObjectName("JMImplementation:type=MBeanServerDelegate"), "MBeanServerId");
! synchronized (mbeanServerIds)
{
! String existing = findMBeanServerId(connectorID);
! if (existing != null && !existing.equals(mbeanServerId)) throw new IOException("SOAPConnectorServer with ID " + connectorID + " is already attached to MBeanServer with ID " + existing);
! mbeanServerIds.put(connectorID, mbeanServerId);
}
}
--- 123,148 ----
if (connectorID == null) connectorID = generateConnectorID();
! final MBeanServer mbeanServer = (MBeanServer)server;
try
{
! try
{
! String mbeanServerId = (String)AccessController.doPrivileged(new PrivilegedExceptionAction()
! {
! public Object run() throws JMException
! {
! return mbeanServer.getAttribute(new ObjectName("JMImplementation:type=MBeanServerDelegate"), "MBeanServerId");
! }
! });
! synchronized (mbeanServerIds)
! {
! String existing = findMBeanServerId(connectorID);
! if (existing != null && !existing.equals(mbeanServerId)) throw new IOException("SOAPConnectorServer with ID " + connectorID + " is already attached to MBeanServer with ID " + existing);
! mbeanServerIds.put(connectorID, mbeanServerId);
! }
! }
! catch (PrivilegedActionException x)
! {
! throw (JMException)x.getException();
}
}
***************
*** 171,174 ****
--- 187,194 ----
deployer.process(options, wsdd);
}
+ catch (RuntimeException x)
+ {
+ throw x;
+ }
catch (Exception x)
{
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.