RFR: 7903730: Enhance the agentvm to be tolerant to unexpected connection on the port the Agent listens on for handshake with the AgentServer [v3]
Mark Sheppard
msheppar at openjdk.org
Thu May 23 16:02:21 UTC 2024
On Thu, 23 May 2024 15:52:54 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> src/share/classes/com/sun/javatest/regtest/exec/Agent.java line 266:
>>
>>> 264: }
>>> 265: // we don't read more than handshake bytes in this method
>>> 266: assert totalRead <= JTREG_AGENT_HANDSHAKE_MAGIC.length : "unexpected number of handshake" +
>>
>> slight contradiction on the assert with the if condition on the following line
>> do you need an assert her with condition on the next line
>> I find them anomalous, if a condition is worth testing and appropriate put it in an if statement.
>
> It would be an error if totalRead was > JTREG_AGENT_MAGIC.length: according to the logic of the code that reads the magic that cannot happen, ever. Hence the assert.
right ... asserts are conditional on being enabled ... if the condition is a valid test then handled it properly and gracefully in the code not with a conditional abort
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/195#discussion_r1611955803
More information about the jtreg-dev
mailing list