cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject ArrayIndexOOB in o.a.c.c.serializers.util.Namespaces
Date Wed, 20 Oct 2004 16:00:45 GMT
Hi Cocoon developers,

I get the following exception when I use a certain logicsheet:


java.lang.ArrayIndexOutOfBoundsException: -3
at ...serializers.util.Namespaces.commit(Namespaces.java:158)
at 
...serializers.EncodingSerializer.startElement(EncodingSerializer.java:446)
at ...sax.XMLTeePipe.startElement(XMLTeePipe.java:83)


The problem occurs here (line marked with *):

     public String[][] commit() {
         int size = this.depth - this.last;
         String result[][] = new String[size][2];
         int k = 0;
         for (int x = this.last; x < this.depth; x++) {
*           result[k][NAMESPACE_PREFIX] = this.pre[x];



For debugging, I added some logging to the push() and pop() methods.
This is the result (the number at the end of the line is the current
Namespaces.last field):


[...]
         push [i18n] 4
           push [xsp] 4
             push [input] 4
               push [xspdoc] 4
                 push [esql] 4
                   push [xsp-vvz-e] 4
                     push [tree] 4
                     pop  [tree] 3
                   pop  [xsp-vvz-e] 2
                 pop  [esql] 1
               pop  [xspdoc] 0
             pop  [input] -1
           pop  [xsp] -2
         pop  [i18n] -3
       pop  [vvz] -4
[...]


Apparently this.last is increased on push, but not decreased on pop
which leads to a negative array index. Any ideas what goes wrong?
My logicsheet seems to be proper XSLT.

Thanks in advance,
-- Andreas


Mime
View raw message