Skip to content

Commit

Permalink
Merge pull request #663 from markt-asf/fix-issue-616
Browse files Browse the repository at this point in the history
Fix #616 - avoid NPE
  • Loading branch information
stuartwdouglas committed Jun 24, 2024
2 parents 40d1588 + 45eddbb commit 795442b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/src/main/java/jakarta/servlet/ServletResponse.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023 Oracle and/or its affiliates and others.
* Copyright (c) 1997, 2024 Oracle and/or its affiliates and others.
* All rights reserved.
* Copyright 2004 The Apache Software Foundation
*
Expand Down Expand Up @@ -211,7 +211,11 @@ public interface ServletResponse {
* @since Servlet 6.1
*/
default void setCharacterEncoding(Charset encoding) {
setCharacterEncoding(encoding.name());
if (encoding == null) {
setCharacterEncoding((String) null);
} else {
setCharacterEncoding(encoding.name());
}
}

/**
Expand Down

0 comments on commit 795442b

Please sign in to comment.