package com.sldlt.controller;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;

import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class BaseErrorController implements ErrorController {

    private static final String PATH = "/error";

    @RequestMapping(value = PATH)
    public String handleError(final HttpServletRequest request) {
        int statusCode = 500;
        Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);

        if (status != null) {
            try {
                statusCode = Integer.valueOf(status.toString());
            } catch (NumberFormatException ex) {
                // nothing to do
            }
        }

        if (statusCode == HttpStatus.NOT_FOUND.value()) {
            return "error-404";
        } else {
            return "error";
        }
    }

    @Override
    public String getErrorPath() {
        return PATH;
    }
}

@@ -590,11 +590,48 @@
 e = 
-500
+HttpStatus.INTERNAL_SERVER_ERROR.value()
 ;%0A  
@@ -894,24 +894,62 @@
     
-// nothing to do
+statusCode = HttpStatus.INTERNAL_SERVER_ERROR.value();
 %0A   

fix pmd error