db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <derby-...@db.apache.org>
Subject [jira] Created: (DERBY-1573) Unsafe synchronization in NetworkServerControlImpl
Date Sat, 22 Jul 2006 20:52:13 GMT
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

        

Mime
View raw message