Skip to content

Commit

Permalink
Issue checkstyle#3323: fixed redundant modifiers on try-with-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach committed Jul 19, 2016
1 parent adb10a8 commit f9097bd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected void verify(Checker checker,
// process each of the lines
final ByteArrayInputStream inputStream =
new ByteArrayInputStream(stream.toByteArray());
try (final LineNumberReader lnr = new LineNumberReader(
try (LineNumberReader lnr = new LineNumberReader(
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {

int previousLineNumber = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected void verify(Checker checker,
// process each of the lines
final ByteArrayInputStream inputStream =
new ByteArrayInputStream(stream.toByteArray());
try (final LineNumberReader lnr = new LineNumberReader(
try (LineNumberReader lnr = new LineNumberReader(
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {

for (int i = 0; i < expected.length; i++) {
Expand Down Expand Up @@ -227,7 +227,7 @@ private Map<String, List<String>> getActualViolations(int errorCount) throws IOE
final ByteArrayInputStream inputStream =
new ByteArrayInputStream(stream.toByteArray());

try (final LineNumberReader lnr = new LineNumberReader(
try (LineNumberReader lnr = new LineNumberReader(
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {

final Map<String, List<String>> actualViolations = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testProperFileExtension() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ConstantNameCheck.class);
final File file = temporaryFolder.newFile("file.java");
try (final Writer writer = new BufferedWriter(
try (Writer writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
final String content = "public class Main { public static final int k = 5 + 4; }";
writer.write(content);
Expand All @@ -70,7 +70,7 @@ public void testImproperFileExtension() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ConstantNameCheck.class);
final File file = temporaryFolder.newFile("file.pdf");
try (final BufferedWriter writer = new BufferedWriter(
try (BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
final String content = "public class Main { public static final int k = 5 + 4; }";
writer.write(content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private String[] getOutStreamLines()
final ByteArrayInputStream inStream =
new ByteArrayInputStream(bytes);
final List<String> lineList = Lists.newArrayList();
try (final BufferedReader reader = new BufferedReader(
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(inStream, StandardCharsets.UTF_8))) {
while (true) {
final String line = reader.readLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected void verify(Checker checker,
// process each of the lines
final ByteArrayInputStream localStream =
new ByteArrayInputStream(stream.toByteArray());
try (final LineNumberReader lnr = new LineNumberReader(
try (LineNumberReader lnr = new LineNumberReader(
new InputStreamReader(localStream, StandardCharsets.UTF_8))) {

for (int i = 0; i < expected.length; i++) {
Expand Down

0 comments on commit f9097bd

Please sign in to comment.