diff --git a/src/main/java/edu/hm/hafner/analysis/parser/CargoClippyParser.java b/src/main/java/edu/hm/hafner/analysis/parser/CargoClippyParser.java index a585312e1..491eb1332 100644 --- a/src/main/java/edu/hm/hafner/analysis/parser/CargoClippyParser.java +++ b/src/main/java/edu/hm/hafner/analysis/parser/CargoClippyParser.java @@ -13,6 +13,7 @@ import edu.hm.hafner.analysis.util.IntegerParser; import edu.hm.hafner.util.LookaheadStream; import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import static j2html.TagCreator.*; @@ -156,6 +157,7 @@ private static final class FileInformation { * @param fileName * the filename of the recommendation. */ + @SuppressFBWarnings("NM") public void setFileName(final String fileName) { this.fileName = fileName; } diff --git a/src/test/java/edu/hm/hafner/analysis/ReportSerializationBenchmark.java b/src/test/java/edu/hm/hafner/analysis/ReportSerializationBenchmark.java index 62cd80d42..716fdcc77 100644 --- a/src/test/java/edu/hm/hafner/analysis/ReportSerializationBenchmark.java +++ b/src/test/java/edu/hm/hafner/analysis/ReportSerializationBenchmark.java @@ -67,16 +67,13 @@ private static Report createReportWith(final int number) { * @return bytes */ private static byte[] toByteArray(final Report report) { - var out = new ByteArrayOutputStream(); - - try (ObjectOutputStream stream = new ObjectOutputStream(out)) { + try (var out = new ByteArrayOutputStream(); ObjectOutputStream stream = new ObjectOutputStream(out)) { stream.writeObject(report); + return out.toByteArray(); } catch (IOException exception) { throw new IllegalStateException("Can't serialize report " + report, exception); } - - return out.toByteArray(); } /** @@ -88,10 +85,9 @@ private static byte[] toByteArray(final Report report) { * @return report */ @SuppressFBWarnings("OBJECT_DESERIALIZATION") + @SuppressWarnings("BanSerializableRead") private static Report toReport(final byte[] bytes) { - var in = new ByteArrayInputStream(bytes); - - try (ObjectInputStream stream = new ObjectInputStream(in)) { + try (var in = new ByteArrayInputStream(bytes); ObjectInputStream stream = new ObjectInputStream(in)) { return (Report) stream.readObject(); } catch (IOException | ClassNotFoundException exception) {