private ErrorPage createErrorPage(final ErrorPageModel model) {
   NullArgumentException.validateNotNull(model, "model");
   NullArgumentException.validateNotNull(model.getLocation(), "model#location");
   NullArgumentException.validateNotNull(model.getError(), "model#error");
   final ErrorPage errorPage = new ErrorPage();
   errorPage.setLocation(model.getLocation());
   final Integer errorCode = parseErrorCode(model.getError());
   if (errorCode != null) {
     errorPage.setErrorCode(errorCode);
   } else {
     errorPage.setExceptionType(model.getError());
   }
   return errorPage;
 }
 public void addToContext(Context context) {
   Assert.state(
       this.nativePage != null,
       "Neither Tomcat 7 nor 8 detected so no native error page exists");
   if (ClassUtils.isPresent("org.apache.catalina.deploy.ErrorPage", null)) {
     org.apache.catalina.deploy.ErrorPage errorPage =
         (org.apache.catalina.deploy.ErrorPage) this.nativePage;
     errorPage.setLocation(this.location);
     errorPage.setErrorCode(this.errorCode);
     errorPage.setExceptionType(this.exceptionType);
     context.addErrorPage(errorPage);
   } else {
     callMethod(this.nativePage, "setLocation", this.location, String.class);
     callMethod(this.nativePage, "setErrorCode", this.errorCode, int.class);
     callMethod(this.nativePage, "setExceptionType", this.exceptionType, String.class);
     callMethod(context, "addErrorPage", this.nativePage, this.nativePage.getClass());
   }
 }