Updated to make custom ruleset error messages clearer

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1393 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-02-03 16:34:33 +00:00
parent f809cec8f5
commit bb3122752e
2 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,9 @@ public class ExternalRuleID {
public ExternalRuleID(String id) {
int afterXML = id.indexOf(".xml") + 5;
if (afterXML >= id.length()) {
throw new RuntimeException("Unable to parse reference to external rule " + id +". These references need to be in the form <rulesetname>/<rulename>, i.e., <rule ref=\"rulesets/unusedcode.xml/UnusedPrivateField\"/>");
}
filename = id.substring(0, afterXML-1);
ruleName = id.substring(afterXML);
}

View File

@ -40,6 +40,10 @@ public class RuleSetFactory {
}
}
/**
* Creates a ruleset. If passed a comma-delimited string (rulesets/basic.xml,rulesets/unusedcode.xml)
* it will parse that string and create a new ruleset for each item in the list.
*/
public RuleSet createRuleSet(String name) throws RuleSetNotFoundException {
if (name.indexOf(',') == -1) {
return createRuleSet(tryToGetStreamTo(name));