Skip to content

Commit

Permalink
Improve optional usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sven1103 committed Oct 18, 2024
1 parent ff7fd0c commit 6c3c628
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ private Button exportButton() {

private void triggerRoCrateDownload() throws IOException {
ProjectId projectId = context.projectId().orElseThrow();
Optional<Project> project = projectInformationService.find(projectId);
Project project = projectInformationService.find(projectId).orElseThrow();
var tempBuildDir = tempDirectory.createDirectory();
var zippedRoCrateDir = tempDirectory.createDirectory();
try {
var roCrate = roCrateBuilder.projectSummary(project.orElseThrow(), tempBuildDir);
var roCrate = roCrateBuilder.projectSummary(project, tempBuildDir);
var roCrateZipWriter = new RoCrateWriter(new ZipWriter());
var zippedRoCrateFile = zippedRoCrateDir.resolve(
"%s-project-summary-ro-crate.zip".formatted(project.get().getProjectCode().value()));
"%s-project-summary-ro-crate.zip".formatted(project.getProjectCode().value()));
roCrateZipWriter.save(roCrate, zippedRoCrateFile.toString());
remove(downloadProvider);
var cachedZipContent = Files.readAllBytes(zippedRoCrateFile);
Expand Down

0 comments on commit 6c3c628

Please sign in to comment.