Skip to content

Commit

Permalink
Merge pull request #3 from sbholmes/feature/sony-4.2
Browse files Browse the repository at this point in the history
Add null check to cope with missing Content-Type header
  • Loading branch information
andan67 authored Dec 8, 2024
2 parents 0ece68b + 6ef1b9a commit f71ebd4
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit f71ebd4

Please sign in to comment.