Skip to content

Commit

Permalink
Cleaned up messaging; removed some commented out code. #6558
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Apr 14, 2020
1 parent b055cad commit 402a624
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
14 changes: 9 additions & 5 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2055,10 +2055,8 @@ private void displayLockInfo(Dataset dataset) {
if (dataset.isLockedFor(DatasetLock.Reason.FileValidationFailed)) {
// the dataset is locked, because one or more datafiles in it
// failed validation during an attempt to publish it.
if (FacesContext.getCurrentInstance().getExternalContext().getFlash().get("errorMsg") == null) {
JH.addMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.message"),
BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.contactSupport"));
}
JH.addMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.message"),
BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.contactSupport"));
}
if (dataset.isLockedFor(DatasetLock.Reason.EditInProgress)) {
String rootDataverseName = dataverseService.findRootDataverse().getName();
Expand Down Expand Up @@ -2578,7 +2576,13 @@ private String releaseDataset(boolean minor) {
}

} catch (CommandException ex) {
JsfHelper.addErrorMessage(ex.getLocalizedMessage());
Dataset testDs = datasetService.find(dataset.getId());
if (testDs != null && !testDs.isLockedFor(DatasetLock.Reason.FileValidationFailed)) {
// If the dataset could not be published because it has failed
// physical file validation, the messaging will be handled via
// the lock info system.
JsfHelper.addErrorMessage(ex.getLocalizedMessage());
}
logger.severe(ex.getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,6 @@ private void validateDataFiles(Dataset dataset, CommandContext ctxt) throws Comm
// the error message for the user.
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.details"), this);
}

/*
* for debugging only: (TODO: remove before making the final PR)
logger.log(Level.INFO,"Validation successful; but throwing an exception anyway, for testing purposes");
if (dataset.isLockedFor(DatasetLock.Reason.finalizePublication)) {
DatasetLock workflowLock = dataset.getLockFor(DatasetLock.Reason.finalizePublication);
workflowLock.setInfo(FILE_VALIDATION_ERROR);
ctxt.datasets().updateDatasetLock(workflowLock);
}
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.details"), this);
*/
}

private void publicizeExternalIdentifier(Dataset dataset, CommandContext ctxt) throws CommandException {
Expand Down

0 comments on commit 402a624

Please sign in to comment.