mx4j/src/core/mx4j/server MX4JMBeanServer.java,1.26,1.27
Jeremy Boynes <[email protected]> Sun, 13 Feb 2005 19:46:01 +0000
| Newsgroups | gmane.comp.java.mx4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/server
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18825/src/core/mx4j/server
Modified Files:
MX4JMBeanServer.java
Log Message:
Fix for [ 1121912 ] Exception from preRegister prevents registration
Fix for [ 1121915 ] Exception in preDeregister should terminate immediately
Updated postDeregister testcase for correct Exception
Index: MX4JMBeanServer.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/server/MX4JMBeanServer.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** MX4JMBeanServer.java 9 Feb 2005 00:37:09 -0000 1.26
--- MX4JMBeanServer.java 13 Feb 2005 19:45:58 -0000 1.27
***************
*** 511,514 ****
--- 511,518 ----
throws InstanceNotFoundException
{
+ if (observed == null)
+ {
+ throw new RuntimeOperationsException(new IllegalArgumentException("ObjectName cannot be null"));
+ }
if (listener == null)
{
***************
*** 817,874 ****
MBeanServerInterceptor head = getHeadInterceptor();
! try
! {
! // With this call, the MBean implementor can replace the ObjectName with a subclass that is not secure, secure it again
! head.registration(metadata, MBeanServerInterceptor.PRE_REGISTER);
! metadata.setObjectName(secureObjectName(metadata.getObjectName()));
! // metadata.instance = new ObjectInstance(metadata.name, metadata.info.getClassName());
register(metadata, privileged);
!
! head.registration(metadata, MBeanServerInterceptor.POST_REGISTER_TRUE);
}
! catch (Throwable x)
{
! try
! {
! head.registration(metadata, MBeanServerInterceptor.POST_REGISTER_FALSE);
! }
! catch (MBeanRegistrationException ignored)
! {/* Ignore this one to rethrow the other one */
! }
!
! if (x instanceof SecurityException)
! {
! throw (SecurityException)x;
! }
! else if (x instanceof InstanceAlreadyExistsException)
! {
! throw (InstanceAlreadyExistsException)x;
! }
! else if (x instanceof MBeanRegistrationException)
! {
! throw (MBeanRegistrationException)x;
! }
! else if (x instanceof RuntimeOperationsException)
! {
! throw (RuntimeOperationsException)x;
! }
! else if (x instanceof JMRuntimeException)
! {
! throw (JMRuntimeException)x;
! }
! else if (x instanceof Exception)
! {
! throw new MBeanRegistrationException((Exception)x);
! }
! else if (x instanceof Error)
! {
! throw new MBeanRegistrationException(new RuntimeErrorException((Error)x));
! }
! else
! {
! throw new ImplementationException();
! }
}
--- 821,838 ----
MBeanServerInterceptor head = getHeadInterceptor();
! head.registration(metadata, MBeanServerInterceptor.PRE_REGISTER);
! // The MBean implementor could have replaced the ObjectName with a subclass that is not secure, secure it again
! metadata.setObjectName(secureObjectName(metadata.getObjectName()));
+ int postRegisterFlag = MBeanServerInterceptor.POST_REGISTER_FALSE;
+ try
+ {
register(metadata, privileged);
! postRegisterFlag = MBeanServerInterceptor.POST_REGISTER_TRUE;
}
! finally
{
! head.registration(metadata, postRegisterFlag);
}
***************
*** 961,994 ****
MBeanMetaData metadata = findMBeanMetaData(objectName);
! try
! {
! MBeanServerInterceptor head = getHeadInterceptor();
! head.registration(metadata, MBeanServerInterceptor.PRE_DEREGISTER);
!
! unregister(metadata);
! getHeadInterceptor().registration(metadata, MBeanServerInterceptor.POST_DEREGISTER);
! Object mbean = metadata.getMBean();
! if (mbean instanceof ClassLoader && !(mbean instanceof PrivateClassLoader))
! {
! getModifiableClassLoaderRepository().removeClassLoader((ClassLoader)mbean);
! }
! }
! catch (MBeanRegistrationException x)
! {
! throw x;
! }
! catch (SecurityException x)
! {
! throw x;
! }
! catch (Exception x)
! {
! throw new MBeanRegistrationException(x);
! }
! catch (Error x)
{
! throw new MBeanRegistrationException(new RuntimeErrorException(x));
}
}
--- 925,938 ----
MBeanMetaData metadata = findMBeanMetaData(objectName);
! MBeanServerInterceptor head = getHeadInterceptor();
! head.registration(metadata, MBeanServerInterceptor.PRE_DEREGISTER);
! unregister(metadata);
! getHeadInterceptor().registration(metadata, MBeanServerInterceptor.POST_DEREGISTER);
! Object mbean = metadata.getMBean();
! if (mbean instanceof ClassLoader && !(mbean instanceof PrivateClassLoader))
{
! getModifiableClassLoaderRepository().removeClassLoader((ClassLoader)mbean);
}
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click