-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
1.6.0_01
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
javax.xml.stream.events.XMLEvent.writeAsEncodeUnicode does not appear to function . I haven't tested all events, but it certainly does not work for start/end element events or characters.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code supplied
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting the output to be the same as String str.
ACTUAL -
No output at all
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no message
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.CharArrayWriter;
import java.io.StringReader;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
public class testStaxEventWriting {
/**
* @param args
*/
public static void main(String[] args) {
String str = "<html><p>some text</p>\n</html>";
StringReader sr = new StringReader(str);
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLEventReader reader = null;
try {
reader = inputFactory.createXMLEventReader(sr);
} catch (XMLStreamException e) {
e.printStackTrace();
return;
}
CharArrayWriter writer = new CharArrayWriter();
while (reader.hasNext()){
try {
XMLEvent event = reader.nextEvent();
event.writeAsEncodedUnicode(writer);
} catch (XMLStreamException e) {
e.printStackTrace();
return;
}
}
writer.close();
System.out.println(writer.toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I will extend the existing event classes with working output methods and create an event factory to serve them up.
1.6.0_01
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
javax.xml.stream.events.XMLEvent.writeAsEncodeUnicode does not appear to function . I haven't tested all events, but it certainly does not work for start/end element events or characters.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code supplied
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting the output to be the same as String str.
ACTUAL -
No output at all
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no message
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.CharArrayWriter;
import java.io.StringReader;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
public class testStaxEventWriting {
/**
* @param args
*/
public static void main(String[] args) {
String str = "<html><p>some text</p>\n</html>";
StringReader sr = new StringReader(str);
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLEventReader reader = null;
try {
reader = inputFactory.createXMLEventReader(sr);
} catch (XMLStreamException e) {
e.printStackTrace();
return;
}
CharArrayWriter writer = new CharArrayWriter();
while (reader.hasNext()){
try {
XMLEvent event = reader.nextEvent();
event.writeAsEncodedUnicode(writer);
} catch (XMLStreamException e) {
e.printStackTrace();
return;
}
}
writer.close();
System.out.println(writer.toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I will extend the existing event classes with working output methods and create an event factory to serve them up.