Merge pull request #31 from hgschmie/npe-fix

Fix NPE with empty rulesets.
This commit is contained in:
Pelisse Romain 2013-11-26 16:50:11 -08:00
commit 80148e6b13
2 changed files with 8 additions and 6 deletions

View File

@ -251,6 +251,7 @@ public class RuleSetReferenceId {
*/
public static List<RuleSetReferenceId> parse(String referenceString) {
List<RuleSetReferenceId> references = new ArrayList<RuleSetReferenceId>();
if (referenceString != null && referenceString.trim().length() > 0) {
if (referenceString.indexOf(',') == -1) {
references.add(new RuleSetReferenceId(referenceString));
} else {
@ -258,6 +259,7 @@ public class RuleSetReferenceId {
references.add(new RuleSetReferenceId(name));
}
}
}
return references;
}

View File

@ -56,7 +56,7 @@ public abstract class AbstractPMDProcessor {
return factory.createRuleSets(configuration.getRuleSets());
} catch (RuleSetNotFoundException rsnfe) {
// should not happen: parent already created a ruleset
return null;
return new RuleSets();
}
}