Repository: ant-ivy Updated Branches: refs/heads/master 9f5f0c098 -> b84f786db
IVY-1452: NullPointerException when accessing charset to invalid URL (Thanks to Frédéric Riviere) Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/902a6809 Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/902a6809 Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/902a6809 Branch: refs/heads/master Commit: 902a680951f318488a4bbe0184a3a223c5709b01 Parents: 9f5f0c0 Author: Nicolas LaleveÌe <nicolas.lale...@hibnet.org> Authored: Tue Oct 28 00:36:39 2014 +0100 Committer: Nicolas LaleveÌe <nicolas.lale...@hibnet.org> Committed: Tue Oct 28 00:36:39 2014 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/ivy/util/url/ApacheURLLister.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/902a6809/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 047cea0..4d18a9d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -153,6 +153,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br - FIX: The SSH resolvers fails if the un-required jsch jar is missing (IVY-1471) - FIX: failed to resolve dynamic revisions in some cases for URL repositories (IVY-1472) - FIX: ClassCastException in Eclipse 4.4.1 (IVY-1487) (Thanks to Carsten Pfeiffer) +- FIX: NullPointerException when accessing charset to invalid URL (IVY-1452) (Thanks to Frédéric Riviere) 2.4.0-rc1 ===================================== http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/902a6809/src/java/org/apache/ivy/util/url/ApacheURLLister.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/util/url/ApacheURLLister.java b/src/java/org/apache/ivy/util/url/ApacheURLLister.java index 1b92fb8..2df69b0 100644 --- a/src/java/org/apache/ivy/util/url/ApacheURLLister.java +++ b/src/java/org/apache/ivy/util/url/ApacheURLLister.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; import org.apache.ivy.util.FileUtil; import org.apache.ivy.util.Message; +import org.apache.ivy.util.url.URLHandler.URLInfo; /** * Utility class which helps to list urls under a given url. This has been tested with Apache 1.3.33 @@ -108,7 +109,13 @@ public class ApacheURLLister { } URLHandler urlHandler = URLHandlerRegistry.getDefault(); - String charset = urlHandler.getURLInfo(url).getBodyCharset(); + URLInfo urlInfo = urlHandler.getURLInfo(url); + if (urlInfo == URLHandler.UNAVAILABLE) { + return urlList; // not found => return empty list + } + // here, urlInfo is valid + String charset = urlInfo.getBodyCharset(); + InputStream contentStream = urlHandler.openStream(url); BufferedReader r = new BufferedReader(new InputStreamReader(contentStream, charset));