style(api): replace ignored exceptions with Java's unnamed pattern (_) (#976)
This commit is contained in:
@@ -412,7 +412,7 @@ class BookCoverServiceTest {
|
||||
try {
|
||||
when(file.getInputStream()).thenReturn(new ByteArrayInputStream(new byte[]{(byte) 0xFF, (byte) 0xD8, (byte) 0xFF, (byte) 0xE0})); // JPEG
|
||||
when(file.getBytes()).thenReturn(new byte[]{1, 2, 3});
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception _) {}
|
||||
|
||||
service.updateCoverFromFileForBooks(Set.of(1L, 2L), file);
|
||||
|
||||
@@ -473,7 +473,7 @@ class BookCoverServiceTest {
|
||||
try {
|
||||
when(file.getInputStream()).thenReturn(new java.io.ByteArrayInputStream(new byte[]{(byte) 0xFF, (byte) 0xD8, (byte) 0xFF, (byte) 0xE0}));
|
||||
when(file.getBytes()).thenReturn(new byte[]{1, 2, 3});
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception _) {}
|
||||
|
||||
when(bookQueryService.findAllWithMetadataByIds(any())).thenReturn(List.of());
|
||||
|
||||
@@ -491,7 +491,7 @@ class BookCoverServiceTest {
|
||||
try {
|
||||
when(file.getInputStream()).thenReturn(new java.io.ByteArrayInputStream(new byte[]{(byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}));
|
||||
when(file.getBytes()).thenReturn(new byte[]{1, 2, 3});
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception _) {}
|
||||
|
||||
when(bookQueryService.findAllWithMetadataByIds(any())).thenReturn(List.of());
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class PdfMetadataExtractorTest {
|
||||
|
||||
@Test
|
||||
void extractMetadata_minimalPdf_usesFilenameAsTitle() throws Exception {
|
||||
File pdf = createPdf(ignored -> {});
|
||||
File pdf = createPdf(_ -> {});
|
||||
BookMetadata meta = extractor.extractMetadata(pdf);
|
||||
assertThat(meta.getTitle()).isEqualTo("test");
|
||||
assertThat(meta.getPageCount()).isEqualTo(1);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class CbxComicInfoComplianceTest {
|
||||
.forEach(p -> {
|
||||
try {
|
||||
Files.deleteIfExists(p);
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception _) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class CbxMetadataWriterTest {
|
||||
.forEach(p -> {
|
||||
try {
|
||||
Files.deleteIfExists(p);
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception _) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class PdfMetadataWriterTest {
|
||||
.forEach(p -> {
|
||||
try {
|
||||
Files.deleteIfExists(p);
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception _) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class LibraryWatchServiceTest {
|
||||
void teardown() {
|
||||
try {
|
||||
service.stop();
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception _) {}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -281,7 +281,7 @@ class TaskHistoryServiceTest {
|
||||
java.lang.reflect.Field field = TaskType.class.getDeclaredField("hiddenFromUI");
|
||||
field.setAccessible(true);
|
||||
field.set(type, true);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception _) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -250,7 +250,7 @@ class LibraryFileEventProcessorTest {
|
||||
} finally {
|
||||
try (var stream = Files.walk(outsideFolder)) {
|
||||
stream.sorted(java.util.Comparator.reverseOrder()).forEach(p -> {
|
||||
try { Files.deleteIfExists(p); } catch (IOException ignored) {}
|
||||
try { Files.deleteIfExists(p); } catch (IOException _) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user