From 394f665213e33f7e47dbf637f63979842c80a69a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 17 Nov 2011 11:56:43 +0000 Subject: [PATCH] no reason to log at ERR if a URL doesn't exist and all we do is checking whether it does. Addresses PR 51802 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1203160 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../tools/ant/types/resources/URLResource.java | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index ac0abd2a0..01cef160f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -144,6 +144,9 @@ Other changes: used for up-to-date-ness checks. Bugzilla Report 52096. + * URLResources#isExists has become less noisy. + Bugzilla Report 51802. + Changes from Ant 1.8.1 TO Ant 1.8.2 =================================== 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 067226870..9f6aea9f0 100644 --- a/src/main/org/apache/tools/ant/types/resources/URLResource.java +++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java @@ -226,7 +226,7 @@ public class URLResource extends Resource implements URLProvider { return false; } try { - connect(); + connect(Project.MSG_VERBOSE); return true; } catch (IOException e) { return false; @@ -363,7 +363,19 @@ public class URLResource extends Resource implements URLProvider { * Ensure that we have a connection. * @throws IOException if the connection cannot be established. */ - protected synchronized void connect() throws IOException { + protected void connect() throws IOException { + connect(Project.MSG_ERR); + } + + /** + * Ensure that we have a connection. + * @param logLevel severity to use when logging connection errors. + * Should be one of the MSG_ constants in {@link + * Project Project}. + * @throws IOException if the connection cannot be established. + * @since Ant 1.8.2 + */ + protected synchronized void connect(int logLevel) throws IOException { URL u = getURL(); if (u == null) { throw new BuildException("URL not set"); @@ -373,7 +385,7 @@ public class URLResource extends Resource implements URLProvider { conn = u.openConnection(); conn.connect(); } catch (IOException e) { - log(e.toString(), Project.MSG_ERR); + log(e.toString(), logLevel); conn = null; throw e; }