@@ -159,10 +159,10 @@ public void windowClosed(WindowEvent e) {
159
159
public void stateChanged (ChangeEvent e ) {
160
160
if (loadPanel .equals (tabbedPane .getSelectedComponent ())) {
161
161
String text = targetHostNameField .getText ();
162
- if (text == null || text .length () == 0 )
162
+ if (text == null || text .isEmpty () )
163
163
targetHostNameField .setText (proxyHostNameField .getText ());
164
164
text = targetPortField .getText ();
165
- if (text == null || text .length () == 0 )
165
+ if (text == null || text .isEmpty () )
166
166
targetPortField .setText (proxyPortField .getText ());
167
167
}
168
168
}
@@ -172,8 +172,8 @@ public void stateChanged(ChangeEvent e) {
172
172
private JPanel createClientControlPanel () {
173
173
final JPanel controlPanel = new JPanel ();
174
174
GridBagLayout gridBagLayout = new GridBagLayout ();
175
- gridBagLayout .columnWidths = new int [] { 7 , 0 , 7 , 0 , 7 , 0 , 7 , 7 , 0 , 0 , 7 };
176
- gridBagLayout .rowHeights = new int [] { 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 };
175
+ gridBagLayout .columnWidths = new int [] {7 , 0 , 7 , 0 , 7 , 0 , 7 , 7 , 0 , 0 , 7 };
176
+ gridBagLayout .rowHeights = new int [] {0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 };
177
177
controlPanel .setLayout (gridBagLayout );
178
178
179
179
JLabel label = new JLabel ();
@@ -279,7 +279,7 @@ private JPanel createClientControlPanel() {
279
279
controlPanel .add (sessionTimeoutLabel , gridBagConstraints );
280
280
281
281
sessionTimeoutField = new JTextField ();
282
- sessionTimeoutField .setText (String . valueOf ( DEFAULT_SESSION_TIMEOUT ) );
282
+ sessionTimeoutField .setText (DEFAULT_SESSION_TIMEOUT );
283
283
sessionTimeoutField .setEnabled (destroySessionField .isSelected ());
284
284
gridBagConstraints = new GridBagConstraints ();
285
285
gridBagConstraints .gridy = 4 ;
@@ -382,8 +382,8 @@ public void actionPerformed(final ActionEvent e) {
382
382
controlPanel .add (statusPanel , gridBagConstraints );
383
383
384
384
gridBagLayout = new GridBagLayout ();
385
- gridBagLayout .columnWidths = new int [] { 0 , 0 , 7 };
386
- gridBagLayout .rowHeights = new int [] { 0 , 7 , 0 , 0 };
385
+ gridBagLayout .columnWidths = new int [] {0 , 0 , 7 };
386
+ gridBagLayout .rowHeights = new int [] {0 , 7 , 0 , 0 };
387
387
statusPanel .setLayout (gridBagLayout );
388
388
389
389
label = new JLabel ();
@@ -405,7 +405,7 @@ public void actionPerformed(final ActionEvent e) {
405
405
statusPanel .add (label , gridBagConstraints );
406
406
407
407
totalClientsLabel = new JLabel ();
408
- totalClientsLabel .setText (String . valueOf ( "0" ) );
408
+ totalClientsLabel .setText ("0" );
409
409
gridBagConstraints = new GridBagConstraints ();
410
410
gridBagConstraints .gridy = 2 ;
411
411
gridBagConstraints .gridx = 3 ;
@@ -421,7 +421,7 @@ public void actionPerformed(final ActionEvent e) {
421
421
statusPanel .add (label , gridBagConstraints );
422
422
423
423
liveClientsLabel = new JLabel ();
424
- liveClientsLabel .setText (String . valueOf ( "0" ) );
424
+ liveClientsLabel .setText ("0" );
425
425
gridBagConstraints = new GridBagConstraints ();
426
426
gridBagConstraints .gridy = 3 ;
427
427
gridBagConstraints .gridx = 3 ;
@@ -437,7 +437,7 @@ public void actionPerformed(final ActionEvent e) {
437
437
statusPanel .add (label , gridBagConstraints );
438
438
439
439
failedClientsLabel = new JLabel ();
440
- failedClientsLabel .setText (String . valueOf ( "0" ) );
440
+ failedClientsLabel .setText ("0" );
441
441
gridBagConstraints = new GridBagConstraints ();
442
442
gridBagConstraints .gridy = 4 ;
443
443
gridBagConstraints .gridx = 3 ;
@@ -450,8 +450,8 @@ public void actionPerformed(final ActionEvent e) {
450
450
private JPanel createServerLoadControlPanel () {
451
451
final JPanel loadPanel = new JPanel ();
452
452
GridBagLayout gridBagLayout = new GridBagLayout ();
453
- gridBagLayout .columnWidths = new int [] { 7 , 0 , 7 , 0 , 7 , 0 , 7 , 7 , 0 , 0 , 7 };
454
- gridBagLayout .rowHeights = new int [] { 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 };
453
+ gridBagLayout .columnWidths = new int [] {7 , 0 , 7 , 0 , 7 , 0 , 7 , 7 , 0 , 0 , 7 };
454
+ gridBagLayout .rowHeights = new int [] {0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 };
455
455
loadPanel .setLayout (gridBagLayout );
456
456
457
457
JLabel label = new JLabel ();
@@ -603,8 +603,8 @@ public void actionPerformed(final ActionEvent e) {
603
603
private JPanel createRequestBalancingPanel () {
604
604
final JPanel requestBalancingPanel = new JPanel ();
605
605
GridBagLayout gridBagLayout = new GridBagLayout ();
606
- gridBagLayout .columnWidths = new int [] { 0 };
607
- gridBagLayout .rowHeights = new int [] { 0 , 0 };
606
+ gridBagLayout .columnWidths = new int [] {0 };
607
+ gridBagLayout .rowHeights = new int [] {0 , 0 };
608
608
requestBalancingPanel .setLayout (gridBagLayout );
609
609
610
610
final JPanel requestChart = new ChartPanel (this .chartManager .getRequestBalancingChart (), true );
@@ -618,8 +618,8 @@ private JPanel createRequestBalancingPanel() {
618
618
619
619
JPanel clientStatusPanel = new JPanel ();
620
620
gridBagLayout = new GridBagLayout ();
621
- gridBagLayout .columnWidths = new int [] { 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 };
622
- gridBagLayout .rowHeights = new int [] { 7 , 0 };
621
+ gridBagLayout .columnWidths = new int [] {7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 };
622
+ gridBagLayout .rowHeights = new int [] {7 , 0 };
623
623
clientStatusPanel .setLayout (gridBagLayout );
624
624
625
625
gridBagConstraints = new GridBagConstraints ();
@@ -638,7 +638,7 @@ private JPanel createRequestBalancingPanel() {
638
638
clientStatusPanel .add (label , gridBagConstraints );
639
639
640
640
totalClientsLabelReq = new JLabel ();
641
- totalClientsLabelReq .setText (String . valueOf ( "0" ) );
641
+ totalClientsLabelReq .setText ("0" );
642
642
gridBagConstraints = new GridBagConstraints ();
643
643
gridBagConstraints .gridy = 0 ;
644
644
gridBagConstraints .gridx = 3 ;
@@ -654,7 +654,7 @@ private JPanel createRequestBalancingPanel() {
654
654
clientStatusPanel .add (label , gridBagConstraints );
655
655
656
656
liveClientsLabelReq = new JLabel ();
657
- liveClientsLabelReq .setText (String . valueOf ( "0" ) );
657
+ liveClientsLabelReq .setText ("0" );
658
658
gridBagConstraints = new GridBagConstraints ();
659
659
gridBagConstraints .gridy = 0 ;
660
660
gridBagConstraints .gridx = 7 ;
@@ -670,7 +670,7 @@ private JPanel createRequestBalancingPanel() {
670
670
clientStatusPanel .add (label , gridBagConstraints );
671
671
672
672
failedClientsLabelReq = new JLabel ();
673
- failedClientsLabelReq .setText (String . valueOf ( "0" ) );
673
+ failedClientsLabelReq .setText ("0" );
674
674
gridBagConstraints = new GridBagConstraints ();
675
675
gridBagConstraints .gridy = 0 ;
676
676
gridBagConstraints .gridx = 11 ;
@@ -683,8 +683,8 @@ private JPanel createRequestBalancingPanel() {
683
683
private JPanel createSessionBalancingPanel () {
684
684
final JPanel sessionBalancingPanel = new JPanel ();
685
685
GridBagLayout gridBagLayout = new GridBagLayout ();
686
- gridBagLayout .columnWidths = new int [] { 0 };
687
- gridBagLayout .rowHeights = new int [] { 0 , 0 };
686
+ gridBagLayout .columnWidths = new int [] {0 };
687
+ gridBagLayout .rowHeights = new int [] {0 , 0 };
688
688
sessionBalancingPanel .setLayout (gridBagLayout );
689
689
690
690
JPanel sessionBalancingChart = new ChartPanel (this .chartManager .getSessionBalancingChart (), true );
@@ -699,8 +699,8 @@ private JPanel createSessionBalancingPanel() {
699
699
700
700
JPanel clientStatusPanel = new JPanel ();
701
701
gridBagLayout = new GridBagLayout ();
702
- gridBagLayout .columnWidths = new int [] { 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 };
703
- gridBagLayout .rowHeights = new int [] { 7 , 0 };
702
+ gridBagLayout .columnWidths = new int [] {7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 , 0 , 7 };
703
+ gridBagLayout .rowHeights = new int [] {7 , 0 };
704
704
clientStatusPanel .setLayout (gridBagLayout );
705
705
706
706
gridBagConstraints = new GridBagConstraints ();
@@ -719,7 +719,7 @@ private JPanel createSessionBalancingPanel() {
719
719
clientStatusPanel .add (label , gridBagConstraints );
720
720
721
721
totalClientsLabelSess = new JLabel ();
722
- totalClientsLabelSess .setText (String . valueOf ( "0" ) );
722
+ totalClientsLabelSess .setText ("0" );
723
723
gridBagConstraints = new GridBagConstraints ();
724
724
gridBagConstraints .gridy = 0 ;
725
725
gridBagConstraints .gridx = 3 ;
@@ -735,7 +735,7 @@ private JPanel createSessionBalancingPanel() {
735
735
clientStatusPanel .add (label , gridBagConstraints );
736
736
737
737
liveClientsLabelSess = new JLabel ();
738
- liveClientsLabelSess .setText (String . valueOf ( "0" ) );
738
+ liveClientsLabelSess .setText ("0" );
739
739
gridBagConstraints = new GridBagConstraints ();
740
740
gridBagConstraints .gridy = 0 ;
741
741
gridBagConstraints .gridx = 7 ;
@@ -751,7 +751,7 @@ private JPanel createSessionBalancingPanel() {
751
751
clientStatusPanel .add (label , gridBagConstraints );
752
752
753
753
failedClientsLabelSess = new JLabel ();
754
- failedClientsLabelSess .setText (String . valueOf ( "0" ) );
754
+ failedClientsLabelSess .setText ("0" );
755
755
gridBagConstraints = new GridBagConstraints ();
756
756
gridBagConstraints .gridy = 0 ;
757
757
gridBagConstraints .gridx = 11 ;
@@ -770,7 +770,7 @@ private JPanel createSessionBalancingPanel() {
770
770
private void start () {
771
771
String sessionTimeoutText = sessionTimeoutField .getText ();
772
772
int sessionTimeout = -1 ;
773
- if (sessionTimeoutText != null && sessionTimeoutText .trim ().length () > 0 ) {
773
+ if (sessionTimeoutText != null && ! sessionTimeoutText .trim ().isEmpty () ) {
774
774
try {
775
775
sessionTimeout = Integer .parseInt (sessionTimeoutText );
776
776
} catch (NumberFormatException e ) {
@@ -787,7 +787,7 @@ private void start() {
787
787
requestURL = new URL (tmp );
788
788
destroyURL = new URL (tmp + "?destroy=true" );
789
789
} else {
790
- String timeoutParam = (sessionTimeout > 0 ) ? "?timeout=" + String . valueOf ( sessionTimeout ) : "" ;
790
+ String timeoutParam = (sessionTimeout > 0 ) ? "?timeout=" + sessionTimeout : "" ;
791
791
requestURL = new URL (tmp + timeoutParam );
792
792
destroyURL = requestURL ;
793
793
}
@@ -798,25 +798,25 @@ private void start() {
798
798
799
799
int num_threads = DEFAULT_NUM_THREADS ;
800
800
String numT = numThreadsField .getText ();
801
- if (numT != null && numT .trim ().length () > 0 ) {
801
+ if (numT != null && ! numT .trim ().isEmpty () ) {
802
802
num_threads = Integer .parseInt (numT );
803
803
}
804
804
805
805
int session_life = DEFAULT_SESSION_LIFE ;
806
806
String sessL = sessionLifeField .getText ();
807
- if (sessL != null && sessL .trim ().length () > 0 ) {
807
+ if (sessL != null && ! sessL .trim ().isEmpty () ) {
808
808
session_life = Integer .parseInt (sessL );
809
809
}
810
810
811
811
int sleep_time = DEFAULT_SLEEP_TIME ;
812
812
String sleepT = sleepTimeField .getText ();
813
- if (sleepT != null && sleepT .trim ().length () > 0 ) {
813
+ if (sleepT != null && ! sleepT .trim ().isEmpty () ) {
814
814
sleep_time = Integer .parseInt (sleepT );
815
815
}
816
816
817
817
int startup_time = DEFAULT_STARTUP_TIME ;
818
818
String startT = startupTimeField .getText ();
819
- if (startT != null && startT .trim ().length () > 0 ) {
819
+ if (startT != null && ! startT .trim ().isEmpty () ) {
820
820
startup_time = Integer .parseInt (startT );
821
821
}
822
822
@@ -842,7 +842,7 @@ private void createLoad() {
842
842
String tmp = createBaseURL (targetHostNameField .getText (), targetPortField .getText ())
843
843
+ selectedLoadServlet .getServletPath ();
844
844
List <ServerLoadParam > params = selectedLoadServlet .getParams ();
845
- if (params .size () > 0 ) {
845
+ if (! params .isEmpty () ) {
846
846
String val = targetServletParamField1 .getText ();
847
847
params .get (0 ).setValue (val );
848
848
tmp += "?" + params .get (0 ).getName () + "=" + val ;
@@ -887,17 +887,17 @@ public void run() {
887
887
}
888
888
889
889
private String createBaseURL (String hostText , String portText ) {
890
- if (portText == null || portText .trim ().length () == 0 )
890
+ if (portText == null || portText .trim ().isEmpty () )
891
891
portText = "80" ;
892
892
portText = portText .trim ();
893
893
894
894
String contextPath = contextPathField .getText ();
895
895
if (contextPath == null )
896
896
contextPath = "" ;
897
897
contextPath = contextPath .trim ();
898
- if (contextPath .length () > 0 && '/' == contextPath .charAt (0 ))
898
+ if (! contextPath .isEmpty () && '/' == contextPath .charAt (0 ))
899
899
contextPath = contextPath .length () == 1 ? "" : contextPath .substring (1 );
900
- if (contextPath .length () > 0 && '/' == contextPath .charAt (contextPath .length () - 1 ))
900
+ if (! contextPath .isEmpty () && '/' == contextPath .charAt (contextPath .length () - 1 ))
901
901
contextPath = contextPath .length () == 1 ? "" : contextPath .substring (0 , contextPath .length () - 1 );
902
902
903
903
return "http://" + hostText + ":" + portText + "/" + contextPath + "/" ;
@@ -938,7 +938,7 @@ private class ServerLoadServletCellRenderer extends JLabel implements ListCellRe
938
938
@ Override
939
939
public Component getListCellRendererComponent (JList <? extends ServerLoadServlets > list , ServerLoadServlets value , int index , boolean isSelected , boolean cellHasFocus ) {
940
940
this .setText (value .toString ());
941
- this .setToolTipText ((( ServerLoadServlets ) value ) .getDescription ());
941
+ this .setToolTipText (value .getDescription ());
942
942
return this ;
943
943
}
944
944
}
0 commit comments