Index: /trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfJavaValidator.java
===================================================================
--- /trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfJavaValidator.java	(revision 18)
+++ /trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfJavaValidator.java	(revision 19)
@@ -20,4 +20,5 @@
 
 import de.ugoe.cs.swe.bnftools.analysis.EbnfAnalysisUtils;
+import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry;
 import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList;
 import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf;
@@ -300,44 +301,34 @@
 			return;
 
-		CompositeNode node = NodeUtil.getNodeAdapter(rule).getParserNode();
-		CompositeNode root = node.getParent();
-		
-		AbstractNode last = node.getChildren().get(
-				node.getChildren().size() - 1);
-
-		if (!(last instanceof CompositeNode))
-			return;
-
-		CompositeNode rightHandSideNode = (CompositeNode) last;
-		String rightHandSideText = rightHandSideNode.serialize().trim()
+		EtsiBnf etsiBnfNode = (EtsiBnf) rule.eContainer().eContainer();
+		
+		CompositeNode definitionList = NodeUtil.getNodeAdapter(rule.getDefinitionList()).getParserNode();
+		
+		String rightHandSideText = definitionList.serialize().trim()
 				.replaceAll("[ \t\n\r]", "");
 
-		for (int i = 0; i < root.getChildren().size(); i++) {
-			if (root.getChildren().get(i) == node)
+		for (int i = 0; i < etsiBnfNode.getBnfEntry().size(); i++) {
+			BnfEntry currentNode = etsiBnfNode.getBnfEntry().get(i);
+			if (currentNode == null)
 				continue;
-			if (root.getChildren().get(i) == null)
+			if (currentNode.getRule() == null)
 				continue;
-			if (!(root.getChildren().get(i) instanceof CompositeNode))
+			if (currentNode.getRule() == rule)
 				continue;
-			
-			CompositeNode child = (CompositeNode) root.getChildren().get(i);
-			
-			AbstractNode childLastChild = child.getChildren().get(
-					child.getChildren().size() - 1);
-			if (childLastChild instanceof CompositeNode) {
-				CompositeNode childLastChildCompositeNode = (CompositeNode) childLastChild;
-				String text = childLastChildCompositeNode.serialize().trim()
-						.replaceAll("[ \t\n\r]", "");
-				if (text.equals(rightHandSideText)) {
-					Rule matchingRule = (Rule) child.getElement();
+
+			Rule currentRule = currentNode.getRule(); 
+			CompositeNode currentRuleDefinitionList = NodeUtil.getNodeAdapter(currentRule.getDefinitionList()).getParserNode();
+			String currentRuleRightHandSideText = currentRuleDefinitionList.serialize().trim()
+			.replaceAll("[ \t\n\r]", "");
+
+			if (currentRuleRightHandSideText.equals(rightHandSideText)) {
 					String description = EbnfJavaValidator.duplicateRulesDescription
-							+ " with rule "
-							+ matchingRule.getRulenumber()
-							+ " (Line "
-							+ child.getLine() + ")";
+							+ " with rule \""
+							+ currentRule.getName()
+							+ "\" (Line "
+							+ NodeUtil.getNodeAdapter(currentRule).getParserNode().getLine() + ")";
 					warning(description, 1, description);
 				}
 			}
-		}
 	}
 	
