[ 
https://issues.apache.org/jira/browse/AMQ-9723?focusedWorklogId=971807&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-971807
 ]

ASF GitHub Bot logged work on AMQ-9723:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/25 12:43
            Start Date: 04/Jun/25 12:43
    Worklog Time Spent: 10m 
      Work Description: 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)





Issue Time Tracking
-------------------

    Worklog Id:     (was: 971807)
    Time Spent: 1h  (was: 50m)

> Socket isn't closed in QualityOfServiceUtils
> --------------------------------------------
>
>                 Key: AMQ-9723
>                 URL: https://issues.apache.org/jira/browse/AMQ-9723
>             Project: ActiveMQ Classic
>          Issue Type: Bug
>            Reporter: Dmitrii Kriukov
>            Priority: Minor
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> I will provide a PR



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to