throw e;
}
}
private Ivy doGetIvy() throws IvyDEException {
ResolvedPath settingsPath = getIvySettingsPath();
if (settingsPath.getError() != null) {
throw new IvyDEException("Incorrect path of the Ivy settings",
"The Ivy settings path '" + settingsPath.getInputPath() + "' is incorrect: "
+ settingsPath.getError().getMessage(), settingsPath.getError());
}
if (!settingsPath.isSet()) {
IvyDEMessage.debug("No settings specified, so take the default one");
if (ivy == null) {
IvySettings ivySettings = createIvySettings();
ivy = Ivy.newInstance(ivySettings);
try {
ivy.configureDefault();
} catch (ParseException e) {
ivy = null;
IvyDEException ex = new IvyDEException(
"Parsing error of the default Ivy settings",
"The default Ivy settings file could not be parsed: " + e.getMessage(),
e);
throw ex;
} catch (IOException e) {
ivy = null;
throw new IvyDEException("Read error of the default Ivy settings",
"The default Ivy settings file could not be read: " + e.getMessage(), e);
}
}
return ivy;
}
// before returning the found ivy, try to refresh it if the settings changed
if (settingsPath.getFile() != null) {
return getIvyFromFile(settingsPath);
} else {
// an URL but not a file
if (ivy == null || ivySettingsLastModified == -1) {
IvySettings ivySettings = createIvySettings();
ivy = Ivy.newInstance(ivySettings);
try {
ivy.configure(settingsPath.getUrl());
ivySettingsLastModified = 0;
} catch (ParseException e) {
ivy = null;
throw new IvyDEException("Parsing error of the Ivy settings",
"The ivy settings file '" + settingsPath.getResolvedPath()
+ "' could not be parsed: " + e.getMessage(), e);
} catch (IOException e) {
ivy = null;
throw new IvyDEException("Read error of the Ivy settings",
"The ivy settings file '" + settingsPath.getResolvedPath()
+ "' could not be read: " + e.getMessage(), e);
}
}
}
return ivy;