Hi Tom,
Unfortunately, the ORB bug can't be fixed as per OMG spec it's the correct
behavior. This is what Ken Cavanaugh wrote in the 193 notes: "Can't fix
this for AS 9. May need a spec change at the OMG level."
We had several user that needed ugly work arounds because of that problem.
Ken, can you please comment on that? (Don't worry if you are not on the
alias - I'll accept your email).
thanks,
-marina
Tom Ware wrote On 09/27/06 12:38,:
> Hi Marina,
>
> I believe this fix should work. I have a couple of
> questions/concerns. Perhaps you can make me feel a bit better about them.
>
> 1. When I look at the base bug, it appears to me as though we have
> isolated the bug to the serialization layer. Perhaps I am missing some
> of the internal discussion, but it is not clear to me why we are
> choosing to fix this in the TopLink layer. When are we expecting the
> base bug to be dealt with? Is this a GlassFish-only issue or a more
> general spec issue? If it is a spec issue can someone please give me a
> short explanation?
>
> 2. The reason that I am concerned is that although I believe the code
> will work, it is somewhat inconsistent with what is happening elsewhere
> in the EnumTypeConverter. (i.e. convertObjectValueToDataValue now gets
> its values in a different way than convertDataValueToObjectValue).
>
> 3. If we can deal with those concerns, one thing we will have to do is
> add a fairly verbose comment to the code that why we are deviating from
> the pattern elsewhere in the TypeConverters and (hopefully) references
> bugs in glassfish and, if possible, the spec with the issue.
>
> -Tom
>
>
> Marina Vatkina wrote:
>
>
>>Apparently I forgot about the nulls. Here is the fixed code:
>>
>>diff -r1.3 EnumTypeConverter.java
>>107a108,121
>>
>>> /**
>>> * INTERNAL:
>>> * Convert Enum object to the data value.
>>> */
>>> public Object convertObjectValueToDataValue(Object attributeValue,
>>
>>Session session) {
>>
>>> if (attributeValue == null) {
>>> return super.convertObjectValueToDataValue(null, session);
>>> }
>>>
>>> Enum theEnum = Enum.class.cast(attributeValue);
>>> return (m_usesOrdinalValues)? theEnum.ordinal() : theEnum.name();
>>> }
>>>
>>
>>thanks,
>>-marina
>>
>>Marina Vatkina wrote:
>>
>>
>>
>>>Tom, Team,
>>>
>>>This issue (https://glassfish.dev.java.net/issues/show_bug.cgi?id=634)
>>>is caused
>>>by the problem with ORB unmarshalling rules
>>>(https://glassfish.dev.java.net/issues/show_bug.cgi?id=193).
>>>
>>>There seems to be an easy solution to solve this bug for TopLink users
>>>by adding
>>>an override method to EnumTypeConverter that just returns the corresponding
>>>value instead of looking it up (and why bother spending time on lookup
>>>in this
>>>case?).
>>>
>>>diff -r1.3 EnumTypeConverter.java
>>>107a108,118
>>>
>>>> /**
>>>> * INTERNAL:
>>>> * Convert Enum object to the data value.
>>>> */
>>>> public Object convertObjectValueToDataValue(Object
>>>
>>>attributeValue, Session session) {
>>>
>>>> Object fieldValue;
>>>> Enum theEnum = Enum.class.cast(attributeValue);
>>>> return (m_usesOrdinalValues)? theEnum.ordinal() :
>>>
>>>theEnum.name();
>>>
>>>> }
>>>>
>>>
>>>I verified that it works correctly with the test attached to the issue
>>>in both
>>>modes (one has been failing without the fix).
>>>
>>>What do you think?
>>>
>>>thanks,
>>>-marina
>>>
>>>
>
>