Skip to content

Commit

Permalink
Issue #71: fix Violation at sonarqube.com
Browse files Browse the repository at this point in the history
This commit fixes #71 the violation at sonarqube.com. It removes a
redundant null check.
  • Loading branch information
marschall authored and romani committed Feb 12, 2017
1 parent 7e813f6 commit baad1ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ private void executeWithClassLoader(URLClassLoader projectClassloader) {

@VisibleForTesting
static void close(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
throw new IllegalStateException("failed to close object", e);
}
try {
closeable.close();
} catch (IOException e) {
throw new IllegalStateException("failed to close object", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ public void canGenerateXmlReportNull() throws CheckstyleException {
Assert.assertFalse(report.exists());
}

@Test
public void closeNull() {
CheckstyleExecutor.close(null);
}

@Test
public void closeNoException() throws IOException {
Closeable closeable = mock(Closeable.class);
Expand Down

0 comments on commit baad1ea

Please sign in to comment.