mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#963 - NullPointerException on no version provided (when setVersion(null) is used)
This commit is contained in:
@@ -29,6 +29,9 @@ public class GeneratedCounter implements GeneratedProperty {
|
||||
@Override
|
||||
public Object getUpdateValue(BeanProperty prop, EntityBean bean, long now) {
|
||||
Number currVal = (Number) prop.getValue(bean);
|
||||
if (currVal == null) {
|
||||
throw new IllegalStateException("version property has been set to null on bean: " + bean);
|
||||
}
|
||||
Integer nextVal = currVal.intValue() + 1;
|
||||
return BasicTypeConverter.convert(nextVal, numberType);
|
||||
}
|
||||
|
||||
+5
-2
@@ -25,8 +25,11 @@ public class GeneratedCounterInteger implements GeneratedProperty {
|
||||
*/
|
||||
@Override
|
||||
public Object getUpdateValue(BeanProperty prop, EntityBean bean, long now) {
|
||||
Integer i = (Integer) prop.getValue(bean);
|
||||
return i + 1;
|
||||
Integer val = (Integer) prop.getValue(bean);
|
||||
if (val == null) {
|
||||
throw new IllegalStateException("version property has been set to null on bean: " + bean);
|
||||
}
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-2
@@ -25,8 +25,11 @@ public class GeneratedCounterLong implements GeneratedProperty {
|
||||
*/
|
||||
@Override
|
||||
public Object getUpdateValue(BeanProperty prop, EntityBean bean, long now) {
|
||||
Long i = (Long) prop.getValue(bean);
|
||||
return i + 1;
|
||||
Long val = (Long) prop.getValue(bean);
|
||||
if (val == null) {
|
||||
throw new IllegalStateException("version property has been set to null on bean: " + bean);
|
||||
}
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user