diff --git a/.gitignore b/.gitignore index dcd0f43d..f8d1b96f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ CheckStyle-IDEA.zip .DS_Store /*.iws +*.ipr +*.iml +.idea/ /target/ /build/* /test-configs/ diff --git a/src/main/java/org/infernus/idea/checkstyle/CheckStyleInspection.java b/src/main/java/org/infernus/idea/checkstyle/CheckStyleInspection.java index 1a0a3e78..6c5afe1d 100644 --- a/src/main/java/org/infernus/idea/checkstyle/CheckStyleInspection.java +++ b/src/main/java/org/infernus/idea/checkstyle/CheckStyleInspection.java @@ -22,6 +22,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -98,6 +99,9 @@ public List inspectFile(@NotNull final PsiFile psiFile, } catch (CheckStylePluginException e) { blacklist(configurationLocation); LOG.error("CheckStyle threw an exception when scanning: " + psiFile.getName(), e); + if (e.getCause() instanceof FileNotFoundException){ + plugin.getConfiguration().setActiveConfiguration(null); + } return NO_PROBLEMS_FOUND; } catch (Throwable e) { diff --git a/src/main/java/org/infernus/idea/checkstyle/checker/CheckerFactory.java b/src/main/java/org/infernus/idea/checkstyle/checker/CheckerFactory.java index 1e196844..45952d88 100644 --- a/src/main/java/org/infernus/idea/checkstyle/checker/CheckerFactory.java +++ b/src/main/java/org/infernus/idea/checkstyle/checker/CheckerFactory.java @@ -50,7 +50,7 @@ public Optional checker(@Nullable final Module module, @Nullable private CheckStyleChecker checker(@Nullable final Module module, @Nullable final ConfigurationLocation location, - @Nullable final ClassLoader classLoader) { + @Nullable final ClassLoader classLoader) throws CheckStylePluginException { LOG.debug("Getting CheckStyle checker with location " + location); if (location == null) {