Syntax Error in errorhandler.jsp

OpenMRS Version: 1.11.4 Module: Radiology

The errorhandler.jsp throws a syntax error, when the errorpage is displayed, I get the following error:


org.apache.jasper.JasperException: Unable to compile class for JSP: 

    An error occurred at line: [180] in the generated java file: [/var/lib/tomcat7/work/Catalina/localhost/openmrs/org/apache/jsp/]
    Syntax error, insert "}" to complete Block

As far as I understand the file gets generated from the errorhandler.jsp file. So when I look at the generated file, there seems to be a missing bracket, in the line that say //end else. Someone must have written that “//end else” intentionally, and I need to know whats the deal about that.

I hope someone can help me, maybe @dkayiwa as you last edited errorhandler.jsp in 1.11.4 ?

Thanks in advance! Georg

This JSP has a lot of technical debt, it deserves a refactoring :slight_smile:

I found a solution for my problem by myself:

This is actually a core issue. You can resolve it by adding a closing bracket “}” in the errorhandler.jsp file, located in /var/lib/tomcat7/webapps/openmrs, right above the last line, like this:

52 org.openmrs.api.context.Context.closeSession(); 53 } <<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE 54 //end else%>

But I still do not know why the last line is commented like this, maybe this has a specific meaning to the author?

Pull request welcome :wink:

You’re right, the commented } should be uncommented (and the closing %> too). There are two scriptlets in this JSP, and the second one belongs to the else part of the first one, but as the code is not indented it’s easy to make a mistake. Because scriptlets are MORDOR.


Thank you for your support, the issue is marked as fixed, and the PR is merged :grinning: