File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/test/java/com/rabbitmq/perf/it Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -113,13 +113,21 @@ public static void closeAllConnections() throws IOException {
113113
114114 public static List <ConnectionInfo > listConnections () throws IOException {
115115 String output = capture (rabbitmqctl ("list_connections -q pid peer_port" ).getInputStream ());
116+ // output (header line presence depends on broker version):
117+ // pid peer_port
118+ 116119 String [] allLines = output .split ("\n " );
117120
118121 ArrayList <ConnectionInfo > result = new ArrayList <ConnectionInfo >();
119122 for (String line : allLines ) {
120123 // line: <[email protected] > 58713 121124 String [] columns = line .split ("\t " );
122- result .add (new ConnectionInfo (columns [0 ], Integer .valueOf (columns [1 ])));
125+ // can be also header line, so ignoring NumberFormatException
126+ try {
127+ result .add (new ConnectionInfo (columns [0 ], Integer .valueOf (columns [1 ])));
128+ } catch (NumberFormatException e ) {
129+ // OK
130+ }
123131 }
124132 return result ;
125133 }
You can’t perform that action at this time.
0 commit comments