You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/01/17 19:26:47 UTC

svn commit: r612921 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java

Author: hlship
Date: Thu Jan 17 10:26:46 2008
New Revision: 612921

URL: http://svn.apache.org/viewvc?rev=612921&view=rev
Log:
TAPESTRY-1957: EnumValueEncoder missing null check when converting to client value

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java?rev=612921&r1=612920&r2=612921&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/util/EnumValueEncoder.java Thu Jan 17 10:26:46 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
 import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
 
 /**
- * A value encoder that can be used for aribrary Enum types. The enum name is stored as the client
- * side value (the "primary key").
+ * A value encoder that can be used for aribrary Enum types. The enum name is stored as the client side value (the
+ * "primary key").
  */
 public class EnumValueEncoder<E extends Enum<E>> implements ValueEncoder<E>
 {
@@ -34,6 +34,8 @@
 
     public String toClient(E value)
     {
+        if (value == null) return null;
+
         return value.name();
     }