United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6396599 : (prefs) Preferences sync fails if jaxp transform provider doesn't support indent-number

Details
Type:
Bug
Submit Date:
2006-03-10
Status:
Closed
Updated Date:
2011-05-18
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
core-libs
OS:
linux
Sub-Component:
java.util
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g)
Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.15-1.1830_FC4 #1 Thu Feb 2 17:23:41 EST 2006 i686 i686 i386 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
classpath contains apache xalan 2.6.0 - overriding default javax.xml.transform.TransformerFactory via META-INF/services

A DESCRIPTION OF THE PROBLEM :
Attempts to trigger a preferenece store (using the default provider ie FileSystemPreferences) fail with a java.util.prefs.BackingStoreException caused by java.lang.IllegalArgumentException due to XmlSupport.writeDoc attempting to set the "indent-number" attribute on the TransformerFactory (stack trace at end).

Since IllegalArgumentException is the proper response for an unrecognised attribute, and the indent is not essential to prefences operation it is reasonable to expect prefences to catch and ignore the exception. (1.5.0 works bacuase it does not set this attribute)



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce:
  1) compile test case
  2) run test case under jdk 1.6.0 beta with xalan as jaxp transform 
provider:
java -cp .:/home/clive/lib/xalan-j_2_6_0/bin/xalan.jar testing.PrefTest

Test code follows:
/*
 * PrefTest.java
 *
 * Created on 1 March 2006, 10:44
 * $Id: $
 */

package testing;

/**
 * Test for preferences sync
 * nb to reproduce issue must run with xalan as jaxp transform provider 
on a platform that uses FileSystemPreferences
 *
 * @author Clive Brettingham-Moore
 */


public class PrefTest {
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // do pref sync
        try {
            java.util.prefs.Preferences prefs = 
java.util.prefs.Preferences.userRoot();
            prefs.put("test", String.valueOf(Math.random()));
            prefs.sync();
        } catch (java.util.prefs.BackingStoreException e) {
            // Exception due to issue
            e.printStackTrace();
        }
    }
   
}


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
sucessful store of preferences
ACTUAL -
BackingStoreException as described

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Stack trace:
java.util.prefs.BackingStoreException: java.lang.IllegalArgumentException: Not supported: indent-number
        at java.util.prefs.FileSystemPreferences$8.run(FileSystemPreferences.java:615)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.util.prefs.FileSystemPreferences.writeBackCache(FileSystemPreferences.java:600)
        at java.util.prefs.FileSystemPreferences.syncSpiPrivileged(FileSystemPreferences.java:784)
        at java.util.prefs.FileSystemPreferences.access$2300(FileSystemPreferences.java:33)
        at java.util.prefs.FileSystemPreferences$13.run(FileSystemPreferences.java:754)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.util.prefs.FileSystemPreferences.syncSpi(FileSystemPreferences.java:752)
        at java.util.prefs.AbstractPreferences.sync2(AbstractPreferences.java:1317)
        at java.util.prefs.AbstractPreferences.sync(AbstractPreferences.java:1308)
        at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:731)
(deep application trace removed)
Caused by: java.lang.IllegalArgumentException: Not supported: indent-number
        at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:485)
        at java.util.prefs.XmlSupport.writeDoc(XmlSupport.java:247)
        at java.util.prefs.XmlSupport.exportMap(XmlSupport.java:333)
        at java.util.prefs.FileSystemPreferences$8.run(FileSystemPreferences.java:607)
        ... 36 more

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
For applications that use xalan directly can remove MRTA-INF/services from the xalan jar to prevent xalan being picked up as the default provider for jaxp transform.

                                    

Comments
EVALUATION

as suggested by the synopsis, seems like not everyone supports "indent-number"
                                     
2006-03-13



Hardware and Software, Engineered to Work Together