Browse Source

Bug 48833 - NPE in <get>

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@917574 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 15 years ago
parent
commit
f8e0dcd65a
2 changed files with 9 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +6
    -1
      src/main/org/apache/tools/ant/taskdefs/Get.java

+ 3
- 0
WHATSNEW View File

@@ -44,6 +44,9 @@ Fixed bugs:
* If <concat>'s first resourcecollection child is a <resources>, * If <concat>'s first resourcecollection child is a <resources>,
any subsequently added child resourcecollection joins the first. any subsequently added child resourcecollection joins the first.
Bugzilla Report 48816. Bugzilla Report 48816.
* <get> with an invalid URL could trigger an NPE in some JVMs.
Bugzilla Report 48833


Other changes: Other changes:
-------------- --------------


+ 6
- 1
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -658,7 +658,12 @@ public class Get extends Task {
.setUseCaches(httpUseCaches); .setUseCaches(httpUseCaches);
} }
// connect to the remote site (may take some time) // connect to the remote site (may take some time)
connection.connect();
try {
connection.connect();
} catch (NullPointerException e) {
//bad URLs can trigger NPEs in some JVMs
throw new BuildException("Failed to parse " + source.toString(), e);
}


// First check on a 301 / 302 (moved) response (HTTP only) // First check on a 301 / 302 (moved) response (HTTP only)
if (connection instanceof HttpURLConnection) { if (connection instanceof HttpURLConnection) {


Loading…
Cancel
Save