<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=kdonald" rel="nofollow">Keith Donald</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7544?redirect=false" rel="nofollow">SPR-7544</a></strong> and commented</p>
<p dir="auto">Currently empty form fields are mapped to "" (empty string).  This has several issues:</p>
<ol dir="auto">
<li>Neither a <code class="notranslate">@NotNull</code> JSR-303 constraint or a "not null" relational DB constraint fails in this case.  You're left with defining a min <code class="notranslate">@Size</code> constraint or relying on a implementation-specific <code class="notranslate">@NotEmpty</code>.  In addition, there is no DB min constraint you can define at the Db level.  Simply mapping "" to null would solve these problems and we could just rely on <code class="notranslate">@NotNull</code>/not null.</li>
</ol>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.4</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398112227" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12969" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12969/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12969">#12969</a> Formatter subsystem's ParserConverter skips Parser invocation if input string is empty</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398092797" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10090" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10090/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10090">#10090</a> With binder.setRequiredFields constraint set, submitting an empty value for a required request parameter not binding an empty string to backing JavaBean</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=kdonald" rel="nofollow">Keith Donald</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7380?redirect=false" rel="nofollow">SPR-7380</a></strong> and commented</p>
<p dir="auto">ParserConverter, which invokes parser.parse(String, Locale) on the Parser/Formatter SPIs maps [null] and "" inputs to [null].  The target Parser is not invoked in this case (and never sees the "" value).</p>
<p dir="auto">This leads to an inconsistency when doing a form binding, where some properties are formatted and others are not.  In the formatted case, empty form fields always result in [null] property values, even if the target property is a String.  In the default case, empty form fields result in empty string "" values when the target property is a String.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.3</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398112227" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12969" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12969/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12969">#12969</a> Formatter subsystem's ParserConverter skips Parser invocation if input string is empty</li>
</ul>