diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java index ed2db874ef46..a84b0703eef8 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java @@ -313,7 +313,7 @@ public class InspectionProfileTest extends LightIdeaTestCase { assertEquals(0, countInitializedTools(profile)); profile.writeExternal(new Element("profile")); List initializedTools = getInitializedTools(profile); - if (initializedTools.size() != 1) { + if (initializedTools.size() > 0) { for (InspectionToolWrapper initializedTool : initializedTools) { System.out.println(initializedTool.getShortName()); } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java index a017575a3f27..f8d215ceee24 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java @@ -145,7 +145,9 @@ public class ToolsImpl implements Tools { scopeElement.setAttribute(LEVEL_ATTRIBUTE, state.getLevel().toString()); scopeElement.setAttribute(ENABLED_ATTRIBUTE, Boolean.toString(state.isEnabled())); InspectionToolWrapper toolWrapper = state.getTool(); - toolWrapper.getTool().writeSettings(scopeElement); + if (toolWrapper.isInitialized()) { + toolWrapper.getTool().writeSettings(scopeElement); + } inspectionElement.addContent(scopeElement); } } @@ -153,7 +155,9 @@ public class ToolsImpl implements Tools { inspectionElement.setAttribute(LEVEL_ATTRIBUTE, getLevel().toString()); inspectionElement.setAttribute(ENABLED_BY_DEFAULT_ATTRIBUTE, Boolean.toString(myDefaultState.isEnabled())); InspectionToolWrapper toolWrapper = myDefaultState.getTool(); - toolWrapper.getTool().writeSettings(inspectionElement); + if (toolWrapper.isInitialized()) { + toolWrapper.getTool().writeSettings(inspectionElement); + } } void readExternal(@NotNull Element toolElement, @NotNull InspectionProfile profile) throws InvalidDataException {