Name: nt126004 Date: 10/07/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0
EXTRA RELEVANT SYSTEM CONFIGURATION :
SP5, german locale
A DESCRIPTION OF THE PROBLEM :
if a java.util.prefs.Preferences key contains "special"
characters like the euro-sign ? or a german umlaut (?,?,?)
the resulting registry entry on Windows will produce an
unreadable key.
If one stores the same characters as part of values (as
opposed to keys) Unicode notation is used (as expected).
As a side note: I wonder why each uppercase letter has a
leading slash with it, so that e.g. the
string "CapitalLetters" results in "/Capital/Letters". No
big deal, but odd.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the provides snippet under Windows (NT)
2. Use regex to check the results
EXPECTED VERSUS ACTUAL BEHAVIOR :
Unicode notation should be used, instead there's a
completely unreadable string like "/!!(`!b@"s!'%!d@"0!$o!)!
$k"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class PreferenceTest {
public static void main(String[] args) {
java.util.prefs.Preferences prefs =
java.util.prefs.Preferences.userNodeForPackage(PreferenceTest.class);
//as keys
prefs.putInt("a: a", 1);
prefs.putInt("at: @", 2);
prefs.putInt("euro: ?", 3); //=> unreadable key
prefs.putInt("umlaut: ?", 4); //=> unreadable key
prefs.putInt("underscore: a_a", 5);
prefs.putInt("CapitalLetters: The Quick Brown Fox", 6);
//as values
prefs.put("1", "a: a");
prefs.put("2", "at: @");
prefs.put("3", "euro: ?"); //=> readable value (Unicode notation)
prefs.put("4", "umlaut: ?"); //=> readable value (Unicode notation)
prefs.put("5", "underscore: a_a");
prefs.put("6", "CapitalLetters: The Quick Brown Fox");
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
don't use "special characters" for Preference-keys.
(Review ID: 165105)
======================================================================
- duplicates
-
JDK-4770128 Capital letters are prefixed with '/' when saved with putXXX in registry
-
- Closed
-