diff --git a/WHATSNEW b/WHATSNEW index 36b98806b..5894c07c7 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -27,11 +27,6 @@ Fixed bugs: cannot determine the local hostname. Bugzilla Report 56593 - * URLResource#getLastModified tried to access the connection to the - URL without making sure it was established, potentially leading to - a NullPointerException. - Bugzilla Report 56873 - Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/resources/URLResource.java b/src/main/org/apache/tools/ant/types/resources/URLResource.java index ab564ca62..a1439080a 100644 --- a/src/main/org/apache/tools/ant/types/resources/URLResource.java +++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java @@ -263,16 +263,10 @@ public class URLResource extends Resource implements URLProvider { return ((Resource) getCheckedRef()).getLastModified(); } if (!isExists(false)) { - return 0L; - } - try { - connect(); - long lastModified = conn.getLastModified(); - close(); - return lastModified; - } catch (IOException e) { return UNKNOWN_DATETIME; } + // isExists has already opened the connection + return conn.getLastModified(); } /**