Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1573

Unsafe synchronization in NetworkServerControlImpl

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.2.1.6
    • 10.4.1.3
    • Network Server
    • None

    Description

      NetworkServerControlImpl has some constructs like this one:

      if (logWriter != null)
      {
      synchronized(logWriter)

      { logWriter.println(msg); }

      }

      Since logWriter might be set to null after the test for logWriter!=null and before synchronized(logWriter), one might get a NullPointerException. It would be safer to write this instead:

      PrintWriter lw = logWriter;
      if (lw != null) {
      synchronized (lw)

      { lw.println(msg); }

      }

      Attachments

        1. d1573.diff
          1 kB
          Thomas Nielsen
        2. d1573.stat
          0.1 kB
          Thomas Nielsen

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            thomanie Thomas Nielsen
            knutanders Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment