Author: ron.sigal(a)jboss.com
Date: 2008-03-26 01:28:29 -0400 (Wed, 26 Mar 2008)
New Revision: 3777
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
Log:
JBREM-934: Put Class.getMethod() in AccessController.doPrivileged() call.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-03-26
05:28:07 UTC (rev 3776)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-03-26
05:28:29 UTC (rev 3777)
@@ -43,6 +43,9 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Iterator;
/**
@@ -269,8 +272,24 @@
{
try
{
- Class c = Class.forName("java.lang.management.ManagementFactory");
- Method m = c.getMethod("getPlatformMBeanServer", new Class[] {});
+ final Class c =
Class.forName("java.lang.management.ManagementFactory");
+ Method m = null;
+
+ try
+ {
+ m = (Method)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return c.getMethod("getPlatformMBeanServer", new Class[]
{});
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
+
MBeanServer s = (MBeanServer) m.invoke(null, new Object[] {});
log.debug("Using platform MBeanServer");
return s;
Show replies by date