Skip to content

[jsp] Fix #5092: allow JSP directives and scriptlets before the doctype - #7252

Open
InnoxCodes wants to merge 1 commit into
pmd:mainfrom
InnoxCodes:fix/jsp-doctype-after-directive
Open

InnoxCodes wants to merge 1 commit into
pmd:mainfrom
InnoxCodes:fix/jsp-doctype-after-directive

Conversation

@InnoxCodes

Copy link
Copy Markdown

Describe the PR

Prolog() in Jsp.jjt only allowed comments before the doctype, so a page starting with a directive like <%@ page contentType="text/html" %> failed with Encountered "<!DOCTYPE". It now also accepts directives, scriptlets and declarations there.

New test testDoctypeAfterJspDirectives in JspDocStyleTest fails on main and passes now. I ran all the pmd-jsp tests (150) and checkstyle for the module, not the whole ./mvnw clean verify. The issue has no file attached, so this matches the message but I can't be sure it's the reporter's exact case.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

…ctype

The prolog of a JSP only accepted comments in front of the doctype
declaration, so the very common

    <%@ page contentType="text/html" %>
    <!DOCTYPE html>

failed with `Encountered "<!DOCTYPE"`. JSP directives, scriptlets,
declarations and comments are now accepted before the doctype.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jsp] Parsing error with <!DOCTYPE html>

1 participant