Fix another few things

This commit is contained in:
Clément Fournier
2017-11-21 17:33:29 +01:00
parent 632ed17464
commit 77048f16ea
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@ import net.sourceforge.pmd.properties.PropertyDescriptor;
* @author Clément Fournier
* @since 6.0.0
*/
class RuleBuilder {
/* default */ class RuleBuilder {
private List<PropertyDescriptor<?>> definedProperties = new ArrayList<>();
private String name;
@ -70,8 +70,9 @@ class RuleBuilder {
private void language(String languageName) {
if (StringUtils.isBlank(languageName)) {
// Some languages don't need the attribute because the rule's
// constructor calls setLanguage, see e.g. AbstractJavaRule
return;
// throw new IllegalArgumentException("Blank language attribute");
}
Language lang = LanguageRegistry.findLanguageByTerseName(languageName);

View File

@ -16,6 +16,7 @@ import java.util.Map.Entry;
import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@ -55,7 +56,7 @@ public class RuleFactory {
private static final String PROPERTY = "property";
private static final String CLASS = "class";
public static final List<String> REQUIRED_ATTRIBUTES = Collections.unmodifiableList(Arrays.asList(NAME, CLASS));
private static final List<String> REQUIRED_ATTRIBUTES = Collections.unmodifiableList(Arrays.asList(NAME, CLASS));
/**
@ -196,6 +197,7 @@ public class RuleFactory {
rule = builder.build();
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
LOG.severe(e.getMessage());
LOG.severe(ExceptionUtils.getStackTrace(e));
throw new RuntimeException(e);
}