diff --git a/plugins/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java b/plugins/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java index ee5354b8515f..6252728de819 100644 --- a/plugins/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java +++ b/plugins/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java @@ -22,6 +22,7 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsight.daemon.impl.analysis.CreateNSDeclarationIntentionFix; import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; import com.intellij.lang.xml.XMLLanguage; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; @@ -44,6 +45,8 @@ import org.jetbrains.annotations.Nullable; * Date: 24.07.2007 */ public class PrefixReferenceProvider extends PsiReferenceProviderBase { + private static final Logger LOG = Logger.getInstance("#org.intellij.plugins.relaxNG.references.PrefixReferenceProvider"); + @NotNull public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { final XmlAttributeValue value = (XmlAttributeValue)element; @@ -102,7 +105,7 @@ public class PrefixReferenceProvider extends PsiReferenceProviderBase { QuickFixAction.registerQuickFixAction(info, new CreateNSDeclarationIntentionFix(tag, reference.getCanonicalText())); } catch (Throwable e) { - e.printStackTrace(); + LOG.error(e); } } diff --git a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java index a0af4a70dd45..a2baae294ffc 100644 --- a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java +++ b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java @@ -17,7 +17,9 @@ package org.intellij.plugins.relaxNG.validation; import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Key; @@ -33,7 +35,6 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; -import javax.swing.*; import java.net.MalformedURLException; import java.net.URL; import java.util.Set; @@ -44,6 +45,8 @@ import java.util.Set; * Date: 19.11.2007 */ public class MessageViewHelper { + private static final Logger LOG = Logger.getInstance("#org.intellij.plugins.relaxNG.validation.MessageViewHelper"); + private final Project myProject; private final Set myErrors = new THashSet(); @@ -91,23 +94,23 @@ public class MessageViewHelper { try { file = VfsUtil.findFileByURL(new URL(systemId)); } catch (MalformedURLException e) { - System.err.println("systemId = " + systemId); - e.printStackTrace(); + LOG.warn("systemId = " + systemId); + LOG.error(e); } } final VirtualFile file1 = file; - SwingUtilities.invokeLater( - new Runnable() { - public void run() { - myErrorsView.addMessage( - warning ? MessageCategory.WARNING : MessageCategory.ERROR, - new String[]{ ex.getLocalizedMessage() }, - file1, - ex.getLineNumber() - 1, - ex.getColumnNumber() - 1, null); - } - } + ApplicationManager.getApplication().invokeLater( + new Runnable() { + public void run() { + myErrorsView.addMessage( + warning ? MessageCategory.WARNING : MessageCategory.ERROR, + new String[]{ex.getLocalizedMessage()}, + file1, + ex.getLineNumber() - 1, + ex.getColumnNumber() - 1, null); + } + } ); } diff --git a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java index 2e41399879ca..232938704cd1 100644 --- a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java +++ b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java @@ -16,6 +16,7 @@ package org.intellij.plugins.relaxNG.validation; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.SystemInfo; @@ -62,12 +63,15 @@ import java.io.StringReader; * Date: 19.07.2007 */ public class RngParser { + private static final Logger LOG = Logger.getInstance("#org.intellij.plugins.relaxNG.validation.RngParser"); + static final Key> SCHEMA_KEY = Key.create("SCHEMA"); static final Key> PATTERN_KEY = Key.create("PATTERN"); public static final DefaultHandler DEFAULT_HANDLER = new DefaultHandler() { public void error(SAXParseException e) throws SAXException { - System.out.println("e.getMessage() = " + e.getMessage() + " [" + e.getSystemId() + "]"); + LOG.info("e.getMessage() = " + e.getMessage() + " [" + e.getSystemId() + "]"); + LOG.info(e); } }; @@ -90,9 +94,9 @@ public class RngParser { return (DPattern)p.parse(checking ? new CheckingSchemaBuilder(sb, eh) : sb); } catch (BuildException e) { - e.printStackTrace(); + LOG.info(e); } catch (IllegalSchemaException e) { - System.out.println("invalid schema: " + file.getVirtualFile().getPresentableUrl()); + LOG.info("invalid schema: " + file.getVirtualFile().getPresentableUrl()); } return null; } @@ -166,7 +170,7 @@ public class RngParser { return Result.createSingleDependency(schema, descriptorFile); } } catch (Exception e) { - e.printStackTrace(); + LOG.info(e); return Result.createSingleDependency(null, descriptorFile); } } diff --git a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/XmlInstanceValidator.java b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/XmlInstanceValidator.java index 2956996170f3..02a835452697 100644 --- a/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/XmlInstanceValidator.java +++ b/plugins/relaxng/src/org/intellij/plugins/relaxNG/validation/XmlInstanceValidator.java @@ -17,6 +17,7 @@ package org.intellij.plugins.relaxNG.validation; import com.intellij.codeInsight.daemon.Validator; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.psi.PsiDocumentManager; @@ -40,6 +41,7 @@ import org.xml.sax.SAXParseException; * Date: 30.07.2007 */ public class XmlInstanceValidator { + private static final Logger LOG = Logger.getInstance("#org.intellij.plugins.relaxNG.validation.MessageViewHelper"); public static void doValidation(@NotNull final XmlDocument doc, final Validator.ValidationHost host, final XmlFile descriptorFile) { try { @@ -61,9 +63,11 @@ public class XmlInstanceValidator { doc.accept(new Psi2SaxAdapter(handler)); } catch (ProcessCanceledException e) { - throw e; + LOG.error(e); + } catch (RuntimeException e) { + LOG.error(e); } catch (Exception e) { - e.printStackTrace(); + LOG.info(e); } } diff --git a/plugins/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/plugins/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java index a25cff996b95..08dc74d42a96 100644 --- a/plugins/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java +++ b/plugins/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java @@ -85,7 +85,7 @@ public abstract class HighlightingTestBase extends TestCase implements IdeaCodeI } }); } catch (IOException e) { - e.printStackTrace(); + throw new RuntimeException(e); } }