cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregor Fischer <>
Subject [C2] TraxTransformer / FragmentExtractor - Issue
Date Thu, 13 Sep 2001 20:39:10 GMT


I posted a mail about a problem using the combination of the TraxTransformer 
and the FragmentExtractor on this list a while ago. 
Now I finally tracked it down.

It's a problem of the combination. When an element starts without being 
associated with a namespace, the uri parameter to startElement() is an 
empty String if called e.g. by FileGenerator. If called after the 
TraxTransformer it is NULL, what triggers a NPE and causes the pipeline 
to be aborted.

Here is an example for the changes made by the TraxTransformer (when using
a simple "copy-everything" stylesheet):

-[startElement] uri=,local=root,raw=root
+[startElement] uri=null,local=root,raw=root

- I append a patch to FragmentExtractor, that avoids a NPE to be thrown.
- Although this problem is solved with the patch alone, the TraxTransformer 
  (respectivly the underlying xalan (?)) should be modified to return an 
  empty string instead of NULL, to provide a more consistent calling 
  pattern (or is the value NULL to be expected in such a case ?).

I'd be happy if the patch would be incorporated.

diff -u -r1.3.2.2
--- src/org/apache/cocoon/transformation/     2001/08/20
+++ src/org/apache/cocoon/transformation/     2001/09/13
@@ -163,7 +163,7 @@
     public void startElement(String uri, String loc, String raw, Attributes a)
     throws SAXException {
-        if ( uri.equals(this.EXTRACT_URI) && loc.equals(this.EXTRACT_ELEMENT) ) {
+        if ( this.EXTRACT_URI.equals(uri) && this.EXTRACT_ELEMENT.equals(loc) ) {
             getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel
+ ".");


To unsubscribe, e-mail:
For additional commands, email:

View raw message