<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=yatesco" rel="nofollow">Colin Yates</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-1993?redirect=false" rel="nofollow">SPR-1993</a></strong> and commented</p>
<p dir="auto">IIRC calling RequestUtils.getStringParameter() for a request parameter which had no value would return "".  In Spring 2.0M4 it throws a BindingException.  This is wrong IMHO :) because there is an explicit getRequiredStringParameter, the implication being that getStringParameter will handle empty parameters as well as missing parameters.</p>
<p dir="auto">Stack trace:</p>
<p dir="auto">org.springframework.web.bind.ServletRequestBindingException: Required string parameter 'password' contains no value<br>
at org.springframework.web.bind.ServletRequestUtils$ParameterParser.validateRequiredParameter(ServletRequestUtils.java:530)<br>
at org.springframework.web.bind.ServletRequestUtils$StringParser.validateRequiredString(ServletRequestUtils.java:678)<br>
at org.springframework.web.bind.ServletRequestUtils.getRequiredStringParameter(ServletRequestUtils.java:492)<br>
at org.springframework.web.bind.ServletRequestUtils.getStringParameter(ServletRequestUtils.java:449)</p>
<p dir="auto">Use case: I have a form which allows a user to enter a password, that password may be null, or it may be empty, it seems acceptable to me that I should be able to do:</p>
<p dir="auto">String password = ServletRequestUtils.getStringParameter(request, PASSWORD_PARAM);<br>
if (!StringUtils.hasLength(password)) {</p>
<p dir="auto">}</p>
<p dir="auto">Thanks.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0 M4</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="398065991" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/6695" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/6695/hovercard" href="https://github.com/spring-projects/spring-framework/issues/6695">#6695</a> Unexpected results from ServletRequestUtils.getStringParameters when parameter has empty String (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398078349" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8212" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8212/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8212">#8212</a> Bug in ServletRequestUtils getStringParameter</li>
</ul>
<p dir="auto">2 votes, 3 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=paul4christ79" rel="nofollow">Paul Benedict</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6162?redirect=false" rel="nofollow">SPR-6162</a></strong> and commented</p>
<p dir="auto">Our team had two different context files with two bean definitions named the same. Truth be told, one developer didn't know another his other teammate already defined it elsewhere. Because bean definition classes weren't identical, the auto-wiring was failing (for apparently confounding reasons), and it took a while to track down what was going on.</p>
<p dir="auto">Now &lt;beans&gt; already has <code class="notranslate">@default-merge</code>, but what about a new <code class="notranslate">@default-override</code> to stop this kind of "gotcha"? A duplicate should fail the context load. We found the override message in our log file eventually, but it was at INFO (we think it should be WARN). In any event, the default of <code class="notranslate">@default-override</code> should be "true" to retain backwards compatibility.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6</p>
<p dir="auto">1 votes, 1 watchers</p>