Author: hlship
Date: Sun Sep 16 20:05:03 2007
New Revision: 576241

URL: http://svn.apache.org/viewvc?rev=576241&view=rev
Log:
TAPESTRY-1648: Coercing from null to BigDecimal causes an NPE

Modified:
    tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle
    
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt
    
tapestry/tapestry5/trunk/tapestry-ioc/src/site/resources/images/type-coercer.png
    
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle?rev=576241&r1=576240&r2=576241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle 
(original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/images/type-coercer.graffle Sun 
Sep 16 20:05:03 2007
@@ -4,6 +4,11 @@
 <dict>
        <key>ActiveLayerIndex</key>
        <integer>0</integer>
+       <key>ApplicationVersion</key>
+       <array>
+               <string>com.omnigroup.OmniGraffle</string>
+               <string>129.15</string>
+       </array>
        <key>AutoAdjust</key>
        <true/>
        <key>CanvasColor</key>
@@ -31,11 +36,440 @@
        <array>
                <dict>
                        <key>Bounds</key>
-                       <string>{{69, 472.8}, {61, 36}}</string>
+                       <string>{{300.5, 132.6}, {61, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>ID</key>
+                       <integer>65</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.8</string>
+                                               <key>g</key>
+                                               <string>0.8</string>
+                                               <key>r</key>
+                                               <string>0.8</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 null}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>71</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>77</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{302.705, 163.493}</string>
+                               <string>{253.048, 186.119}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>70</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>76</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{300, 150.6}</string>
+                               <string>{243.5, 150.6}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>68</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>75</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{302.449, 138.236}</string>
+                               <string>{253.856, 117.193}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>67</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>74</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{359.151, 163.771}</string>
+                               <string>{412.409, 188.688}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>69</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>73</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{362, 150.6}</string>
+                               <string>{412, 150.6}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Class</key>
+                       <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>66</integer>
+                       </dict>
+                       <key>ID</key>
+                       <integer>72</integer>
+                       <key>Points</key>
+                       <array>
+                               <string>{359.421, 137.963}</string>
+                               <string>{414.579, 113.437}</string>
+                       </array>
+                       <key>Style</key>
+                       <dict>
+                               <key>stroke</key>
+                               <dict>
+                                       <key>HeadArrow</key>
+                                       <string>FilledArrow</string>
+                                       <key>LineType</key>
+                                       <integer>1</integer>
+                                       <key>TailArrow</key>
+                                       <string>0</string>
+                                       <key>Width</key>
+                                       <real>4</real>
+                               </dict>
+                       </dict>
+                       <key>Tail</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>65</integer>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{46.5, 472.8}, {61, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>ID</key>
+                       <integer>48</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 Object}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{171, 185}, {90, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>FontInfo</key>
+                       <dict>
+                               <key>Color</key>
+                               <dict>
+                                       <key>b</key>
+                                       <string>0</string>
+                                       <key>g</key>
+                                       <string>0</string>
+                                       <key>r</key>
+                                       <string>0</string>
+                               </dict>
+                       </dict>
+                       <key>ID</key>
+                       <integer>71</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 BigInteger}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{189, 132.6}, {54, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>ID</key>
+                       <integer>70</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 Long}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{412.5, 132.6}, {61, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>FontInfo</key>
+                       <dict>
+                               <key>Color</key>
+                               <dict>
+                                       <key>w</key>
+                                       <string>0</string>
+                               </dict>
+                               <key>Font</key>
+                               <string>Helvetica</string>
+                               <key>NSKern</key>
+                               <real>0.0</real>
+                               <key>Size</key>
+                               <real>12</real>
+                       </dict>
+                       <key>ID</key>
+                       <integer>69</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                                       <key>GradientColor</key>
+                                       <dict>
+                                               <key>w</key>
+                                               <string>0.666667</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 \expnd0\expndtw0\kerning0
+Double}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{171, 82.8}, {90, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
+                       <key>FontInfo</key>
+                       <dict>
+                               <key>Color</key>
+                               <dict>
+                                       <key>b</key>
+                                       <string>0</string>
+                                       <key>g</key>
+                                       <string>0</string>
+                                       <key>r</key>
+                                       <string>0</string>
+                               </dict>
+                       </dict>
                        <key>ID</key>
-                       <integer>61</integer>
+                       <integer>68</integer>
                        <key>Shape</key>
                        <string>RoundRect</string>
                        <key>Style</key>
@@ -45,11 +479,11 @@
                                        <key>Color</key>
                                        <dict>
                                                <key>b</key>
-                                               <string>0.8</string>
+                                               <string>0.0941176</string>
                                                <key>g</key>
-                                               <string>0.8</string>
+                                               <string>0.917647</string>
                                                <key>r</key>
-                                               <string>0.8</string>
+                                               <string>1</string>
                                        </dict>
                                </dict>
                        </dict>
@@ -61,12 +495,82 @@
 {\colortbl;\red255\green255\blue255;}
 
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
 
-\f0\fs24 \cf0 null}</string>
+\f0\fs24 \cf0 BigDecimal}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{409, 185}, {68, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>ID</key>
+                       <integer>67</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 Boolean}</string>
+                       </dict>
+               </dict>
+               <dict>
+                       <key>Bounds</key>
+                       <string>{{412.5, 82.8}, {61, 36}}</string>
+                       <key>Class</key>
+                       <string>ShapedGraphic</string>
+                       <key>ID</key>
+                       <integer>66</integer>
+                       <key>Shape</key>
+                       <string>RoundRect</string>
+                       <key>Style</key>
+                       <dict>
+                               <key>fill</key>
+                               <dict>
+                                       <key>Color</key>
+                                       <dict>
+                                               <key>b</key>
+                                               <string>0.0941176</string>
+                                               <key>g</key>
+                                               <string>0.917647</string>
+                                               <key>r</key>
+                                               <string>1</string>
+                                       </dict>
+                               </dict>
+                       </dict>
+                       <key>Text</key>
+                       <dict>
+                               <key>Text</key>
+                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\fs24 \cf0 List}</string>
                        </dict>
                </dict>
                <dict>
                        <key>Bounds</key>
