https://issues.apache.org/bugzilla/show_bug.cgi?id=52095

             Bug #: 52095
           Summary: Inconsistent Javadoc comment in addAppender(Appender)
                    in org.apache.log4j.AsyncAppender
           Product: Log4j
           Version: 1.2
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: st...@illinois.edu
    Classification: Unclassified


The Javadoc comment below states that the parameter appender "may not be null":
  /**
   * Add appender.
   *
   * @param newAppender appender to add, may not be null.
   */
  public void addAppender(final Appender newAppender) {
    synchronized (appenders) {
      appenders.addAppender(newAppender);
    }
  }

However, the called method
"org.apache.log4j.helpers.AppenderAttachableImpl#addAppender(Appender)" has an
explicit check for "null" and will ignore it, returning normally without any
exception being thrown.  Also, the Javadoc for the called method does not
mention "null".

Suggested Fixes:
1. Make the Javadoc in "org.apache.log4j.AsyncAppender#addAppender(Appender)"
consistent with the Javadoc in
"org.apache.log4j.helpers.AppenderAttachableImpl#addAppender(Appender)" (note
that the second "in" should be "it" in both):
  /**
   * Attach an appender. If the appender is already in the list in [sic] won't
be added.
   *
   * @param newAppender appender to add
   */
  public void addAppender(final Appender newAppender) {
or
2. Simply remove ", may not be null" from the Javadoc in
"org.apache.log4j.AsyncAppender#addAppender(Appender)".
or
3. Change ", may not be null" to ", null will be ignored".

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to