Ignore:
Timestamp:
03/15/08 06:11:00 (4 years ago)
Author:
jharrop
Message:

Workaround for docx4all java.util.prefs.FileSystemPreferences? syncWorld, WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException?: java.lang.IllegalArgumentException?: Not supported: indent-number, every 30 seconds, caused by use of Xalan (non xsltc).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java

    r192 r193  
    259259                  net.sf.saxon.TransformerFactoryImpl 
    260260                   
     261                HOWEVER, docx4all encounters http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6396599 
     262                 
     263                        java.util.prefs.FileSystemPreferences syncWorld 
     264                        WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: java.lang.IllegalArgumentException: Not supported: indent-number 
     265                 
     266                every 30 seconds 
     267 
     268                The workaround implemented is to remove META-INF/services from the xalan jar  
     269                to prevent xalan being picked up as the default provider for jaxp transform, 
     270                so we have to use it explicitly. 
     271                 
     272                .. which means  
     273 
     274                        System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); 
     275 
    261276                  (unfortunately, there is no com.sun.org.apache.xalan.processor.TransformerFactoryImpl, 
    262277                   so we have to bundle xalan jar, which is 2.7 MB 
     
    269284          That gets us from 2.7 MB to 1.85 MB. 
    270285           
    271           But Sun already has: 
     286          Sun already has: 
    272287           
    273288                        com.sun.org.apache.xpath;                        
    274289                        com.sun.org.apache.xml.internal.dtm;                     
    275                         com.sun.org.apache.xalan.internal.extensions|lib|res|templates 
     290                        com.sun.org.apache.xalan.internal.extensions|lib|res 
    276291                    
    277                   So why not refactor Xalan and leave all that out as well? 
     292                  so you might think we can refactor Xalan to point to those, and them out of our jar. 
    278293                   
     294                  well, it turns out that its too messy leaving out org.apache.xpath or xalan.extensions          
    279295                   
    280                 HOWEVER, docx4all encounters http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6396599 
    281                  
    282                         java.util.prefs.FileSystemPreferences syncWorld 
    283                         WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: java.lang.IllegalArgumentException: Not supported: indent-number 
    284                  
    285                 every 30 seconds 
    286  
    287                 The workaround implemented is to remove META-INF/services from the xalan jar  
    288                 to prevent xalan being picked up as the default provider for jaxp transform, 
    289                 so we have to use it explicitly. 
    290                  
    291                 .. which means  
    292  
    293                         System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); 
     296                  so you have to keep xalan.extensions, processor, serialize, trace, transformer 
     297 
     298                  leaving out just org.apache.xalan.resources and org.apache.xpath.resources 
     299                  only gets us down to 1.5 MB. (and that's with just jar cvf xalan-minimal.jar org/apache/xalan org/apache/xpath 
     300                        - we'd still need to include org/apache/xml) 
     301                         
     302                        ie once you include the whole of org.apache.xpath, you may as well just go with the 1.85 MB  :( 
    294303                         
    295304*/               
    296                  
    297305                 
    298306                javax.xml.transform.TransformerFactory tfactory = javax.xml.transform.TransformerFactory.newInstance(); 
Note: See TracChangeset for help on using the changeset viewer.