diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/TeacherAccountServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/TeacherAccountServiceImpl.java index ae9d447a3..15b6ee4b2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/TeacherAccountServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/TeacherAccountServiceImpl.java @@ -24,7 +24,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.TeacherAccountService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserDAO; -import ch.ethz.seb.sebserver.webservice.servicelayer.session.ExamFinishedEvent; import ch.ethz.seb.sebserver.webservice.servicelayer.session.ScreenProctoringService; import ch.ethz.seb.sebserver.webservice.weblayer.oauth.AdminAPIClientDetails; import io.jsonwebtoken.Claims; @@ -134,7 +133,7 @@ public Result getOneTimeTokenForTeacherAccount( final AdHocAccountData adHocAccountData, final boolean createIfNotExists) { - if (exam.status != Exam.ExamStatus.RUNNING) { + if (exam.status != Exam.ExamStatus.RUNNING && exam.status != Exam.ExamStatus.TEST_RUN) { return Result.ofError(new IllegalStateException("Exam is not running")); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java index fedfa3989..528fed481 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java @@ -648,18 +648,17 @@ public void streamLightExamConfig(final String modelId, final HttpServletRespons response.setStatus(HttpStatus.OK.value()); - }catch(Exception e){ + } catch ( final Exception e ) { final APIMessage errorMessage = APIMessage.ErrorMessage.GENERIC.of(e.getMessage()); outputStream.write(Utils.toByteArray(this.jsonMapper.writeValueAsString(errorMessage))); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); } finally { - try { outputStream.flush(); outputStream.close(); - } catch (IOException e) { + } catch (final IOException e) { log.error("error while flushing / closing output stream", e); } }