Browse Source

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
master
Stefan Bodewig 13 years ago
parent
commit
394f665213
2 changed files with 18 additions and 3 deletions
  1. +3
    -0
      WHATSNEW
  2. +15
    -3
      src/main/org/apache/tools/ant/types/resources/URLResource.java

+ 3
- 0
WHATSNEW View File

@@ -144,6 +144,9 @@ Other changes:
used for up-to-date-ness checks. used for up-to-date-ness checks.
Bugzilla Report 52096. Bugzilla Report 52096.


* URLResources#isExists has become less noisy.
Bugzilla Report 51802.

Changes from Ant 1.8.1 TO Ant 1.8.2 Changes from Ant 1.8.1 TO Ant 1.8.2
=================================== ===================================




+ 15
- 3
src/main/org/apache/tools/ant/types/resources/URLResource.java View File

@@ -226,7 +226,7 @@ public class URLResource extends Resource implements URLProvider {
return false; return false;
} }
try { try {
connect();
connect(Project.MSG_VERBOSE);
return true; return true;
} catch (IOException e) { } catch (IOException e) {
return false; return false;
@@ -363,7 +363,19 @@ public class URLResource extends Resource implements URLProvider {
* Ensure that we have a connection. * Ensure that we have a connection.
* @throws IOException if the connection cannot be established. * @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 <code>MSG_</code> 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(); URL u = getURL();
if (u == null) { if (u == null) {
throw new BuildException("URL not set"); throw new BuildException("URL not set");
@@ -373,7 +385,7 @@ public class URLResource extends Resource implements URLProvider {
conn = u.openConnection(); conn = u.openConnection();
conn.connect(); conn.connect();
} catch (IOException e) { } catch (IOException e) {
log(e.toString(), Project.MSG_ERR);
log(e.toString(), logLevel);
conn = null; conn = null;
throw e; throw e;
} }


Loading…
Cancel
Save