Skip to content

Commit

Permalink
Merge pull request #4807 from QualitativeDataRepository/4800-better_e…
Browse files Browse the repository at this point in the history
…rror_message_on_pid_provider_failure

4800-better_error_meesage_on_pid_provider_failure
  • Loading branch information
kcondon committed Jul 26, 2018
2 parents 20d111e + 1f4e478 commit 8cfca31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ dataset.share.datasetShare.tip=Share this dataset on your favorite social media
dataset.share.datasetShare.shareText=View this dataset.
dataset.locked.message=Dataset Locked
dataset.locked.inReview.message=Submitted for Review
dataset.publish.error=This dataset may not be published because the <a href=\{1} target=\"_blank\"/> {0} </a> Service is currently inaccessible. Please try again. Does the issue continue to persist?
dataset.publish.error=This dataset may not be published due to an error when contacting the <a href=\{1} target=\"_blank\"/> {0} </a> Service. Please try again.
dataset.publish.error.doi=This dataset may not be published because the DOI update failed.
dataset.compute.computeBatchSingle=Compute Dataset
dataset.compute.computeBatchList=List Batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import edu.harvard.iq.dataverse.GlobalIdServiceBean;
Expand Down Expand Up @@ -181,19 +182,22 @@ private void publicizeExternalIdentifier(Dataset dataset, CommandContext ctxt) t
String protocol = getDataset().getProtocol();
GlobalIdServiceBean idServiceBean = GlobalIdServiceBean.getBean(protocol, ctxt);
if ( idServiceBean != null ){
List<String> args = idServiceBean.getProviderInformation();
try {
idServiceBean.publicizeIdentifier(dataset);
//A false return value indicates a failure in calling the service
if(!idServiceBean.publicizeIdentifier(dataset)) throw new Exception();
dataset.setGlobalIdCreateTime(new Date()); // TODO these two methods should be in the responsibility of the idServiceBean.
dataset.setIdentifierRegistered(true);
for (DataFile df : dataset.getFiles()) {
logger.log(Level.FINE, "registering global id for file {0}", df.getId());
idServiceBean.publicizeIdentifier(df);
//A false return value indicates a failure in calling the service
if(!idServiceBean.publicizeIdentifier(df)) throw new Exception();
df.setGlobalIdCreateTime(getTimestamp());
df.setIdentifierRegistered(true);
}
} catch (Throwable e) {
ctxt.datasets().removeDatasetLocks(dataset, DatasetLock.Reason.pidRegister);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", idServiceBean.getProviderInformation()),this);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", args),this);
}
}
}
Expand Down

0 comments on commit 8cfca31

Please sign in to comment.