mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
prevent possible NPE
This commit is contained in:
@@ -134,14 +134,17 @@ public class HttpGetter {
|
|||||||
|
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
byte[] content = null;
|
byte[] content = null;
|
||||||
|
String contentType = null;
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
content = EntityUtils.toByteArray(entity);
|
content = EntityUtils.toByteArray(entity);
|
||||||
|
if (entity.getContentType() != null) {
|
||||||
|
contentType = entity.getContentType().getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - start;
|
long duration = System.currentTimeMillis() - start;
|
||||||
Header contentType = entity.getContentType();
|
result = new HttpResult(content, contentType, lastModifiedHeader == null ? null : lastModifiedHeader.getValue(),
|
||||||
result = new HttpResult(content, contentType == null ? null : contentType.getValue(), lastModifiedHeader == null ? null
|
eTagHeader == null ? null : eTagHeader.getValue(), duration);
|
||||||
: lastModifiedHeader.getValue(), eTagHeader == null ? null : eTagHeader.getValue(), duration);
|
|
||||||
} finally {
|
} finally {
|
||||||
client.getConnectionManager().shutdown();
|
client.getConnectionManager().shutdown();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user