Buggy code:
private static final String SUBDEPLOYMENT = "subdeployment" ; private static final String UNDERTOW = "undertow" ; private static final String NAME = "name" ; private static final String SERVLET = "servlet" ; private static final String POSTFIX_WEB = ".war" ; private static final String POSTFIX_EAR = ".ear" ; private final String mgmtAddress ; private final int mgmtPort ; private final String mgmtProtocol ; private final ModelControllerClient client ; private URI webUri ; private URI ejbUri ; private ModelNode rootNode = null ; private MBeanServerConnection connection ; private JMXConnector connector ; public ManagementClient ( ModelControllerClient client , final String mgmtAddress , final int managementPort , final String protocol ) { } public ModelControllerClient getControllerClient ( ) { } public URI getWebUri ( ) { } public ProtocolMetaData getProtocolMetaData ( String deploymentName ) { } public boolean isServerInRunningState ( ) { } @ Override public void close ( ) { } private void readRootNode ( ) throws Exception { } private static ModelNode defined ( final ModelNode node , final String message ) { } private URI getBinding ( final String protocol , final String socketBinding ) { } private boolean isEnterpriseArchive ( String deploymentName ) { } private boolean isWebArchive ( String deploymentName ) { } private ModelNode createDeploymentAddress ( String deploymentName ) { } private void extractEnterpriseArchiveContexts ( HTTPContext context , ModelNode deploymentNode ) { } private void extractWebArchiveContexts ( HTTPContext context , ModelNode deploymentNode ) { } private void extractWebArchiveContexts ( HTTPContext context , String deploymentName , ModelNode deploymentNode ) { } private String toContextName ( String deploymentName ) { } private ModelNode readResource ( ModelNode address ) throws Exception { } private ModelNode executeForResult ( final ModelNode operation ) throws Exception { } private void checkSuccessful ( final ModelNode result , final ModelNode operation ) throws ManagementClient . UnSuccessfulOperationException { } private MBeanServerConnection getConnection ( ) { } public JMXServiceURL getRemoteJMXURL ( ) { } public int getMgmtPort ( ) { } public String getMgmtAddress ( ) { } public String getMgmtProtocol ( ) { } public URI getRemoteEjbURL ( ) { } private static class UnSuccessfulOperationException extends Exception { private static final long serialVersionUID = 1L ; public UnSuccessfulOperationException ( String message ) { } } private class MBeanConnectionProxy implements MBeanServerConnection { private MBeanServerConnection connection ; private MBeanConnectionProxy ( MBeanServerConnection connection ) { } @ Override public ObjectInstance createMBean ( String className , ObjectName name ) throws IOException , InstanceAlreadyExistsException , MBeanException , NotCompliantMBeanException , ReflectionException { } @ Override public ObjectInstance createMBean ( String className , ObjectName name , ObjectName loaderName ) throws IOException , InstanceAlreadyExistsException , InstanceNotFoundException , MBeanException , NotCompliantMBeanException , ReflectionException { } @ Override public ObjectInstance createMBean ( String className , ObjectName name , Object [ ] params , String [ ] signature ) throws IOException , InstanceAlreadyExistsException , MBeanException , NotCompliantMBeanException , ReflectionException { } @ Override public ObjectInstance createMBean ( String className , ObjectName name , ObjectName loaderName , Object [ ] params , String [ ] signature ) throws IOException , InstanceAlreadyExistsException , InstanceNotFoundException , MBeanException , NotCompliantMBeanException , ReflectionException { } @ Override public void unregisterMBean ( ObjectName name ) throws IOException , InstanceNotFoundException , MBeanRegistrationException { } @ Override public ObjectInstance getObjectInstance ( ObjectName name ) throws IOException , InstanceNotFoundException { } @ Override public Set < ObjectInstance > queryMBeans ( ObjectName name , QueryExp query ) throws IOException { } @ Override public Set < ObjectName > queryNames ( ObjectName name , QueryExp query ) throws IOException { } @ Override public boolean isRegistered ( ObjectName name ) throws IOException { } @ Override public Integer getMBeanCount ( ) throws IOException { } @ Override public Object getAttribute ( ObjectName name , String attribute ) throws IOException , AttributeNotFoundException , InstanceNotFoundException , MBeanException , ReflectionException { } @ Override public AttributeList getAttributes ( ObjectName name , String [ ] attributes ) throws IOException , InstanceNotFoundException , ReflectionException { } @ Override public void setAttribute ( ObjectName name , Attribute attribute ) throws IOException , AttributeNotFoundException , InstanceNotFoundException , InvalidAttributeValueException , MBeanException , ReflectionException { } @ Override public AttributeList setAttributes ( ObjectName name , AttributeList attributes ) throws IOException , InstanceNotFoundException , ReflectionException { } @ Override public Object invoke ( ObjectName name , String operationName , Object [ ] params , String [ ] signature ) throws IOException , InstanceNotFoundException , MBeanException , ReflectionException { } @ Override public String getDefaultDomain ( ) throws IOException { } @ Override public String [ ] getDomains ( ) throws IOException { } @ Override public void addNotificationListener ( ObjectName name , NotificationListener listener , NotificationFilter filter , Object handback ) throws IOException , InstanceNotFoundException { } @ Override public void addNotificationListener ( ObjectName name , ObjectName listener , NotificationFilter filter , Object handback ) throws IOException , InstanceNotFoundException { } @ Override public void removeNotificationListener ( ObjectName name , ObjectName listener ) throws IOException , InstanceNotFoundException , ListenerNotFoundException { } @ Override public void removeNotificationListener ( ObjectName name , ObjectName listener , NotificationFilter filter , Object handback ) throws IOException , InstanceNotFoundException , ListenerNotFoundException { } @ Override public void removeNotificationListener ( ObjectName name , NotificationListener listener ) throws IOException , InstanceNotFoundException , ListenerNotFoundException { } @ Override public void removeNotificationListener ( ObjectName name , NotificationListener listener , NotificationFilter filter , Object handback ) throws IOException , InstanceNotFoundException , ListenerNotFoundException { } @ Override public MBeanInfo getMBeanInfo ( ObjectName name ) throws IOException , InstanceNotFoundException , IntrospectionException , ReflectionException { } @ Override public boolean isInstanceOf ( ObjectName name , String className ) throws IOException , InstanceNotFoundException { } private boolean checkConnection ( ) { try { <START_BUG> this . connection . getMBeanCount ( ) ; <END_BUG> return true ; } catch ( IOException ioe ) { } this . connection = this . getConnection ( ) ; return false ; } private MBeanServerConnection getConnection ( ) { } } }

Fix:
this . connection . getDefaultDomain ( ) ;