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:
parent
16269eba9c
commit
0473138b52
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue