{"record":{"id":"c868e43aaf4112d0","repo":"quarkusio/quarkus","slug":"principal-was-null-c868e4","errorCode":null,"errorMessage":"principal was null","messagePattern":"principal was null","errorType":"exception","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"integration-tests/elytron-undertow/src/main/java/io/quarkus/it/undertow/elytron/GreetingServlet.java","lineNumber":16,"sourceCode":"package io.quarkus.it.undertow.elytron;\n\nimport java.io.IOException;\n\nimport jakarta.servlet.ServletException;\nimport jakarta.servlet.annotation.WebServlet;\nimport jakarta.servlet.http.HttpServlet;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\n\n@WebServlet(name = \"ServletGreeting\", urlPatterns = \"/*\")\npublic class GreetingServlet extends HttpServlet {\n    @Override\n    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n        if (req.getUserPrincipal().getName() == null) {\n            throw new RuntimeException(\"principal was null\");\n        }\n        resp.setStatus(200);\n        resp.addHeader(\"Content-Type\", \"text/plain\");\n        resp.getWriter().write(\"hello\");\n    }\n\n    @Override\n    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n        if (req.getUserPrincipal().getName() == null) {\n            throw new RuntimeException(\"principal was null\");\n        }\n        String name = req.getReader().readLine();\n        resp.setStatus(200);\n        resp.addHeader(\"Content-Type\", \"text/plain\");\n        resp.getWriter().write(\"hello \" + name);\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/elytron-undertow/src/main/java/io/quarkus/it/undertow/elytron/GreetingServlet.java#L1-L34","documentation":"Sentinel check in an elytron-undertow integration-test servlet: after authenticated access, req.getUserPrincipal() (or its name) came back null, i.e. the security context did not carry the authenticated principal the test expects. This is a test-app assertion guard, not production code — the input at fault is the servlet request's security context.","triggerScenarios":"Thrown at integration-tests/elytron-undertow/src/main/java/io/quarkus/it/undertow/elytron/GreetingServlet.java:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate the request before invoking the endpoint","Verify the elytron/undertow security configuration secures the servlet url-pattern"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}