minor: Fixed potential NPE due to non synchronization access to m_writer.

This commit is contained in:
Heng Sin Low 2013-03-21 13:33:31 +08:00
parent e3cf6df872
commit b2063cc784
1 changed files with 2 additions and 2 deletions

View File

@ -264,7 +264,7 @@ public class CLogFile extends Handler
* @see java.util.logging.Handler#publish(java.util.logging.LogRecord) * @see java.util.logging.Handler#publish(java.util.logging.LogRecord)
* @param record log record * @param record log record
*/ */
public void publish (LogRecord record) public synchronized void publish (LogRecord record)
{ {
if (!isLoggable (record) || m_writer == null) if (!isLoggable (record) || m_writer == null)
return; return;
@ -328,7 +328,7 @@ public class CLogFile extends Handler
* @see java.util.logging.Handler#close() * @see java.util.logging.Handler#close()
* @throws java.lang.SecurityException * @throws java.lang.SecurityException
*/ */
public void close () throws SecurityException public synchronized void close () throws SecurityException
{ {
if (m_writer == null) if (m_writer == null)
return; return;