diff --git a/eidas-middleware/src/main/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiver.java b/eidas-middleware/src/main/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiver.java index 08660212..7b01785b 100644 --- a/eidas-middleware/src/main/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiver.java +++ b/eidas-middleware/src/main/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiver.java @@ -176,8 +176,6 @@ private ModelAndView showErrorPage(String errorMessage) */ private ModelAndView showMiddlewarePage(String sessionId, String userAgent) { - try - { String ausweisappLink; if (isMobileDevice(userAgent)) { @@ -192,17 +190,12 @@ private ModelAndView showMiddlewarePage(String sessionId, String userAgent) String tcTokenURL = requestHandler.getTcTokenURL(sessionId); modelAndView.addObject("tcTokenURL", tcTokenURL); - ausweisappLink = ausweisappLink.concat(URLEncoder.encode(tcTokenURL, StandardCharsets.UTF_8.name())); + ausweisappLink = ausweisappLink.concat(URLEncoder.encode(tcTokenURL, StandardCharsets.UTF_8)); modelAndView.addObject("ausweisapp", ausweisappLink); String linkToSelf = ContextPaths.EIDAS_CONTEXT_PATH + ContextPaths.REQUEST_RECEIVER + "?sessionId=" + sessionId; modelAndView.addObject("linkToSelf", linkToSelf); return modelAndView; - } - catch (UnsupportedEncodingException e) - { - return showErrorPage(e.getMessage()); - } } private ModelAndView showSamlErrorPage(ErrorCodeWithResponseException e, String relayState) diff --git a/eidas-middleware/src/test/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiverTest.java b/eidas-middleware/src/test/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiverTest.java index 57f15206..1aa80312 100644 --- a/eidas-middleware/src/test/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiverTest.java +++ b/eidas-middleware/src/test/java/de/governikus/eumw/eidasmiddleware/controller/RequestReceiverTest.java @@ -69,7 +69,7 @@ void testDoGetShouldReturnLandingPage() throws Exception ModelMap modelMap = landingPage.getModelMap(); Assertions.assertEquals(3, modelMap.size()); Assertions.assertEquals(EID_CLIENT_URL - + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8.name()), + + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8), modelMap.getAttribute("ausweisapp")); Assertions.assertEquals(ContextPaths.EIDAS_CONTEXT_PATH + ContextPaths.REQUEST_RECEIVER + "?sessionId=" + REQUEST_ID, @@ -88,7 +88,7 @@ void testDoGetWithSessionIdShouldReturnLandingPage() throws Exception ModelMap modelMap = landingPage.getModelMap(); Assertions.assertEquals(3, modelMap.size()); Assertions.assertEquals(EID_CLIENT_URL - + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8.name()), + + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8), modelMap.getAttribute("ausweisapp")); Assertions.assertEquals(ContextPaths.EIDAS_CONTEXT_PATH + ContextPaths.REQUEST_RECEIVER + "?sessionId=" + REQUEST_ID, @@ -197,7 +197,7 @@ void testDoPostShouldReturnLandingPage() throws Exception ModelMap modelMap = landingPage.getModelMap(); Assertions.assertEquals(3, modelMap.size()); Assertions.assertEquals(EID_CLIENT_MOBIL_URL - + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8.name()), + + URLEncoder.encode(TC_TOKEN_URL + REQUEST_ID, StandardCharsets.UTF_8), modelMap.getAttribute("ausweisapp")); Assertions.assertEquals(ContextPaths.EIDAS_CONTEXT_PATH + ContextPaths.REQUEST_RECEIVER + "?sessionId=" + REQUEST_ID, diff --git a/eidas-starterkit/src/test/java/de/governikus/eumw/eidasstarterkit/person_attributes/natural_persons_attribute/DateOfBirthAttributeTest.java b/eidas-starterkit/src/test/java/de/governikus/eumw/eidasstarterkit/person_attributes/natural_persons_attribute/DateOfBirthAttributeTest.java index 798e8cc0..d8fff507 100644 --- a/eidas-starterkit/src/test/java/de/governikus/eumw/eidasstarterkit/person_attributes/natural_persons_attribute/DateOfBirthAttributeTest.java +++ b/eidas-starterkit/src/test/java/de/governikus/eumw/eidasstarterkit/person_attributes/natural_persons_attribute/DateOfBirthAttributeTest.java @@ -53,7 +53,7 @@ void testDateOfBirthAttributeString(String testDate) throws Exception ByteArrayOutputStream bout = new ByteArrayOutputStream(); trans.transform(new DOMSource(all), new StreamResult(bout)); - String attrString = new String(bout.toByteArray(), StandardCharsets.UTF_8.name()); + String attrString = bout.toString(StandardCharsets.UTF_8); assertTrue(attrString.contains(testDate)); } }