You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2007/06/21 09:16:26 UTC

[jira] Closed: (DERBY-1573) Unsafe synchronization in NetworkServerControlImpl

     [ https://issues.apache.org/jira/browse/DERBY-1573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-1573.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0
       Derby Info:   (was: [Patch Available])

Fixed the indentation and committed revision 549412.

> Unsafe synchronization in NetworkServerControlImpl
> --------------------------------------------------
>
>                 Key: DERBY-1573
>                 URL: https://issues.apache.org/jira/browse/DERBY-1573
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server, Newcomer
>    Affects Versions: 10.2.1.6
>            Reporter: Knut Anders Hatlen
>            Assignee: Thomas Nielsen
>            Priority: Minor
>             Fix For: 10.4.0.0
>
>         Attachments: d1573.diff, d1573.stat
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.