Unsafe synchronization in NetworkServerControlImpl
--------------------------------------------------

                 Key: DERBY-1573
                 URL: http://issues.apache.org/jira/browse/DERBY-1573
             Project: Derby
          Issue Type: Bug
          Components: Network Server, Newcomer
    Affects Versions: 10.2.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


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);
        }
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to