cshannon commented on code in PR #1449: URL: https://github.com/apache/activemq/pull/1449#discussion_r2126499326
########## activemq-client/src/main/java/org/apache/activemq/transport/tcp/QualityOfServiceUtils.java: ########## @@ -125,15 +126,17 @@ private static int adjustDSCPForECN(int dscp) // The only way to see if there are any values set for the ECN is to // read the traffic class automatically set by the system and isolate // the ECN bits. - Socket socket = new Socket(); - try { + try (Socket socket = new Socket()) { int systemTrafficClass = socket.getTrafficClass(); // The 1st and 2nd bits of the system traffic class are the ECN // bits. return (dscp << 2) | (systemTrafficClass & 3); } catch (SocketException e) { throw new IllegalArgumentException("Setting Differentiated Services" + " not supported: " + e); + } catch (IOException e) { Review Comment: I don't think IAE makes sense, there should be a different exception as it's not an illegal argument so it's a misleading exception to throw. If the goal is to simply make the exception unchecked then the best thing to do is just wrap it in [UncheckedIOException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/UncheckedIOException.html) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact