XFire

NullPointerException for empty uri on StaxUtils.writeStartElement

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.1, 1.1.1, 1.1.2, 1.2-RC, 1.2
  • Fix Version/s: 1.2.1
  • Component/s: Core
  • Labels:
    None
  • Environment:
    Mac-OSX embedded in a webapp with tomcat 5.0
  • Number of attachments :
    0

Description

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)

Activity

Hide
Dan Diephouse added a comment -

Thanks for filing this! Scheduling for 1.2.1

Show
Dan Diephouse added a comment - Thanks for filing this! Scheduling for 1.2.1
Hide
Dan Diephouse added a comment -

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.

Show
Dan Diephouse added a comment - 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.
Hide
Kevin Benson added a comment -

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.

Show
Kevin Benson added a comment - 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.
Hide
Dan Diephouse added a comment -

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!

Show
Dan Diephouse added a comment - 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!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: