dev@fi.java.net

Re: AttributesHolder

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 23 Oct 2006 05:20:44 +0200

Hi Alan,

Sorry, I am defintely confused about the source of the error. What threw
me off the scent was that i am thinking about just decoding rather than
encoding.


As you say the attributes holder should, when a lexical value is
required and the underlying data is represented by a built-in encoding
algorithm, always convert the data to a lexical value.

However, when the underlying data is represented by a registered
encoding algorithm *and* there is no registered encoding algorithm
declared then i think an exception should result rather than returning null.

And as you also point out when the algorothm data is null an exception
should be thrown too (since there should be a value present).

Make sense? If so i will fix accordingly.

Paul.

[1]
http://fisheye5.cenqua.com/browse/fi/FastInfoset/src/org/jvnet/fastinfoset/sax/helpers/EncodingAlgorithmAttributesImpl.java?r=MAIN

Alan Hudson wrote:
> Paul Sandoz wrote:
>
>> Alan Hudson wrote:
>>
>>
>> Hmm... IMHO if the attribute cannot be converted to a string because
>> some algorithm has not been registered then that should, by default,
>> result in an exception being thrown.
>>
>> I think the correct fix here is to have an configuration option to
>> silently ignore data that cannot be processed. What do you think?
>>
>
> What level do you consider the builtin encoders. In this case I was
> assuming the system understood them at a pretty low level. Hence what a
> getValue() would give me the value. But it does encourage non optimal
> behavior because the "right" way to process that is getting the
> primitive array back instead of converting to a string.
>
> But I expect users will call that method and expect it to just work. The
> code I put in does that.
>
> Throwing an exception would be better then the null value as it will
> direct better programmer behavior.
>
> Aren't builtins always registered? Ie I don't remember registering
> them, but perhaps I was susposed to. If they are already builtin in one
> place, then I'd be suprised to have to register them to the holder class.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109