Skip to content

Commit dc1aa18

Browse files
committed
Merge pull request #856 from ohmage/ohmage-2.16
merge min/max validation to user_setup branch
2 parents bf4f4cf + 135248a commit dc1aa18

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ web/WEB-INF/properties/system.properties
88
thirdparty
99
/nbproject/
1010
.settings
11+
.ant-targets-build.xml

src/org/ohmage/domain/campaign/prompt/BoundedPrompt.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public BoundedPrompt(
142142
}
143143
this.max = max;
144144

145+
// max has to be >= min
146+
if (this.max.compareTo(this.min) < 0) {
147+
throw new DomainException("The max value (" +this.max + ") is less than the min value (" + this.min + ")");
148+
}
149+
145150
// Validate the default value.
146151
if(defaultValue != null) {
147152
if(mustBeWholeNumber() && (! isWholeNumber(defaultValue))) {
@@ -152,7 +157,7 @@ public BoundedPrompt(
152157
else if(defaultValue.compareTo(min) < 0) {
153158
throw
154159
new DomainException(
155-
"The default value is greater than the minimum " +
160+
"The default value is smaller than the minimum " +
156161
"value (" +
157162
min +
158163
"): " +

0 commit comments

Comments
 (0)