1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 12:25:35 +02:00

- avoid thrown exception by doing preventive check

This commit is contained in:
Alena Laskavaia 2009-01-30 15:43:51 +00:00
parent 16269eba9c
commit 0473138b52

View file

@ -103,13 +103,15 @@ public interface ICProjectDescriptionStorageType {
}
private static Version getVersion(IConfigurationElement element, String id, Version defaultValue) throws IllegalArgumentException{
if (defaultValue == null)
return new Version(element.getAttribute(id));
Version v = defaultValue;
String value = element.getAttribute(id);
if (value==null)
return defaultValue;
Version v;
try {
v = new Version(element.getAttribute(id));
v = new Version(value);
} catch (Exception e) {
// If an exception occurred return the default value
v = defaultValue;
}
return v;
}