Groups
Groups
Sign in
Groups
Groups
Woodstox User Mailing List
Conversations
About
Send feedback
Help
Should BaseStreamWriter / writeCharacters should deal with null text
81 views
Skip to first unread message
benjamin....@gmail.com
unread,
Jul 5, 2016, 9:55:02 AM
7/5/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Woodstox User Mailing List
Hello,
After discussion on github
(
https://github.com/FasterXML/woodstox/issues/18
) I come here to expose the issue I met.
In the implementation of the XMLStreamWriter (JSR280) : BaseStreamWriter
(
https://github.com/FasterXML/woodstox/blob/master/src/main/java/com/ctc/wstx/sw/BaseStreamWriter.java
)
the method writeCharacters(String text) does not check for the text to be null (line 464 : int len = text.length();) and we can get a NullPointerException.
In sun implementation (
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java#XMLStreamWriterImpl.writeXMLContent%28java.lang.String%29
) a check is done. This defensive approach leads them to write an empty String.
As stated in the github forum, there does not seem to have much usage information in javadocs or specs...
Somehow should the null String be managed?
Thanks
Tatu Saloranta
unread,
Apr 12, 2017, 11:07:44 AM
4/12/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Woodstox User Mailing List, benjamin....@gmail.com
Just for sake of completeness, this became:
https://github.com/FasterXML/woodstox/issues/18
-+ Tatu +-
Reply all
Reply to author
Forward
0 new messages