Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.flowable.engine.impl.cmd;

import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.impl.db.IdBlock;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
Expand All @@ -33,7 +34,15 @@ public GetNextIdBlockCmd(int idBlockSize) {
@Override
public IdBlock execute(CommandContext commandContext) {
PropertyEntity property = (PropertyEntity) CommandContextUtil.getPropertyEntityManager(commandContext).findById("next.dbid");
long oldValue = Long.parseLong(property.getValue());
if (property == null) {
throw new FlowableException("Property 'next.dbid' not found. Database may not have been properly initialized.");
}
long oldValue;
try {
oldValue = Long.parseLong(property.getValue());
} catch (NumberFormatException e) {
throw new FlowableException("Invalid value for property 'next.dbid': " + property.getValue(), e);
}
long newValue = oldValue + idBlockSize;
property.setValue(Long.toString(newValue));
return new IdBlock(oldValue, newValue - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.activiti.engine.impl.cmd;

import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.db.IdBlock;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
Expand All @@ -34,7 +35,15 @@ public IdBlock execute(CommandContext commandContext) {
PropertyEntity property = commandContext
.getPropertyEntityManager()
.findPropertyById("next.dbid");
long oldValue = Long.parseLong(property.getValue());
if (property == null) {
throw new ActivitiException("Property 'next.dbid' not found. Database may not have been properly initialized.");
}
long oldValue;
try {
oldValue = Long.parseLong(property.getValue());
} catch (NumberFormatException e) {
throw new ActivitiException("Invalid value for property 'next.dbid': " + property.getValue(), e);
}
long newValue = oldValue + idBlockSize;
property.setValue(Long.toString(newValue));
return new IdBlock(oldValue, newValue - 1);
Expand Down