Skip to content

Commit

Permalink
exception for lock failures
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Nov 6, 2024
1 parent 898d8c6 commit 4fd710b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ public DatasetLock addDatasetLock(Long datasetId, DatasetLock.Reason reason, Lon
// (to prevent multiple, duplicate locks on the dataset!)
DatasetLock lock = dataset.getLockFor(reason);
if (lock != null) {
return lock;
//return lock;
return null;
}

// Create new:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import edu.harvard.iq.dataverse.engine.command.DataverseRequest;
import edu.harvard.iq.dataverse.engine.command.RequiredPermissions;
import edu.harvard.iq.dataverse.engine.command.exception.CommandException;
import edu.harvard.iq.dataverse.engine.command.exception.CommandExecutionException;
import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException;
import edu.harvard.iq.dataverse.util.DatasetFieldUtil;
import edu.harvard.iq.dataverse.util.FileMetadataUtil;
Expand Down Expand Up @@ -147,6 +148,7 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
theDataset.addLock(lock);
} else {
logger.log(Level.WARNING, "Failed to lock the dataset (dataset id={0})", getDataset().getId());
throw new CommandExecutionException("Failed to acquire lock on dataset", this);
}

editVersion.setDatasetFields(editVersion.initDatasetFields());
Expand Down

0 comments on commit 4fd710b

Please sign in to comment.