fixed the rule parsing for the loading of libraries

master
Stefan Dollase 2015-12-23 23:47:18 +01:00
parent 5abcd10dba
commit 5e2aa636ff
1 changed files with 9 additions and 3 deletions

View File

@ -19,15 +19,21 @@ public class LibraryJson {
return name;
}
/**
* Note, that multiple rules might be applicable. We take the last
* applicable rule. However, this might be wrong so we need to take the most
* specific rule? For now this works fine.
*/
public boolean isActive(String os) {
if (rules.isEmpty()) {
return true;
}
boolean result = false;
for (LibraryRuleJson rule : rules) {
if (rule.isApplicable(os) && rule.isAllowed()) {
return true;
if (rule.isApplicable(os)) {
result = rule.isAllowed();
}
}
return false;
return result;
}
}