db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-1573) Unsafe synchronization in NetworkServerControlImpl
Date Mon, 18 Jun 2007 14:16:26 GMT

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

Knut Anders Hatlen commented on DERBY-1573:
-------------------------------------------

Thanks Thomas. The patch looks correct to me. One small comment: You probably need to adjust
your editor settings. In the Derby code, tabs are normally four characters wide, not eight.
The patch inserted some space-indented lines between tab-indented lines, and the space-indented
lines ended up with too much indentation.

> 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
>         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.


Mime
View raw message