diff --git a/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/writer/impl/RuleSetWriterImpl.java b/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/writer/impl/RuleSetWriterImpl.java index 49a59ec969..f892343751 100644 --- a/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/writer/impl/RuleSetWriterImpl.java +++ b/pmd-eclipse-runtime/src/net/sourceforge/pmd/runtime/writer/impl/RuleSetWriterImpl.java @@ -185,8 +185,10 @@ class RuleSetWriterImpl implements IRuleSetWriter { final Element descriptionElement = getDescriptionElement(doc, rule.getDescription()); ruleElement.appendChild(descriptionElement); - final Element exampleElement = getExampleElement(doc, rule.getExamples().get(0).toString()); - ruleElement.appendChild(exampleElement); + if (rule.getExamples().size() > 0) { + final Element exampleElement = getExampleElement(doc, rule.getExamples().get(0).toString()); + ruleElement.appendChild(exampleElement); + } final Element priorityElement = getPriorityElement(doc, rule.getPriority()); ruleElement.appendChild(priorityElement);