Skip to content

Commit e221bca

Browse files
committed
Fix NPE in HttpServletResponseExtension.getMimeTypes() for parallel test execution
Add null-safe operator when accessing webRequest.applicationContext to handle cases where GrailsWebRequest.lookup() returns null during parallel test runs. This fixes the Windows CI failure in RespondMethodSpec where tests that rely on default HTML content type negotiation were failing with NullPointerException.
1 parent b71a1e8 commit e221bca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grails-mimetypes/src/main/groovy/org/grails/web/mime/HttpServletResponseExtension.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class HttpServletResponseExtension {
8181

8282
final webRequest = GrailsWebRequest.lookup()
8383

84-
def context = webRequest.applicationContext
84+
def context = webRequest?.applicationContext
8585
if (context) {
8686
try {
8787
mimeTypes = context.getBean(MimeUtility).getKnownMimeTypes() as MimeType[]

0 commit comments

Comments
 (0)