From 2b7f46f8294d55ff5a8a20c97301cf8f303f8a53 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 3 Nov 2011 20:43:55 +0100 Subject: [PATCH] more info in dom x:include failures --- .../xml/impl/PhysicalDomParentStrategy.java | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java index 8753c550d461..58e98bd01d63 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java @@ -15,7 +15,9 @@ */ package com.intellij.util.xml.impl; -import com.intellij.openapi.application.ex.ApplicationManagerEx; +import com.intellij.diagnostic.LogMessageEx; +import com.intellij.diagnostic.errordialog.Attachment; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.PsiElement; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlEntityRef; @@ -27,6 +29,7 @@ import org.jetbrains.annotations.Nullable; * @author peter */ public class PhysicalDomParentStrategy implements DomParentStrategy { + private static final Logger LOG = Logger.getInstance("#com.intellij.util.xml.impl.PhysicalDomParentStrategy"); private XmlElement myElement; private final DomManagerImpl myDomManager; @@ -89,29 +92,24 @@ public class PhysicalDomParentStrategy implements DomParentStrategy { final XmlElement thatElement = ((PhysicalDomParentStrategy)o).myElement; if (xmlElementsEqual(myElement, thatElement)) { if (myElement != thatElement) { - //todo remove this assertion before X release final PsiElement nav1 = myElement.getNavigationElement(); final PsiElement nav2 = thatElement.getNavigationElement(); if (nav1 != nav2) { - if (ApplicationManagerEx.getApplicationEx().isInternal()) { - PsiElement cur = findIncluder(myElement); - PsiElement nav = findIncluder(nav1); - final PsiElement _nav1 = myElement.getNavigationElement(); - final PsiElement _nav2 = thatElement.getNavigationElement(); - throw new AssertionError(myElement.getText() + "; including=" + (cur == null ? null : cur.getText()) + "; nav=" + (nav == null ? null : nav.getText())); - } - - throw new AssertionError(nav1.getContainingFile() + - ":" + - nav1.getTextRange().getStartOffset() + - "!=" + - nav2.getContainingFile() + - ":" + - nav2.getTextRange().getStartOffset() + - "; " + - (nav1 == myElement) + - ";" + - (nav2 == thatElement)); + PsiElement curContext = findIncluder(myElement); + PsiElement navContext = findIncluder(nav1); + LOG.error(LogMessageEx.createEvent( + "x:include processing error", + "nav1,nav2=" + nav1 + ", " + nav2 + ";\n" + + nav1.getContainingFile() + ":" + nav1.getTextRange().getStartOffset() + "!=" + nav2.getContainingFile() + ":" + nav2.getTextRange().getStartOffset() + ";\n" + + (nav1 == myElement) + ";" + (nav2 == thatElement) + ";\n" + + "contexts equal: " + (curContext == navContext) + ";\n" + + "curContext?.physical=" + (curContext != null && curContext.isPhysical()) + ";\n" + + "navContext?.physical=" + (navContext != null && navContext.isPhysical()) + ";\n" + + "myElement.physical=" + myElement.isPhysical() + ";\n" + + "thatElement.physical=" + thatElement.isPhysical(), + new Attachment("Including tag text 1", curContext == null ? "null" : curContext.getText()), + new Attachment("Including tag text 2", navContext == null ? "null" : navContext.getText()) + )); } } return true;