Enabling interim fix JR53357

JR53357 resolves an issue where an incorrect store URL returns an error page that shows a 200 OK status instead of an error status.

Before you begin

Install the interim fix for JR53357.

About this task

The GenericApplicationError.jsp file that is responsible for generating the error message was updated to set the return code to the correct status code. When the cause of the exception is of type "ECApplicationException", the return code is set to "400". Otherwise, the return code is set to "500".

The GenericApplicationError.jsp is not automatically updated for your published store. Stores that are published after you install the interim fix will contain the updated JSP file. Otherwise, for your existing store, you need to manually update the GenericApplicationError.jsp file. Complete the following procedure to manually update the GenericApplicationError.jsp file.

Procedure

  1. In your WebSphere Commerce development environment, open the following file, workspace_dir\Stores\WebContent\GenericApplicationError.jsp
  2. Add an import declaration to the top of the file.
    <%@ page import="com.ibm.commerce.exception.ECApplicationException"%>
  3. Find the following line of code.
    <wcbase:useBean id="errorBean" classname="com.ibm.commerce.beans.ErrorDataBean" scope="page"/>
  4. Add the following code after the line that you found.
    <% 
        if (errorBean.getException() instanceof ECApplicationException) {  
            String messageKey = errorBean.getMessageKey();  
            if (ECMessage._ERR_CMD_CMD_NOT_FOUND.getMessageKey().equals(messageKey)) {
                response.setStatus(404);  
            } else {   
                    response.setStatus(400);  
            } 
        } else {  
                 response.setStatus(500); 
        }
    %>
  5. Save and close the file.
  6. Test your changes.
  7. Deploy the changes to your production environment.