[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-classpath] [Bug classpath/23000] New: Confusing or incorrect logic
From: |
pinskia at gcc dot gnu dot org |
Subject: |
[bug-classpath] [Bug classpath/23000] New: Confusing or incorrect logic in java.util.logging.Logger |
Date: |
26 Jul 2005 16:08:37 -0000 |
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
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-26
16:08 -------
Fixed by:
2005-06-21 Lillian Angel <address@hidden>
* java/util/logging/Logger.java
(setParent): No lines after throwing an exception are executed
and there is no point to check if the parent is null, because a
NullPointerException would have been thrown earlier. Fixes Bug
#13460.
--
Summary: Confusing or incorrect logic in java.util.logging.Logger
Product: classpath
Version: unspecified
Status: RESOLVED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: from-classpath at savannah dot gnu dot org
CC: bug-classpath at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23000
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-classpath] [Bug classpath/23000] New: Confusing or incorrect logic in java.util.logging.Logger,
pinskia at gcc dot gnu dot org <=