FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Bug in class SAX2StAXEventWriter. Version:
* $Id: SAX2StAXEventWriter.java,v 1.3 2005/11/03 17:53:11 jeffsuttor Exp $
* @(#)SAX2StAXEventWriter.java 1.7 06/01/27
Wrong use of postfix '++' operator at line 334.
in method protected void createStartEvents(Attributes attributes, Collection[] events);
The line
String uri = (String) namespaces.elementAt(i++); // postfix ++
should be read as
String uri = (String) namespaces.elementAt(++i); // prefix ++
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
protected void createStartEvents(Attributes attributes, Collection[] events) {
.....
// create namespaces
if (namespaces != null) {
final int nDecls = namespaces.size();
for (int i = 0; i < nDecls; i++) {
final String prefix = (String) namespaces.elementAt(i);
String uri = (String) namespaces.elementAt(++i); // prefix ++
Namespace ns = createNamespace(prefix, uri);
if (nsMap == null) {
nsMap = new HashMap();
}
nsMap.put(prefix, ns);
}
}
....
}
A DESCRIPTION OF THE PROBLEM :
Bug in class SAX2StAXEventWriter. Version:
* $Id: SAX2StAXEventWriter.java,v 1.3 2005/11/03 17:53:11 jeffsuttor Exp $
* @(#)SAX2StAXEventWriter.java 1.7 06/01/27
Wrong use of postfix '++' operator at line 334.
in method protected void createStartEvents(Attributes attributes, Collection[] events);
The line
String uri = (String) namespaces.elementAt(i++); // postfix ++
should be read as
String uri = (String) namespaces.elementAt(++i); // prefix ++
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
protected void createStartEvents(Attributes attributes, Collection[] events) {
.....
// create namespaces
if (namespaces != null) {
final int nDecls = namespaces.size();
for (int i = 0; i < nDecls; i++) {
final String prefix = (String) namespaces.elementAt(i);
String uri = (String) namespaces.elementAt(++i); // prefix ++
Namespace ns = createNamespace(prefix, uri);
if (nsMap == null) {
nsMap = new HashMap();
}
nsMap.put(prefix, ns);
}
}
....
}