-
Bug
-
Resolution: Fixed
-
P4
-
1.2.1
-
b32
-
unknown
-
generic
-
Verified
The following piece of Java code is enough to understand the problem.
Side effect is the user can not discriminate case the mbeanServer argument is faked from the 3 cases listed below.
/* COPY/PASTE OF THE JAVADOC OF javax/management.MBeanServerFactory.releaseMBeanServer()
releaseMBeanServer
public static void releaseMBeanServer(MBeanServer mbeanServer)
Remove internal MBeanServerFactory references to a created MBeanServer. This allows the garbage collector to remove the MBeanServer object.
Parameters:
mbeanServer - the MBeanServer object to remove.
Throws:
java.lang.IllegalArgumentException - if mbeanServer was not generated by one of the createMBeanServer methods, or if releaseMBeanServer was already called on it.
java.lang.SecurityException - if there is a SecurityManager and the caller's permissions do not include or imply MBeanServerPermission("releaseMBeanServer").
*/
import javax.management.* ;
public class MBS
{
public void run(String args[]) {
MBeanServer mbs = MBeanServerFactory.newMBeanServer() ;
try {
System.out.println("1 - release called after new") ;
MBeanServerFactory.releaseMBeanServer(mbs) ;
System.out.println("I did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
try {
System.out.println("2 - release called twice after new") ;
MBeanServerFactory.releaseMBeanServer(mbs) ;
System.out.println("I did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
MBeanServer mbs2 = MBeanServerFactory.createMBeanServer() ;
try {
System.out.println("3 - release called twice after create") ;
MBeanServerFactory.releaseMBeanServer(mbs2) ;
MBeanServerFactory.releaseMBeanServer(mbs2) ;
System.out.println("3 did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
}
public static void main (String args[]) {
MBS instance = new MBS();
instance.run(args);
}
}
Side effect is the user can not discriminate case the mbeanServer argument is faked from the 3 cases listed below.
/* COPY/PASTE OF THE JAVADOC OF javax/management.MBeanServerFactory.releaseMBeanServer()
releaseMBeanServer
public static void releaseMBeanServer(MBeanServer mbeanServer)
Remove internal MBeanServerFactory references to a created MBeanServer. This allows the garbage collector to remove the MBeanServer object.
Parameters:
mbeanServer - the MBeanServer object to remove.
Throws:
java.lang.IllegalArgumentException - if mbeanServer was not generated by one of the createMBeanServer methods, or if releaseMBeanServer was already called on it.
java.lang.SecurityException - if there is a SecurityManager and the caller's permissions do not include or imply MBeanServerPermission("releaseMBeanServer").
*/
import javax.management.* ;
public class MBS
{
public void run(String args[]) {
MBeanServer mbs = MBeanServerFactory.newMBeanServer() ;
try {
System.out.println("1 - release called after new") ;
MBeanServerFactory.releaseMBeanServer(mbs) ;
System.out.println("I did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
try {
System.out.println("2 - release called twice after new") ;
MBeanServerFactory.releaseMBeanServer(mbs) ;
System.out.println("I did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
MBeanServer mbs2 = MBeanServerFactory.createMBeanServer() ;
try {
System.out.println("3 - release called twice after create") ;
MBeanServerFactory.releaseMBeanServer(mbs2) ;
MBeanServerFactory.releaseMBeanServer(mbs2) ;
System.out.println("3 did not receive any IllegalArgumentException ==> BUG") ;
} catch(Exception e) {
e.printStackTrace() ;
}
}
public static void main (String args[]) {
MBS instance = new MBS();
instance.run(args);
}
}