You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Michael Elman (JIRA)" <ji...@apache.org> on 2009/10/01 11:34:23 UTC

[jira] Commented: (WINK-201) Fix precedence on custom type conversion

    [ https://issues.apache.org/jira/browse/WINK-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761148#action_12761148 ] 

Michael Elman commented on WINK-201:
------------------------------------

Removing the sort functionality makes all TCK tests to pass successfully:
{code}
    private static abstract class SingleValueConvertor extends ValueConvertor {

        RuntimeException createConversionException(String value, Class<?> targetClass, Throwable e) {
            if (e instanceof WebApplicationException) {
                return (RuntimeException)e;
            }
            String message = String.format("Cannot convert value '%s' to %s", value, targetClass);
            return new ConversionException(message, e);
        }

        public Object convert(List<String> values) throws WebApplicationException {
            if (values == null || values.size() == 0) {
                return convert((String)null);
            }
            List<String> valuesSorted = new ArrayList<String>(values);
//            Collections.sort(valuesSorted);
            return convert(valuesSorted.get(0));
        }
    }
{code}

> Fix precedence on custom type conversion
> ----------------------------------------
>
>                 Key: WINK-201
>                 URL: https://issues.apache.org/jira/browse/WINK-201
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.2
>            Reporter: Bryant Luk
>            Assignee: Bryant Luk
>            Priority: Critical
>             Fix For: 0.2
>
>
> Re-reading the JAX-RS spec, the implied ordering for the type conversion is constructor then valueOf() (and now fromString()).  Will change the ordering to give constructors precedence.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.