commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bug #13460] Confusing or incorrect logic in java.util.loggi


From: David Hovemeyer
Subject: [commit-cp] [bug #13460] Confusing or incorrect logic in java.util.logging.Logger
Date: Sat, 18 Jun 2005 21:40:16 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13460>

                 Summary: Confusing or incorrect logic in
java.util.logging.Logger
                 Project: classpath
            Submitted by: daveho
            Submitted on: Sat 06/18/2005 at 21:40
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

In classpath-0.15:

In the setParent(Logger) method of java.util.logging.Logger, 
there is the following code (starting at line 1143):

   /* Throw a new NullPointerException if parent is null. */
    parent.getClass();

    lm = LogManager.getLogManager();

    if (this == lm.rootLogger)
    {
      if (parent != null)
        throw new IllegalArgumentException(
          "only the root logger can have a null parent");
      this.parent = null;
      return;
    }

The check "if (parent != null)" is redundant because of
the earlier dereference, so the IllegalArgumentException
will always be thrown if the check is reached.
Probably, the exception message should say "the root logger
cannot have a parent", and the other lines (this.parent = null,
return) should be deleted.

Found by FindBugs, http://findbugs.sourceforge.net







    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13460>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]