Bug in XmiCasSerializer?

2010-03-29 Thread Greg Holmberg
UIMA developers-- 


XmiCasSerializer.XmiCasDocSerializer has this method: 

private void addAttribute(AttributesImpl attrs, String attrName, String 
attrValue) { 
attrs.addAttribute(null, null, attrName, cdataType, attrValue); 
} 

When I plug in a different ContentHandler (such as the ones from AgileDelta or 
Siemens 
for generating binary XML, aka EXI), then I get NullPointerExceptions. 
Apparently, they 
aren't expecting null for an attribute's URI and/or localName. 

I changed the above line to use "" instead of null, and these ContentHandlers 
no longer throw
an NPE. 

The developer at AgileDelta claims that the SAX spec says these should not be 
null (only if the
index is out of range).

So what is your opinion? Is null incorrect? Would there be any consequences 
(performance,
perhaps?) to changing the arguments to "" ?

If you think it's a bug, I'll create an issue in Jira.


Thanks, 

Greg Holmberg 



Re: Bug in XmiCasSerializer?

2010-03-30 Thread Marshall Schor
I found another line in that class where these arguments (which are for
the namespace) are passed in as "", "".  So I think it is a bug.  Also
the javadoc for the impl has this for the first 2 parameters of this method:

Parameters:
*uri* The Namespace URI, or the empty string if none is available or
Namespace processing is not being performed. 
*localName* The local name, or the empty string if Namespace
processing is not being performed.

So I think it's a bug.

-Marshall


On 3/29/2010 9:39 PM, Greg Holmberg wrote:
> UIMA developers-- 
>
>
> XmiCasSerializer.XmiCasDocSerializer has this method: 
>
> private void addAttribute(AttributesImpl attrs, String attrName, String 
> attrValue) { 
> attrs.addAttribute(null, null, attrName, cdataType, attrValue); 
> } 
>
> When I plug in a different ContentHandler (such as the ones from AgileDelta 
> or Siemens 
> for generating binary XML, aka EXI), then I get NullPointerExceptions. 
> Apparently, they 
> aren't expecting null for an attribute's URI and/or localName. 
>
> I changed the above line to use "" instead of null, and these ContentHandlers 
> no longer throw
> an NPE. 
>
> The developer at AgileDelta claims that the SAX spec says these should not be 
> null (only if the
> index is out of range).
>
> So what is your opinion? Is null incorrect? Would there be any consequences 
> (performance,
> perhaps?) to changing the arguments to "" ?
>
> If you think it's a bug, I'll create an issue in Jira.
>
>
> Thanks, 
>
> Greg Holmberg 
>
>
>
>