precicion has to be a positive value

This commit is contained in:
Noble Paul 2017-05-26 15:08:31 +09:30
parent f4c186c9cb
commit c3aa3f9fa6
1 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,9 @@ class Preference implements MapWriter {
name = Policy.SortParam.get(m.get(sort.name()).toString());
Object p = m.getOrDefault("precision", 0);
precision = p instanceof Number ? ((Number) p).intValue() : Integer.parseInt(p.toString());
if (precision < 0) {
throw new RuntimeException("precision must be a positive value ");
}
}