# HG changeset patch # User Mike Becker # Date 1589899805 -7200 # Node ID 9861a68a461234107e5f21f15a318d48926b680b # Parent 0f1746c6abfb3e05d9bb9224f7d1b59f3a98d78d fixes missing orElse() calls diff -r 0f1746c6abfb -r 9861a68a4612 src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Mon May 18 21:08:14 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Tue May 19 16:50:05 2020 +0200 @@ -98,7 +98,8 @@ public ResponseType edit(HttpServletRequest req, DataAccessObjects dao) throws SQLException { final var projectDao = dao.getProjectDao(); - req.setAttribute("project", findByParameter(req, Integer.class, "id", projectDao::find)); + req.setAttribute("project", findByParameter(req, Integer.class, "id", + projectDao::find).orElse(new Project(-1))); setDynamicFragment(req, "project-form"); return ResponseType.HTML; @@ -155,7 +156,8 @@ return ResponseType.NONE; } - req.setAttribute("version", findByParameter(req, Integer.class, "id", dao.getVersionDao()::find)); + req.setAttribute("version", findByParameter(req, Integer.class, "id", + dao.getVersionDao()::find).orElse(new Version(-1, selectedProject))); req.setAttribute("versionStatusEnum", VersionStatus.values()); setDynamicFragment(req, "version-form"); @@ -217,7 +219,8 @@ return ResponseType.NONE; } - req.setAttribute("issue", findByParameter(req, Integer.class, "id", dao.getIssueDao()::find)); + req.setAttribute("issue", findByParameter(req, Integer.class, "id", + dao.getIssueDao()::find).orElse(new Issue(-1, selectedProject))); req.setAttribute("issueStatusEnum", IssueStatus.values()); req.setAttribute("issueCategoryEnum", IssueCategory.values());