From df287f9dd56b09508fb1b4c22c08ffc968ac583e Mon Sep 17 00:00:00 2001 From: Xavier Le Vourch Date: Tue, 30 Oct 2007 04:02:49 +0000 Subject: [PATCH] Bug fix [ 1811828 ] RuntimeException in RuleSetFactory At least the second part from the comments about the ArrayIndexOutOfBoundsException is fixed by this change git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5604 51baf565-9d33-0410-a72c-fc3788e3496d --- .../pmd/runtime/writer/impl/RuleSetWriterImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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);