2012/12/3  <ma...@apache.org>:
> Author: markt
> Date: Sun Dec  2 21:01:52 2012
> New Revision: 1416258
>
> URL: http://svn.apache.org/viewvc?rev=1416258&view=rev
> Log:
> WebSocket 1.0 implementation part 7 of many
> Complete path parameter passing for POJOs
>
> Added:
>     tomcat/trunk/java/org/apache/tomcat/websocket/PathParam.java   (with 
> props)
> Modified:
>     tomcat/trunk/java/javax/websocket/WebSocketPathParam.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/PojoMethodMapping.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/UriTemplate.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/WsEndpointPojo.java
>     
> tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoAnnotation.java
>     tomcat/trunk/webapps/examples/websocket/echo.html
>


> Modified: tomcat/trunk/java/org/apache/tomcat/websocket/PojoMethodMapping.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/PojoMethodMapping.java?rev=1416258&r1=1416257&r2=1416258&view=diff
>

>  public class PojoMethodMapping {
(...)

> +
> +    private static Object coerceToType(Class<?> type, String value) {
> +
> +        if (type.equals(String.class)) {

The above probably needs " || type.equals(Object.class)".

> +            return value;
> +        } else if (type.equals(boolean.class) || type.equals(Boolean.class)) 
> {
> +            return Boolean.valueOf(value);
> +        } else if (type.equals(byte.class) || type.equals(Byte.class)) {
> +            return Byte.valueOf(value);
> +        } else if (value.length() == 1 &&
> +                type.equals(char.class) || type.equals(Character.class)) {
> +            return Character.valueOf(value.charAt(0));

Corrected by r1417003.

> +        } else if (type.equals(double.class) || type.equals(Double.class)) {
> +            return Double.valueOf(value);
> +        } else if (type.equals(float.class) || type.equals(Float.class)) {
> +            return Float.valueOf(value);
> +        } else if (type.equals(int.class) || type.equals(Integer.class)) {
> +            return Integer.valueOf(value);
> +        } else if (type.equals(long.class) || type.equals(Long.class)) {
> +            return Long.valueOf(value);
> +        } else if (type.equals(short.class) || type.equals(Short.class)) {
> +            return Short.valueOf(value);
> +        } else {
> +            // TODO
> +            throw new IllegalArgumentException();
> +        }
>      }
>  }

"if (value==null) { return value; }"  could be added to the method,
but I see that it actually never happens, as a call to this method is
just skipped when the value is null.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to