Buggy code:
public class SecurityClient { public SecurityClient ( KeycloakConfig config ) { } public List < ApplicationRepresentation > applications ( String authToken , String realmName ) throws Exception { } public ApplicationRepresentation application ( String authToken , String realmName , String appName ) throws Exception { } public void updateApplication ( String authToken , String realmName , ApplicationRepresentation app ) throws Exception { } public void createApplication ( String authToken , String realmName , String appName ) throws Exception { } public void deleteApplication ( String authToken , String realmName , String appName ) throws Exception { } public List < RoleRepresentation > applicationRoles ( String authToken , String realmName , String appName ) throws Exception { } public void createApplicationRole ( String authToken , String realmName , String appName , String roleName ) throws Exception { } public void deleteApplicationRole ( String authToken , String realmName , String appName , String roleName ) throws Exception { } public MappingsRepresentation clientScopeMappings ( String authToken , String realmName , String clientApp ) throws Exception { } public List < RoleRepresentation > clientScopeRolesForApplication ( String authToken , String realmName , String clientApp , String appName ) throws Exception { } public void addClientScopeRolesForApplication ( String authToken , String realmName , String clientApp , String appName , List < RoleRepresentation > roles ) throws Exception { } public void removeClientScopeRolesForApplication ( String authToken , String realmName , String clientApp , String appName , List < RoleRepresentation > roles ) throws Exception { } public List < RoleRepresentation > availableClientScopeRolesForApplication ( String authToken , String realmName , String clientApp , String appName ) throws Exception { } private < T > T exec ( HttpRequestBase request , int expectedResponse , String failureMessage , SecurityClient . ExecReturn < HttpEntity , T > responseHandler ) throws Exception { } private void addAuthzHeader ( HttpRequestBase request , String authToken ) { } private String realmEndpoint ( String realmName ) { <START_BUG> return ( ( this . config . getBaseUrl ( ) ) + "//realms//" ) + realmName ; <END_BUG> } private String realmApplicationsEndpoint ( String realmName ) { } private String applicationEndpoint ( String realmName , String appName ) { } private String applicationRolesEndpoint ( String realmName , String appName ) { } private String roleEndpoint ( String realmName , String appName , String roleName ) { } private String clientScopeMappingsEndpoint ( String realmName , String clientApp ) { } private String clientScopeForApplicationsEndpoint ( String realmName , String clientApp , String appName ) { } private String availableClientScopesForApplicationsEndpoint ( String realmName , String clientApp , String appName ) { } private CloseableHttpClient httpClient ( ) { } private KeycloakConfig config ; @ FunctionalInterface interface ExecReturn < T , R > { R apply ( T t ) throws Exception { } } class VoidHandler implements SecurityClient . ExecReturn < HttpEntity , Void > { @ Override public Void apply ( HttpEntity entity ) { } } class HttpDeleteWithEntity extends HttpEntityEnclosingRequestBase { public HttpDeleteWithEntity ( final String uri ) { } @ Override public String getMethod ( ) { } } static class TypedApplicationList extends ArrayList < ApplicationRepresentation > { } static class TypedRoleList extends ArrayList < RoleRepresentation > { } }

Fix:
return ( ( this . config . getBaseUrl ( ) ) + "//admin//realms//" ) + realmName ;