Skip to content

Commit 17971cf

Browse files
author
Clifford W. Johnson
committed
Permit missing short command
When used on Windows, it is possible for NetStat to observe ports for which the short command is missing. This commit corrects the resulting failure.
1 parent 799018f commit 17971cf

File tree

1 file changed

+4
-1
lines changed
  • port-chooser/src/main/java/org/terracotta/utilities/test/net

1 file changed

+4
-1
lines changed

port-chooser/src/main/java/org/terracotta/utilities/test/net/NetStat.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,10 @@ private static BusyPort parseWindowsCsv(String line) {
498498
builder.localEndpoint(BusyPort.IPVersion.IPV4, fields.get(1), fields.get(2));
499499
builder.remoteEndpoint(BusyPort.IPVersion.IPV4, fields.get(3), fields.get(4));
500500
builder.state(BusyPort.TcpState.fromMicrosoftString(fields.get(5)));
501-
builder.shortCommand(fields.get(6));
501+
// The short command may be missing
502+
if (fields.size() >= 7) {
503+
builder.shortCommand(fields.get(6));
504+
}
502505
// The full command line may be missing ...
503506
if (fields.size() >= 8) {
504507
builder.commandLine(fields.get(7));

0 commit comments

Comments
 (0)