Agent Pool accepts -1 port value and throw IllegalArgumentException.
How to reproduce:
1. Start JavaTest and Open Agent Monitor
2. Set port value to negative number (for example, -1)
3. Click on Listening checkbox
The following exception will be thrown:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Port
value out of range: -1
at java.net.ServerSocket.<init>(ServerSocket.java:232)
at java.net.ServerSocket.<init>(ServerSocket.java:181)
at com.sun.javatest.agent.SocketConnection.createServerSocket(SocketConn
ection.java:226)
at com.sun.javatest.agent.SocketConnection.createServerSocket(SocketConn
ection.java:204)
at com.sun.javatest.agent.ActiveAgentPool.setListening(ActiveAgentPool.j
ava:493)
at com.sun.javatest.agent.AgentMonitorTool$AgentPoolSubpanel.itemStateCh
anged(AgentMonitorTool.java:235)
at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2
050)
at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.ja
va:2353)
at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonMode
l.java:455)
at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton
.java:272)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.
java:289)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
89)
at java.awt.Component.processMouseEvent(Component.java:6510)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3323)
at java.awt.Component.processEvent(Component.java:6275)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4866)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4691)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4691)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:216)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:135)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:123)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
How to reproduce:
1. Start JavaTest and Open Agent Monitor
2. Set port value to negative number (for example, -1)
3. Click on Listening checkbox
The following exception will be thrown:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Port
value out of range: -1
at java.net.ServerSocket.<init>(ServerSocket.java:232)
at java.net.ServerSocket.<init>(ServerSocket.java:181)
at com.sun.javatest.agent.SocketConnection.createServerSocket(SocketConn
ection.java:226)
at com.sun.javatest.agent.SocketConnection.createServerSocket(SocketConn
ection.java:204)
at com.sun.javatest.agent.ActiveAgentPool.setListening(ActiveAgentPool.j
ava:493)
at com.sun.javatest.agent.AgentMonitorTool$AgentPoolSubpanel.itemStateCh
anged(AgentMonitorTool.java:235)
at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2
050)
at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.ja
va:2353)
at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonMode
l.java:455)
at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton
.java:272)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.
java:289)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
89)
at java.awt.Component.processMouseEvent(Component.java:6510)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3323)
at java.awt.Component.processEvent(Component.java:6275)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4866)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4691)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4691)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:216)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:135)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:123)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)