Revision: 1454
http://stripes.svn.sourceforge.net/stripes/?rev=1454&view=rev
Author: bengunter
Date: 2011-12-02 18:41:26 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Fixed STS-845: Integer encrypted fields may throw a NPE. Encrypted values are
now decrypted during required-field validation. If the submitted value cannot
be decrypted it will be treated as null, the standard validation error will be
added, and the type converter will not be called.
Modified Paths:
--------------
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DefaultActionBeanPropertyBinder.java
Modified:
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DefaultActionBeanPropertyBinder.java
===================================================================
---
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DefaultActionBeanPropertyBinder.java
2011-12-02 17:07:55 UTC (rev 1453)
+++
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DefaultActionBeanPropertyBinder.java
2011-12-02 18:41:26 UTC (rev 1454)
@@ -488,6 +488,15 @@
// in the set of fields that were on the page
if (!wizard || fieldsOnPage.contains(propertyName)) {
String[] values =
trim(request.getParameterValues(propertyName), validationInfo);
+
+ // Decrypt encrypted fields before checking for null
+ if (validationInfo.encrypted()) {
+ for (int i = 0, n = values.length; i < n; i++) {
+ if (values[i] != null)
+ values[i] = CryptoUtil.decrypt(values[i]);
+ }
+ }
+
log.debug("Checking required field: ", propertyName,
", with values: ", values);
checkSingleRequiredField(propertyName, propertyName,
values, stripesReq, errors);
}
@@ -579,7 +588,7 @@
}
else {
for (String value : values) {
- if (value.length() == 0) {
+ if (value == null || value.length() == 0) {
ValidationError error = new
ScopedLocalizableError("validation.required",
"valueNotPresent");
error.setFieldValue(value);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development