Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check to cope with missing Content-Type header #3

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ public HttpResponse sendGetCommand(final String url, final Header... rqstHeaders
// Sony may report ill-formed content response
final MultivaluedMap<String, Object> metadata = response.getMetadata();
final List<Object> content = metadata.get("Content-Type");
for (int index = 0; index < content.size(); index++) {
if (content.get(index) instanceof String entry) {
content.set(index, entry.replaceAll(".+:", "").trim());
if (content != null) {
for (int index = 0; index < content.size(); index++) {
if (content.get(index) instanceof String entry) {
content.set(index, entry.replaceAll(".+:", "").trim());
}
}
metadata.put("Content-Type", content);
}
metadata.put("Content-Type", content);
return new HttpResponse(Response.fromResponse(response).replaceAll(metadata).build());
}
} catch (ProcessingException | IllegalStateException | IOException e) {
Expand Down