Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spotbugs and correct found problems #587

Merged
merged 4 commits into from
May 10, 2022

Commits on May 9, 2022

  1. Delete rcv.iml

    This file contains local configuration generated by Intellij; it is
    already included in .gitignore.
    tamird committed May 9, 2022
    Configuration menu
    Copy the full SHA
    4700826 View commit details
    Browse the repository at this point in the history
  2. Update dependencies

    Remove Xlint:unchecked and Xlint:deprecation; it is unclear why these
    were present.
    
    Remove always-clean configuration; relying on clean for build
    correctness is an anti-pattern.
    tamird committed May 9, 2022
    Configuration menu
    Copy the full SHA
    6fc4e5c View commit details
    Browse the repository at this point in the history
  3. Run check in CI rather than build

    This also checks style. Update to checkstyle 10.2 while I'm here and
    clean up all existing style violations (mainly missing docs comments on
    public classes).
    tamird committed May 9, 2022
    Configuration menu
    Copy the full SHA
    1ed2679 View commit details
    Browse the repository at this point in the history
  4. Add spotbugs and correct found problems

    > Task :spotbugsTest
    M D NP: Possible null pointer dereference in network.brightspots.rcv.TabulatorTests.runTabulationTest(String) due to return value of called method  Dereferenced at TabulatorTests.java:[line 152]
    M B OS: network.brightspots.rcv.TabulatorTests.fileCompare(String, String) may fail to close stream  At TabulatorTests.java:[line 58]
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.TabulatorTests.fileCompare(String, String): new java.io.FileReader(String)  At TabulatorTests.java:[line 57]
    
    > Task :spotbugsTest FAILED
    
    > Task :spotbugsMain
    M X OBL: network.brightspots.rcv.JsonParser.readFromFile(String, Class, boolean) may fail to clean up java.io.Reader  Obligation to clean up resource created at JsonParser.java:[line 42] is not discharged
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.JsonParser.readFromFile(String, Class, boolean): new java.io.FileReader(String)  At JsonParser.java:[line 42]
    M P WMI: network.brightspots.rcv.ResultsWriter.getCandidatesWithRanksList(Map) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 168]
    M P WMI: network.brightspots.rcv.ResultsWriter.setCandidatesToRoundEliminated(Map) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 245]
    M P WMI: network.brightspots.rcv.ResultsWriter.setWinnerToRound(Map) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 256]
    M P WMI: network.brightspots.rcv.ResultsWriter.generatePrecinctSummaryFiles(Map, Map, Map) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 289]
    M P WMI: network.brightspots.rcv.ResultsWriter.updateCandidateNamesInTally(Map) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 880]
    M P WMI: network.brightspots.rcv.ResultsWriter.addActionObjects(String, List, int, ArrayList, TallyTransfers) makes inefficient use of keySet iterator instead of entrySet iterator  At ResultsWriter.java:[line 921]
    M P WMI: network.brightspots.rcv.ClearBallotCvrReader.readCastVoteRecords(List, String) makes inefficient use of keySet iterator instead of entrySet iterator  At ClearBallotCvrReader.java:[line 109]
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.ClearBallotCvrReader.readCastVoteRecords(List, String): new java.io.FileReader(String)  At ClearBallotCvrReader.java:[line 51]
    M D REC: Exception is caught when Exception is not thrown in network.brightspots.rcv.HartCvrReader.readCastVoteRecord(List, Path)  At HartCvrReader.java:[line 128]
    M X OBL: network.brightspots.rcv.HartCvrReader.readCastVoteRecord(List, Path) may fail to clean up java.io.InputStream  Obligation to clean up resource created at HartCvrReader.java:[line 80] is not discharged
    M X OBL: network.brightspots.rcv.CommonDataFormatReader.parseXml(List) may fail to clean up java.io.InputStream  Obligation to clean up resource created at CommonDataFormatReader.java:[line 132] is not discharged
    M P WMI: network.brightspots.rcv.Tabulator.updatePastWinnerTallies() makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 319]
    M P WMI: network.brightspots.rcv.Tabulator.updatePastWinnerTallies() makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 273]
    M P WMI: network.brightspots.rcv.Tabulator.updatePastWinnerTallies() makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 297]
    M P WMI: network.brightspots.rcv.Tabulator.identifyWinners(Map, SortedMap) makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 481]
    M P WMI: network.brightspots.rcv.Tabulator.dropCandidatesBelowThreshold(SortedMap) makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 567]
    M P WMI: network.brightspots.rcv.Tabulator.runBatchElimination(SortedMap) makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 740]
    M P WMI: network.brightspots.rcv.Tabulator.computeTalliesForRound(int) makes inefficient use of keySet iterator instead of entrySet iterator  At Tabulator.java:[line 1006]
    M C RCN: Nullcheck of config at line 143 of value previously dereferenced in network.brightspots.rcv.TabulatorSession.tabulate()  At TabulatorSession.java:[line 143]
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.TabulatorSession.tabulate(): new java.io.FileReader(String)  At TabulatorSession.java:[line 152]
    M B OS: network.brightspots.rcv.GuiConfigController.loadTxtFileIntoString(String) may fail to close stream  At GuiConfigController.java:[line 272]
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.GuiConfigController.loadTxtFileIntoString(String): new java.io.InputStreamReader(InputStream)  At GuiConfigController.java:[line 275]
    H I Dm: Found reliance on default encoding in network.brightspots.rcv.Tiebreak.doInteractiveCli(List): new java.util.Scanner(InputStream)  At Tiebreak.java:[line 169]
    
    > Task :spotbugsMain FAILED
    tamird committed May 9, 2022
    Configuration menu
    Copy the full SHA
    7e33c79 View commit details
    Browse the repository at this point in the history