-                       <string>{{54.5, 174.8}, {90, 36}}</string>
+                       <string>{{32, 168.6}, {90, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
                        <key>FontInfo</key>
@@ -113,7 +617,7 @@
                </dict>
                <dict>
                        <key>Bounds</key>
-                       <string>{{65.5, 676}, {68, 36}}</string>
+                       <string>{{43, 320.8}, {68, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
                        <key>ID</key>
@@ -148,7 +652,7 @@
                </dict>
                <dict>
                        <key>Bounds</key>
-                       <string>{{69, 595}, {61, 36}}</string>
+                       <string>{{46.5, 396.8}, {61, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
                        <key>ID</key>
@@ -254,12 +758,17 @@
                <dict>
                        <key>Class</key>
                        <string>LineGraphic</string>
+                       <key>Head</key>
+                       <dict>
+                               <key>ID</key>
+                               <integer>4</integer>
+                       </dict>
                        <key>ID</key>
                        <integer>49</integer>
                        <key>Points</key>
                        <array>
-                               <string>{191.862, 557.5}</string>
-                               <string>{191.5, 508.8}</string>
+                               <string>{108, 490.8}</string>
+                               <string>{164.5, 490.8}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -282,41 +791,6 @@
                        </dict>
                </dict>
                <dict>
-                       <key>Bounds</key>
-                       <string>{{161.5, 558}, {61, 36}}</string>
-                       <key>Class</key>
-                       <string>ShapedGraphic</string>
-                       <key>ID</key>
-                       <integer>48</integer>
-                       <key>Shape</key>
-                       <string>RoundRect</string>
-                       <key>Style</key>
-                       <dict>
-                               <key>fill</key>
-                               <dict>
-                                       <key>Color</key>
-                                       <dict>
-                                               <key>b</key>
-                                               <string>0.0941176</string>
-                                               <key>g</key>
-                                               <string>0.917647</string>
-                                               <key>r</key>
-                                               <string>1</string>
-                                       </dict>
-                               </dict>
-                       </dict>
-                       <key>Text</key>
-                       <dict>
-                               <key>Text</key>
-                               
<string>{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-
-\f0\fs24 \cf0 Object}</string>
-                       </dict>
-               </dict>
-               <dict>
                        <key>Class</key>
                        <string>LineGraphic</string>
                        <key>Head</key>
@@ -328,8 +802,8 @@
                        <integer>47</integer>
                        <key>Points</key>
                        <array>
-                               <string>{314.779, 357.228}</string>
-                               <string>{131.494, 288.923}</string>
+                               <string>{314.723, 357.425}</string>
+                               <string>{109.102, 282.498}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -353,7 +827,7 @@
                </dict>
                <dict>
                        <key>Bounds</key>
-                       <string>{{65.5, 259}, {68, 36}}</string>
+                       <string>{{43, 252.8}, {68, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
                        <key>ID</key>
@@ -583,7 +1057,7 @@
                </dict>
                <dict>
                        <key>Bounds</key>
-                       <string>{{149.5, 349}, {90, 36}}</string>
+                       <string>{{147, 349}, {90, 36}}</string>
                        <key>Class</key>
                        <string>ShapedGraphic</string>
                        <key>FontInfo</key>
@@ -777,8 +1251,10 @@
                        <integer>43</integer>
                        <key>Points</key>
                        <array>
-                               <string>{184.014, 472.341}</string>
-                               <string>{107.486, 295.459}</string>
+                               <string>{181.195, 472.369}</string>
+                               <string>{158, 432.8}</string>
+                               <string>{130, 349}</string>
+                               <string>{89.48, 289.214}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -1022,7 +1498,7 @@
                        <integer>31</integer>
                        <key>Points</key>
                        <array>
-                               <string>{240, 367}</string>
+                               <string>{237.5, 367}</string>
                                <string>{313.5, 367}</string>
                        </array>
                        <key>Style</key>
@@ -1057,8 +1533,8 @@
                        <integer>29</integer>
                        <key>Points</key>
                        <array>
-                               <string>{192.374, 472.3}</string>
-                               <string>{194.126, 385.5}</string>
+                               <string>{192, 472.3}</string>
+                               <string>{192, 385.5}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -1199,8 +1675,8 @@
                        <integer>53</integer>
                        <key>Points</key>
                        <array>
-                               <string>{163.096, 587.562}</string>
-                               <string>{128.404, 601.438}</string>
+                               <string>{77, 472.3}</string>
+                               <string>{77, 433.3}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -1234,8 +1710,8 @@
                        <integer>55</integer>
                        <key>Points</key>
                        <array>
-                               <string>{99.5, 675.5}</string>
-                               <string>{99.5, 631.5}</string>
+                               <string>{77, 357.3}</string>
+                               <string>{77, 396.3}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -1269,8 +1745,8 @@
                        <integer>60</integer>
                        <key>Points</key>
                        <array>
-                               <string>{99.5, 211.3}</string>
-                               <string>{99.5, 258.5}</string>
+                               <string>{77, 205.1}</string>
+                               <string>{77, 252.3}</string>
                        </array>
                        <key>Style</key>
                        <dict>
@@ -1292,111 +1768,6 @@
                                <integer>59</integer>
                        </dict>
                </dict>
-               <dict>
-                       <key>Class</key>
-                       <string>LineGraphic</string>
-                       <key>Head</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>42</integer>
-                       </dict>
-                       <key>ID</key>
-                       <integer>62</integer>
-                       <key>Points</key>
-                       <array>
-                               <string>{99.5, 472.3}</string>
-                               <string>{99.5, 295.5}</string>
-                       </array>
-                       <key>Style</key>
-                       <dict>
-                               <key>stroke</key>
-                               <dict>
-                                       <key>HeadArrow</key>
-                                       <string>FilledArrow</string>
-                                       <key>LineType</key>
-                                       <integer>1</integer>
-                                       <key>TailArrow</key>
-                                       <string>0</string>
-                                       <key>Width</key>
-                                       <real>4</real>
-                               </dict>
-                       </dict>
-                       <key>Tail</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>61</integer>
-                       </dict>
-               </dict>
-               <dict>
-                       <key>Class</key>
-                       <string>LineGraphic</string>
-                       <key>Head</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>4</integer>
-                       </dict>
-                       <key>ID</key>
-                       <integer>63</integer>
-                       <key>Points</key>
-                       <array>
-                               <string>{130.5, 490.8}</string>
-                               <string>{164.5, 490.8}</string>
-                       </array>
-                       <key>Style</key>
-                       <dict>
-                               <key>stroke</key>
-                               <dict>
-                                       <key>HeadArrow</key>
-                                       <string>FilledArrow</string>
-                                       <key>LineType</key>
-                                       <integer>1</integer>
-                                       <key>TailArrow</key>
-                                       <string>0</string>
-                                       <key>Width</key>
-                                       <real>4</real>
-                               </dict>
-                       </dict>
-                       <key>Tail</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>61</integer>
-                       </dict>
-               </dict>
-               <dict>
-                       <key>Class</key>
-                       <string>LineGraphic</string>
-                       <key>Head</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>52</integer>
-                       </dict>
-                       <key>ID</key>
-                       <integer>64</integer>
-                       <key>Points</key>
-                       <array>
-                               <string>{99.5, 509.3}</string>
-                               <string>{99.5, 594.5}</string>
-                       </array>
-                       <key>Style</key>
-                       <dict>
-                               <key>stroke</key>
-                               <dict>
-                                       <key>HeadArrow</key>
-                                       <string>FilledArrow</string>
-                                       <key>LineType</key>
-                                       <integer>1</integer>
-                                       <key>TailArrow</key>
-                                       <string>0</string>
-                                       <key>Width</key>
-                                       <real>4</real>
-                               </dict>
-                       </dict>
-                       <key>Tail</key>
-                       <dict>
-                               <key>ID</key>
-                               <integer>61</integer>
-                       </dict>
-               </dict>
        </array>
        <key>GridInfo</key>
        <dict/>
@@ -1497,7 +1868,7 @@
                </dict>
        </array>
        <key>ModificationDate</key>
-       <string>2007-02-19 08:06:00 -0800</string>
+       <string>2007-09-16 20:00:30 -0700</string>
        <key>Modifier</key>
        <string>Howard Lewis Ship</string>
        <key>NotesVisible</key>
@@ -1559,25 +1930,19 @@
        <key>WindowInfo</key>
        <dict>
                <key>CurrentSheet</key>
-               <string>0</string>
+               <integer>0</integer>
                <key>DrawerOpen</key>
                <true/>
                <key>DrawerTab</key>
                <string>Outline</string>
                <key>DrawerWidth</key>
                <real>209</real>
-               <key>FitInWindow</key>
-               <false/>
                <key>Frame</key>
-               <string>{{512, 388}, {594, 870}}</string>
-               <key>ShowRuler</key>
-               <false/>
-               <key>ShowStatusBar</key>
-               <true/>
+               <string>{{343, 69}, {591, 809}}</string>
                <key>VisibleRegion</key>
-               <string>{{0, 0}, {579, 756}}</string>
+               <string>{{0, 61}, {576, 695}}</string>
                <key>Zoom</key>
-               <string>1</string>
+               <real>1</real>
        </dict>
 </dict>
 </plist>

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java?rev=576241&r1=576240&r2=576241&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
 Sun Sep 16 20:05:03 2007
@@ -27,11 +27,11 @@
 import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.Configuration;
 import org.apache.tapestry.ioc.MappedConfiguration;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.ObjectProvider;
 import org.apache.tapestry.ioc.OrderedConfiguration;
 import org.apache.tapestry.ioc.ServiceBinder;
 import org.apache.tapestry.ioc.ServiceLifecycle;
-import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.internal.services.ChainBuilderImpl;
@@ -141,7 +141,7 @@
     }
 
     /**
-     * Contributes a set of standard type coercions:
+     * Contributes a set of standard type coercions to the [EMAIL PROTECTED] 
TypeCoercer} service:
      * <ul>
      * <li>Object to String</li>
      * <li>String to Double</li>
@@ -166,9 +166,17 @@
      * <li>Object[] to List</li>
      * <li>Object to List (by wrapping as a singleton list)</li>
      * <li>Null to List (still null)</li>
+     * <li>Null to Long (zero)</li>
+     * <li>Null to BigDecimal (zero)</li>
+     * <li>Null to BigInteger (zero)</li>
      * </ul>
-     * 
-     * @see #buildTypeCoercer(Collection, ComponentInstantiatorSource)
+     * <p>
+     * The coercion of String to Long, BigInteger, Double and BigDecimal 
causes some minor headaches
+     * when attempting to add coercions from null to various numeric types: we 
end up having to have
+     * many more coercions for the null case to prevent null --> String --> 
BigInteger. This may
+     * indicate a weakness in the algorithm, in that coercions through String 
should be considered
+     * "weaker" than other coercions. Alternately, coercions from null may 
need to be handled
+     * specially. We'll see if we tweak the algorithm in the future.
      */
 
     public static void contributeTypeCoercer(Configuration<CoercionTuple> 
configuration)
@@ -321,6 +329,39 @@
             public Boolean coerce(Void input)
             {
                 return false;
+            }
+        });
+
+        add(configuration, void.class, Long.class, new Coercion<Void, Long>()
+        {
+            public Long coerce(Void input)
+            {
+                return 0l;
+            }
+        });
+
+        add(configuration, void.class, BigDecimal.class, new Coercion<Void, 
BigDecimal>()
+        {
+
+            public BigDecimal coerce(Void input)
+            {
+                return BigDecimal.ZERO;
+            }
+        });
+
+        add(configuration, void.class, BigInteger.class, new Coercion<Void, 
BigInteger>()
+        {
+            public BigInteger coerce(Void input)
+            {
+                return BigInteger.ZERO;
+            }
+        });
+
+        add(configuration, void.class, Double.class, new Coercion<Void, 
Double>()
+        {
+            public Double coerce(Void input)
+            {
+                return 0d;
             }
         });
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt?rev=576241&r1=576240&r2=576241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/coerce.apt Sun Sep 16 
20:05:03 2007
@@ -19,8 +19,10 @@
   
 [images/type-coercer.png] Default Type Coercions  
 
-  There's a few special coercions related to null there; Object --\>List wraps 
a lone object as a singleton list, we then need
-  null --\>List to ensure that null stays null (rather than a singleton list 
whose lone element is a null).
+  There's a few special coercions related to null there; Object --\> List 
wraps a lone object as a singleton list, we then need
+  null --\> List to ensure that null stays null (rather than a singleton list 
whose lone element is a null).  Likewise, there's
+  a number of coercions from null to numeric types (null is coerced to zero). 
Several more of these are needed than you'd think, because otherwise
+  the coercer attempts to coerce through String.
   
   Tapestry can <interpolate> necessary coercions.  For example, say it is 
necessary to coerce a StringBuffer to an Integer; the
   TypeCoercer will chain together a series of coercions:

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/site/resources/images/type-coercer.png
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/resources/images/type-coercer.png?rev=576241&r1=576240&r2=576241&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java?rev=576241&r1=576240&r2=576241&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
 Sun Sep 16 20:05:03 2007
@@ -180,6 +180,13 @@
                 { new String[]
                 { "a", "b" }, List.class, Arrays.asList("a", "b") },
 
+                { null, Long.class, 0l },
+                { null, Short.class, (short) 0 },
+                { null, Byte.class, (byte) 0 },
+                { null, BigDecimal.class, BigDecimal.ZERO },
+                { null, Float.class, 0f },
+                { null, BigInteger.class, BigInteger.ZERO },
+
                 // null to arbitrary object is still null
 
                 { null, XMLReader.class, null } };


Reply via email to