Name: rmT116609 Date: 05/01/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
SunOS 5.8 Generic_108528-12 sun4u sparc SUNW,Ultra-60
A DESCRIPTION OF THE PROBLEM :
When calling Preferences.node (myStr), if myStr contains a "." period character, then in $HOME/.java/.userPrefs a directory name made up of garbage characters is
produced.
Example String: "machine.domain"
Directory Created: _!'0!}@"j!'g!a@"u!'`!.g"k!'8!b@"h!'k!bg==
This either needs to be fixed or documented that the "." character is not supported.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the below source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I would expect to see $HOME/.java/.userPrefs/machine.domain/ be created not the garbage string.
Here is a listing of the dir:
prompt> pwd
/users/keiths/.java/.userPrefs
prompt> ls -la
total 16
drwxr-xr-x 3 keiths eng2 8192 May 1 10:04 .
drwxr-x--x 3 keiths eng2 96 May 1 08:36 ..
-rw------- 1 keiths eng2 0 May 1 10:04
.user.lock.keiths
-rw------- 1 keiths eng2 0 May 1 10:04
.userRootModFile.keiths
drwxr-xr-x 2 keiths eng2 96 May 1 10:04
_!'0!}@"j!'g!a@"u!'`!.g"k!'8!b@"h!'k!bg==
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.prefs.*;
class prefsBug
{
static public void main (final String[] args)
{
String prefsStr = new String ("machine.domain");
Preferences prefs = Preferences.userRoot ();
prefs = prefs.node (prefsStr);
prefs.putInt ("Variant", 1);
try {prefs.flush ();}
catch (BackingStoreException ex)
{
System.out.println ("Flush Exception " + ex);
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
I am replacing all "." chars with "-" for now.
(Review ID: 146088)
======================================================================
- relates to
-
JDK-6352424 (prefs) doc should specify which chars are allowed in java.util.prefs.Preferences.node()
-
- Closed
-