Program: 60387
Project: 60387
Buggy source:
@Override public IRequestHandler onException(final RequestCycle cycle,final Exception e){
  LOG.error("String_Node_Str",e);
  PageParameters errorParameters=new PageParameters();
  IRequestablePage errorPage=null;
  if (instanceOf(e,UnauthorizedInstantiationException.class) != null) {
    errorParameters.add("String_Node_Str",MISSING_AUTHORIZATION);
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,AccessControlException.class) != null) {
    if (instanceOf(e,AccessControlException.class).getMessage().contains("String_Node_Str")) {
      errorParameters.add("String_Node_Str",PAGE_EXPIRED);
    }
 else {
      errorParameters.add("String_Node_Str",MISSING_AUTHORIZATION_CORE);
    }
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,PageExpiredException.class) != null || !SyncopeConsoleSession.get().isSignedIn()) {
    errorParameters.add("String_Node_Str",PAGE_EXPIRED);
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,BadRequestException.class) != null || instanceOf(e,WebServiceException.class) != null || instanceOf(e,SyncopeClientException.class) != null) {
    errorParameters.add("String_Node_Str",REST);
    errorPage=new Login(errorParameters);
  }
 else {
    Throwable cause=instanceOf(e,ForbiddenException.class);
    if (cause == null) {
      errorPage=new ExceptionErrorPage(e,null);
    }
 else {
      errorParameters.add("String_Node_Str",cause.getMessage());
      errorPage=new Login(errorParameters);
    }
  }
  if (errorPage instanceof Login) {
    try {
      SyncopeConsoleSession.get().cleanup();
      SyncopeConsoleSession.get().invalidateNow();
    }
 catch (    Throwable t) {
      LOG.debug("String_Node_Str",t);
    }
  }
  return new RenderPageRequestHandler(new PageProvider(errorPage));
}

Fixed version (ground truth):
@Override public IRequestHandler onException(final RequestCycle cycle,final Exception e){
  LOG.error("String_Node_Str",e);
  PageParameters errorParameters=new PageParameters();
  IRequestablePage errorPage=null;
  if (instanceOf(e,UnauthorizedInstantiationException.class) != null) {
    errorParameters.add("String_Node_Str",MISSING_AUTHORIZATION);
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,AccessControlException.class) != null) {
    if (instanceOf(e,AccessControlException.class).getMessage().contains("String_Node_Str")) {
      errorParameters.add("String_Node_Str",PAGE_EXPIRED);
    }
 else {
      errorParameters.add("String_Node_Str",MISSING_AUTHORIZATION_CORE);
    }
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,PageExpiredException.class) != null || !SyncopeConsoleSession.get().isSignedIn()) {
    errorParameters.add("String_Node_Str",PAGE_EXPIRED);
    errorPage=new Login(errorParameters);
  }
 else   if (instanceOf(e,BadRequestException.class) != null || instanceOf(e,WebServiceException.class) != null || instanceOf(e,SyncopeClientException.class) != null) {
    errorParameters.add("String_Node_Str",REST);
    errorPage=new Login(errorParameters);
  }
 else {
    Throwable cause=instanceOf(e,ForbiddenException.class);
    if (cause == null) {
      errorPage=new ExceptionErrorPage(e,null);
    }
 else {
      errorParameters.add("String_Node_Str",cause.getMessage());
      errorPage=new Login(errorParameters);
    }
  }
  if (errorPage instanceof Login) {
    try {
      SyncopeConsoleSession.get().invalidate();
    }
 catch (    Throwable t) {
      LOG.debug("String_Node_Str",t);
    }
  }
  return new RenderPageRequestHandler(new PageProvider(errorPage));
}