Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-3708

Coding style: Always ensure Cache.initLogger() called to avoid Unexpected null pointer exceptions when using jalview.bin.Cache.log

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.11.1.1
    • Component/s: Dev and Dep
    • Labels:
      None

      Description

      More of an informational than anything else. Whilst testing JAL-3628 I noticed that many tests were being skipped due to a buried NullPointerException occuring in odd places:

      $ gradle clean test
      ...
      > Task :test

      jalview.ws.sifts.SiftsClientTest.setUpSiftsClient FAILED
          java.lang.NullPointerException at SiftsClientTest.java:201

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      jalview.analysis.FinderTest.tearDownAfterTest FAILED
          java.lang.NullPointerException at FinderTest.java:85

      1331 tests completed, 15 failed, 1316 skipped

      > Task :test FAILED

      All these NPEs are where jalview.bin.Cache.log is being used. In this case, I discovered the root cause was a patch introduced via JAL-3628, where a static method (jalview.io.BackupFiles.moveFileToFile(..)) was using jalview.bin.Cache.log without first calling Cache.initLogger().

      This didn't cause any problem until one of the '.sifts_downloads' files became too old, trigging a call to update the SIFTS file cache.. which due to another patch introduced in JAL-3628 called BackupFiles.moveFileToFile without initting the logs.


        Attachments

          Activity

            People

            Assignee:
            jprocter Jim Procter
            Reporter:
            jprocter Jim Procter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: