Changed some boolean checks to use the recommended method of comparing floating point values in Java. (#1075)

This commit is contained in:
Koen De Groote
2017-07-22 13:00:24 +12:00
committed by Rob Bygrave
parent 66138e5ea2
commit bf5a8c2fad
4 changed files with 4 additions and 5 deletions
@@ -1027,7 +1027,7 @@ public final class EntityBeanIntercept implements Serializable {
if (state == STATE_NEW) {
setLoadedProperty(propertyIndex);
} else if (oldValue != newValue) {
} else if (Double.compare(oldValue, newValue) != 0) {
setChangedPropertyValue(propertyIndex, intercept, oldValue);
} else {
return null;
@@ -1042,7 +1042,7 @@ public final class EntityBeanIntercept implements Serializable {
if (state == STATE_NEW) {
setLoadedProperty(propertyIndex);
} else if (oldValue != newValue) {
} else if (Float.compare(oldValue, newValue) != 0) {
setChangedPropertyValue(propertyIndex, intercept, oldValue);
} else {
return null;
@@ -2,7 +2,6 @@ package io.ebeaninternal.server.core;
import io.ebean.QueryIterator;
import io.ebean.Version;
import io.ebean.bean.BeanCollection;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeanservice.docstore.api.DocQueryRequest;
@@ -60,7 +60,7 @@ public class DeployDocPropertyOptions {
}
private void setBoost(float boost) {
if (boost != 1) {
if (Float.compare(boost, 1.0F) != 0) {
mapping.setBoost(boost);
}
}
@@ -229,7 +229,7 @@ public class DocPropertyOptions {
if (docMapping.store()) {
store = true;
}
if (docMapping.boost() != 1) {
if (Float.compare(docMapping.boost(), 1.0F) != 0) {
boost = docMapping.boost();
}
if (!"".equals(docMapping.nullValue())) {