mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
trim empty headers to null (fix #378)
This commit is contained in:
@@ -128,14 +128,13 @@ public class HttpGetter {
|
|||||||
Header eTagHeader = response.getFirstHeader(HttpHeaders.ETAG);
|
Header eTagHeader = response.getFirstHeader(HttpHeaders.ETAG);
|
||||||
|
|
||||||
String lastModifiedResponse = lastModifiedHeader == null ? null
|
String lastModifiedResponse = lastModifiedHeader == null ? null
|
||||||
: lastModifiedHeader.getValue();
|
: StringUtils.trimToNull(lastModifiedHeader.getValue());
|
||||||
if (lastModified != null
|
if (lastModified != null
|
||||||
&& StringUtils.equals(lastModified, lastModifiedResponse)) {
|
&& StringUtils.equals(lastModified, lastModifiedResponse)) {
|
||||||
throw new NotModifiedException("lastModifiedHeader is the same");
|
throw new NotModifiedException("lastModifiedHeader is the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
String eTagResponse = eTagHeader == null ? null : eTagHeader
|
String eTagResponse = eTagHeader == null ? null : StringUtils.trimToNull(eTagHeader.getValue());
|
||||||
.getValue();
|
|
||||||
if (eTag != null && StringUtils.equals(eTag, eTagResponse)) {
|
if (eTag != null && StringUtils.equals(eTag, eTagResponse)) {
|
||||||
throw new NotModifiedException("eTagHeader is the same");
|
throw new NotModifiedException("eTagHeader is the same");
|
||||||
}
|
}
|
||||||
@@ -217,8 +216,8 @@ public class HttpGetter {
|
|||||||
|
|
||||||
public static class NotModifiedException extends Exception {
|
public static class NotModifiedException extends Exception {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public NotModifiedException(String message){
|
public NotModifiedException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user