Skip to content

Commit

Permalink
Improved messaging for #240; suppressed exception logging in this case
Browse files Browse the repository at this point in the history
  • Loading branch information
jshiell committed Jun 29, 2016
1 parent d931dd5 commit 394cb06
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public List<Problem> inspectFile(@NotNull final PsiFile psiFile,
return NO_PROBLEMS_FOUND;

} catch (CheckStylePluginException e) {
LOG.error("CheckStyle threw an exception when scanning: " + psiFile.getName(), e);
if (e.getCause() != null && e.getCause() instanceof FileNotFoundException) {
disableActiveConfiguration(plugin, manager.getProject());
} else {
LOG.error("CheckStyle threw an exception when scanning: " + psiFile.getName(), e);
blacklist(configurationLocation);
}
return NO_PROBLEMS_FOUND;
Expand All @@ -118,7 +118,7 @@ public List<Problem> inspectFile(@NotNull final PsiFile psiFile,

private void disableActiveConfiguration(final CheckStylePlugin plugin, final Project project) {
plugin.getConfiguration().setActiveConfiguration(null);
showWarning(project, message("checkstyle.configuration-disabled.error"));
showWarning(project, message("checkstyle.configuration-disabled.file-not-found"));
}

private void blacklist(final ConfigurationLocation configurationLocation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public InputStream resolve() throws IOException {
}
}

for (final Iterator<String> i = properties.keySet().iterator(); i.hasNext(); ) {
for (final Iterator<String> i = properties.keySet().iterator(); i.hasNext();) {
if (!propertiesInFile.contains(i.next())) {
i.remove();
}
Expand Down Expand Up @@ -386,7 +386,7 @@ public long blacklistedForSeconds() {
return max((blacklistedUntil - currentTimeMillis()) / 1000, 0);
}

public void blacklist() {
public void blacklist() {
blacklistedUntil = currentTimeMillis() + BLACKLIST_TIME_MS;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<change-notes>
<![CDATA[
<ul>
<li>4.29.2: Fixed: Corrected cleanup thread pooling (#239). Thanks to Baron Roberts.</li>
<li>ffffdfsdffsd</li>
<li>4.29.2: Fixed: If the rules file for a configuration is deleted, we continue to show errors. It will now be deactivated (#240). Thanks to Victor Alenkov.</li>
<li>4.29.1: Fixed: Default property values should now be applied (#237).</li>
<li>4.29.0: New: Updated to CheckStyle 6.19.</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ checkstyle.not-found.RegexpHeader=<html>The Checkstyle regexp header file<br>was
checkstyle.not-found.ImportControl=<html>The Checkstyle import control file<br>was not found and will be ignored</html>
checkstyle.not-found.Header=<html>The Checkstyle header file<br>was not found and will be ignored</html>
checkstyle.file-not-found=<html>The Checkstyle rules file could not be read</html>
checkstyle.configuration-disabled.error=<html>The current Checkstyle configuration has been disabled due to an error.</html>
checkstyle.configuration-disabled.file-not-found=<html>The current Checkstyle configuration has been disabled as the rules file is missing.</html>
checkstyle.checker-failed=<html><b>The Checkstyle rules file could not be loaded.</b><br>{0}<br>The file has been blacklisted for 60s.</html>
checkstyle.could-not-read-properties=<html>Properties could not be read from the Checkstyle configuration file</html>
checkstyle.double-checked-locking=<html>The Checkstyle configuration file is not compatible with Checkstyle 5.6 or above.<br>Please remove the DoubleCheckingLocking check.</html>
Expand Down

0 comments on commit 394cb06

Please sign in to comment.