import javax.management.*; /** * In an ObjectName, a key cannot be empty * * Bug exists in Sun and BEA jdk5. * Bug fixed in Sun jdk6. * see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6229396 */ public class TestMalformedObjectName { public static void main(String args[]) { try { String badName = "d:=value"; new ObjectName(badName); System.err.println("Expected MalformedObjectNameException exception for objectName: " + badName); System.exit(1); } catch (MalformedObjectNameException e) { System.out.println("Caught expected exception: " + e); } } }