-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_xp
Name: jk109818 Date: 02/05/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Win XP
A DESCRIPTION OF THE PROBLEM :
UIDefaults Map interface is broken.
UIManager.getDefaults().size() should return the number of
entries in the map. It probably does. But,
UIManager.getDefaults().entrySet().size() returns 0. My
understanding is that both numbers should be the same.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided program. Which calls size() and
entrySet().size() on an instance of UIDefaults obtained from
UIManager.getDefaults()
Because an empty entry set and/or key set is returned it is
impossible to iterate through the properties. Perhaps I am
misunderstanding the implementation?
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
566
something is in there
566
566
Actual:
566
something is in there
0
0
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class test {
public static void main(String[] args) {
UIDefaults uid = UIManager.getDefaults();
System.out.println( uid.size() );
System.out.println( uid.isEmpty() ? "empty" :"something is in there" );
System.out.println( uid.entrySet().size() );
System.out.println( uid.keySet().size() );
}
}
---------- END SOURCE ----------
(Review ID: 178748)
======================================================================
- duplicates
-
JDK-8146330 [macosx] UIDefaults.keys() different size than UIDefaults.keySet()
-
- Resolved
-