Skip to content

Commit

Permalink
Fix for NullPointer when using Json support without configured charset.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Langer <[email protected]>
  • Loading branch information
tomas-langer committed Feb 11, 2019
1 parent 7e7e09b commit f75a7be
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
Expand Down Expand Up @@ -185,7 +186,7 @@ private boolean testOrSetContentType(ServerRequest request, ServerResponse respo
* Returns a charset from {@code Content-Type} header parameter or {@code null} if not defined.
*
* @param headers parameters representing request or response headers
* @return a charset or {@code null}
* @return a charset or {@code UTF-8} as default
* @throws RuntimeException if charset is not supported
*/
private Charset determineCharset(Parameters headers) {
Expand All @@ -199,7 +200,7 @@ private Charset determineCharset(Parameters headers) {
return null; // Do not need default charset. Can use JSON specification.
}
})
.orElse(null);
.orElse(StandardCharsets.UTF_8);
}

/**
Expand Down

0 comments on commit f75a7be

Please sign in to comment.