History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-615
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Dan Diephouse
Reporter: Kevin Benson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

NullPointerException for empty uri on StaxUtils.writeStartElement

Created: 31/Aug/06 08:40 AM   Updated: 02/Sep/06 11:06 AM
Component/s: Core
Affects Version/s: 1.1, 1.1.1, 1.2-RC, 1.2, 1.1.2
Fix Version/s: 1.2.1

Time Tracking:
Not Specified

Environment: Mac-OSX embedded in a webapp with tomcat 5.0


 Description  « Hide
May need to be reported to Woodstox? Things are good with Woodstox 2.0.6 (but not with the bundled 2.9.3)
Xfire probably simply needs to check for empty or null uri before trying to get the prefix in StaxUtils.
String boundPrefix = writer.getPrefix(uri);
(in version 1.2 of xfire line 175)

use messageBinding (with message style) using method:
public XMLStreamReader invoke(MessageContext context)

Stacktrace:
Caused by: java.lang.NullPointerException at com.ctc.wstx.util.BijectiveNsMap.findPrefixByUri(BijectiveNsMap.java:132)
at com.ctc.wstx.sw.SimpleOutputElement.getPrefix(SimpleOutputElement.java:453)
at com.ctc.wstx.sw.BaseNsStreamWriter.getPrefix(BaseNsStreamWriter.java:112)
at org.codehaus.xfire.util.STAXUtils.writeStartElement(STAXUtils.java:171)
at org.codehaus.xfire.util.STAXUtils.copy(STAXUtils.java:137)
at org.codehaus.xfire.service.binding.MessageBindingProvider.writeParameter(MessageBindingProvider.java:119)
at org.codehaus.xfire.service.binding.MessageBinding.writeMessage(MessageBinding.java:96)
at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)
at org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 31/Aug/06 08:44 AM
Thanks for filing this! Scheduling for 1.2.1

Dan Diephouse - 01/Sep/06 09:04 AM
Any chance you have a sample of XML which causes this? I don't see how this could be happening with the current code in 1.2.

Kevin Benson - 01/Sep/06 10:37 AM
Ok, sort of on a different computer today, but should be able to by tomorrow. It could be that I am using it slightly different than others. Trying to do most of the xml/soap req&response myself. But I love how xfire lets me do that.
Anyways I have things set to MessageBinding and style set to message.
using: public XMLStreamReader invoke(MessageContext mc).

I looked at the req xml and things are good. When I did a simple StringReader to create some sample xml to do the response. It threw the Nullpointerexception.
//XMLStreamReader responseReader = StaxUtils.createXMLStreamReader(new StringReader(/{xml}/));
//return responseReader;
Even when I was placing in some kind of default namespace in a parent still got exception. I even went to trying simple xml to see what happens such as: <Hello>world</Hello> and again exception. I believe I eventually got a <Hello xmlns="urn:hello">world</Hello> to work. I will try to give you sample xml in the comments later tonight or tomorrow. As I said using woodstox 2.0.6 did not throw the exception. cheers.


Dan Diephouse - 02/Sep/06 11:06 AM
I've just fixed this in SVN I believe. In certain the cases the URI was null and we weren't expecting that. Thanks Kevin!