ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Pfeiffer (JIRA)" <>
Subject [jira] [Created] (IVY-1464) Inconsistency between local and remote <properties>
Date Thu, 20 Mar 2014 13:56:46 GMT
Carsten Pfeiffer created IVY-1464:

             Summary: Inconsistency between local and remote <properties>
                 Key: IVY-1464
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.3.0
            Reporter: Carsten Pfeiffer
            Priority: Minor

When using a {{<properties>}} element in an {{ivysettings.xml}} ivy behaves differently
when the referenced properties file does not exist.

In case the properties file is local, a {{FileNotFoundException}} is caught and only a warning
is logged (i.e. non-fatal).

In case the file is remote, only a generic {{IOException}} occurs, which fails the build.

Not sure how to best fix this. One fix would be like this:

try {
    URL fileUrl = urlFromFileAttribute(propFilePath);
    try {
        ivy.loadProperties(fileUrl, override);
    } catch (FileNotFoundException ex) {
        throw ex;
    } catch (IOException ex) {
        try {
            URLConnection connection = fileUrl.openConnection();
            if (connection instanceof HttpURLConnection) {
                int code = ((HttpURLConnection) connection).getResponseCode();
                if (code == 404) {
                    // file does not exist, just log a warning like in the local file
                    // case
                    Message.verbose("Unable to download property file (404 not found): "
                            + propFilePath);
        } catch (Exception e) {
            // ignore all follow up errors and throw the original exception instead
        throw ex;
} catch (FileNotFoundException e) {
    Message.verbose("Unable to find property file: " + propFilePath);

If you want to spare the second attempt to download the file when the exception occurs, you
would have to refactor {{IvySettings.loadProperties()}} a bit.

This message was sent by Atlassian JIRA

View raw message