Skip to content

Commit 9b3c039

Browse files
author
Gary Gregory
committed
PMD: ignore empty catch block
1 parent 35ee18c commit 9b3c039

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ static String decodeUrl(final String url) {
11571157
i += 3;
11581158
} while (i < n && url.charAt(i) == '%');
11591159
continue;
1160-
} catch (final RuntimeException e) {
1160+
} catch (final RuntimeException ignored) {
11611161
// malformed percent-encoded octet, fall through and
11621162
// append characters literally
11631163
} finally {

src/main/java/org/apache/commons/io/file/DeletingPathVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public FileVisitResult visitFile(final Path file, final BasicFileAttributes attr
163163
try {
164164
// deleteIfExists does not work for this case
165165
Files.delete(file);
166-
} catch (final NoSuchFileException e) {
166+
} catch (final NoSuchFileException ignored) {
167167
// ignore
168168
}
169169
}

src/main/java/org/apache/commons/io/file/PathUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public static PathCounters deleteFile(final Path file, final LinkOption[] linkOp
537537
pathCounts.getByteCounter().add(size);
538538
return pathCounts;
539539
}
540-
} catch (final AccessDeniedException e) {
540+
} catch (final AccessDeniedException ignored) {
541541
// Ignore and try again below.
542542
}
543543
final Path parent = getParent(file);
@@ -1436,7 +1436,7 @@ public static Path setReadOnly(final Path path, final boolean readOnly, final Li
14361436
if (setDosReadOnly(path, readOnly, linkOptions)) {
14371437
return path;
14381438
}
1439-
} catch (final IOException e) {
1439+
} catch (final IOException ignored) {
14401440
// Retry with POSIX below.
14411441
}
14421442
final Path parent = getParent(path);

src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public boolean accept(final File file) {
264264
return Arrays.equals(this.magicNumbers, fileBytes);
265265
}
266266
}
267-
catch (final IOException ioe) {
267+
catch (final IOException ignored) {
268268
// Do nothing, fall through and do not accept file
269269
}
270270
}
@@ -301,7 +301,7 @@ public FileVisitResult accept(final Path file, final BasicFileAttributes attribu
301301
return toFileVisitResult(Arrays.equals(this.magicNumbers, byteBuffer.array()));
302302
}
303303
}
304-
catch (final IOException ioe) {
304+
catch (final IOException ignored) {
305305
// Do nothing, fall through and do not accept file
306306
}
307307
}

src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ private void closeUnderlyingInputStreamIfNecessary() {
227227
if (needToCloseUnderlyingInputStream) {
228228
try {
229229
underlyingInputStream.close();
230-
} catch (final IOException e) {
231-
// TODO ?
230+
} catch (final IOException ignored) {
231+
// TODO Rethrow as UncheckedIOException?
232232
}
233233
}
234234
}

0 commit comments

Comments
 (0)