Buggy code:
class DomainApiHandler implements ManagementHttpHandler { private static final String DOMAIN_API_CONTEXT = "//management" ; private static final String UPLOAD_REQUEST = ( DomainApiHandler . DOMAIN_API_CONTEXT ) + "//add-content" ; private static Pattern MULTIPART_FD_BOUNDARY = Pattern . compile ( "^multipart//form-data.*;\\s*boundary=(.*)$" ) ; private static Pattern DISPOSITION_FILE = Pattern . compile ( "^form-data.*filename=\"?([^\"]*)?\"?.*$" ) ; enum GetOperation { RESOURCE ( "read-resource" ) , ATTRIBUTE ( "read-attribute" ) , RESOURCE_DESCRIPTION ( "read-resource-description" ) , SNAPSHOTS ( "list-snapshots" ) , OPERATION_DESCRIPTION ( "read-operation-description" ) , OPERATION_NAMES ( "read-operation-names" ) ; private String realOperation ; GetOperation ( String realOperation ) { } public String realOperation ( ) { } } private final Authenticator authenticator ; private final ControlledProcessStateService controlledProcessStateService ; private ModelControllerClient modelController ; DomainApiHandler ( final ModelControllerClient modelController , final Authenticator authenticator , final ControlledProcessStateService controlledProcessStateService ) { } private void doHandle ( HttpExchange http ) throws IOException { } @ Override public void handle ( HttpExchange exchange ) throws IOException { } private void drain ( HttpExchange exchange ) throws IOException { } private String extractContentType ( final String fullContentType ) { } private void processUploadRequest ( final HttpExchange http ) throws IOException { } private void processRequest ( final HttpExchange http ) throws IOException { } private void sendError ( final HttpExchange http , boolean isGet , Throwable t ) throws IOException { } private void sendResponse ( final HttpExchange exchange , final int responseCode , final String body ) throws IOException { } private static final class SeekResult { BoundaryDelimitedInputStream stream ; } private DomainApiHandler . SeekResult seekToDeployment ( final HttpExchange http ) throws IOException { } private void drain ( InputStream stream ) { } private ModelNode convertPostRequest ( InputStream stream , boolean encode ) throws IOException { } private ModelNode convertGetRequest ( URI request ) { } private ArrayList < String > decodePath ( String path ) { } private String unescape ( String string ) { } private Map < String , String > decodeQuery ( String query ) { } public void start ( HttpServer httpServer , SecurityRealm securityRealm ) { HttpContext context = httpServer . createContext ( DomainApiHandler . DOMAIN_API_CONTEXT , new SubjectAssociationHandler ( this ) ) ; if ( ( authenticator ) != null ) { context . setAuthenticator ( authenticator ) ; List < Filter > filters = context . getFilters ( ) ; <START_BUG> if ( ( securityRealm . getSupportedAuthenticationMechanisms ( ) . contains ( CLIENT_CERT ) ) == false ) { <END_BUG> filters . add ( new DmrFailureReadinessFilter ( securityRealm , ErrorHandler . getRealmRedirect ( ) ) ) ; } } } public void stop ( HttpServer httpServer ) { } }

Fix:
if ( ( securityRealm != null ) && ( ( securityRealm . getSupportedAuthenticationMechanisms ( ) . contains ( CLIENT_CERT ) ) == false ) ) {