Skip to content

Commit

Permalink
Fix #616 - avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Jun 25, 2024
1 parent 15a83b8 commit d61dc74
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 d61dc74

Please sign in to comment.