Skip to content

Commit e680875

Browse files
laeubimarcphilipp
andauthored
Apply suggestion from @marcphilipp
Co-authored-by: Marc Philipp <[email protected]>
1 parent 87cd79f commit e680875

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,12 @@ public void testPlanExecutionStarted(TestPlan testPlan) {
148148
private DocumentWriter<Events> createDocumentWriter(ConfigurationParameters config,
149149
NamespaceRegistry namespaceRegistry) throws Exception {
150150
return config.get(SOCKET_PROPERTY_NAME, Integer::valueOf) //
151-
.map(portString -> {
151+
.map(port -> {
152152
try {
153-
int port = Integer.parseInt(portString);
154153
Socket socket = new Socket("localhost", port);
155154
Writer writer = new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8);
156155
return Events.createDocumentWriter(namespaceRegistry, writer);
157156
}
158-
catch (NumberFormatException e) {
159-
throw new JUnitException(
160-
"Invalid port number for socket configuration: " + portString + ". Expected an integer.",
161-
e);
162-
}
163157
catch (Exception e) {
164158
throw new JUnitException("Failed to connect to socket on port " + port, e);
165159
}

0 commit comments

Comments
 (0)