- 
    Enhancement 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    17, 20, 21
- 
        b12
                    In the method java.net.HttpURLConnection#getHeaderFieldDate
public long getHeaderFieldDate(String name, long Default) {
String dateString = getHeaderField(name);
try {
if (!dateString.contains("GMT")) {
dateString = dateString+" GMT";
}
return Date.parse(dateString);
} catch (Exception e) {
}
return Default;
}
If dateString, expensive NPE is thrown and then caught.
For example it happen with 'last-modified' header.
We should check whether it is present before trying to parse it.
public long getHeaderFieldDate(String name, long Default) {
String dateString = getHeaderField(name);
try {
if (!dateString.contains("GMT")) {
dateString = dateString+" GMT";
}
return Date.parse(dateString);
} catch (Exception e) {
}
return Default;
}
If dateString, expensive NPE is thrown and then caught.
For example it happen with 'last-modified' header.
We should check whether it is present before trying to parse it.
 
        