Merge pull request #31 from hgschmie/npe-fix
Fix NPE with empty rulesets.
This commit is contained in:
commit
80148e6b13
@ -251,11 +251,13 @@ public class RuleSetReferenceId {
|
|||||||
*/
|
*/
|
||||||
public static List<RuleSetReferenceId> parse(String referenceString) {
|
public static List<RuleSetReferenceId> parse(String referenceString) {
|
||||||
List<RuleSetReferenceId> references = new ArrayList<RuleSetReferenceId>();
|
List<RuleSetReferenceId> references = new ArrayList<RuleSetReferenceId>();
|
||||||
if (referenceString.indexOf(',') == -1) {
|
if (referenceString != null && referenceString.trim().length() > 0) {
|
||||||
references.add(new RuleSetReferenceId(referenceString));
|
if (referenceString.indexOf(',') == -1) {
|
||||||
} else {
|
references.add(new RuleSetReferenceId(referenceString));
|
||||||
for (String name : referenceString.split(",")) {
|
} else {
|
||||||
references.add(new RuleSetReferenceId(name));
|
for (String name : referenceString.split(",")) {
|
||||||
|
references.add(new RuleSetReferenceId(name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return references;
|
return references;
|
||||||
|
@ -56,7 +56,7 @@ public abstract class AbstractPMDProcessor {
|
|||||||
return factory.createRuleSets(configuration.getRuleSets());
|
return factory.createRuleSets(configuration.getRuleSets());
|
||||||
} catch (RuleSetNotFoundException rsnfe) {
|
} catch (RuleSetNotFoundException rsnfe) {
|
||||||
// should not happen: parent already created a ruleset
|
// should not happen: parent already created a ruleset
|
||||||
return null;
|
return new RuleSets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user