You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2016/12/21 16:06:45 UTC

svn commit: r1775482 - in /jmeter/trunk/src/components/org/apache/jmeter/assertions/gui: SizeAssertionGui.java XMLConfPanel.java XMLSchemaAssertionGUI.java XPathPanel.java

Author: pmouawad
Date: Wed Dec 21 16:06:45 2016
New Revision: 1775482

URL: http://svn.apache.org/viewvc?rev=1775482&view=rev
Log:
Sonar : Fix code smells
Use Java8 lambda

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLConfPanel.java
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLSchemaAssertionGUI.java
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java?rev=1775482&r1=1775481&r2=1775482&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java Wed Dec 21 16:06:45 2016
@@ -58,8 +58,12 @@ public class SizeAssertionGui extends Ab
 
     private JTextField size;
 
-    private JRadioButton equalButton, notequalButton, greaterthanButton, lessthanButton, greaterthanequalButton,
-            lessthanequalButton;
+    private JRadioButton equalButton;
+    private JRadioButton notequalButton;
+    private JRadioButton greaterthanButton;
+    private JRadioButton lessthanButton;
+    private JRadioButton greaterthanequalButton;
+    private JRadioButton lessthanequalButton;
 
     private int execState; // store the operator
 

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLConfPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLConfPanel.java?rev=1775482&r1=1775481&r2=1775482&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLConfPanel.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLConfPanel.java Wed Dec 21 16:06:45 2016
@@ -18,9 +18,6 @@
 
 package org.apache.jmeter.assertions.gui;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
 import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.JCheckBox;
@@ -33,7 +30,10 @@ import org.apache.jmeter.util.JMeterUtil
 public class XMLConfPanel extends JPanel {
     private static final long serialVersionUID = 240L;
 
-    private JCheckBox validate, tolerant, whitespace, namespace;
+    private JCheckBox validate;
+    private JCheckBox tolerant;
+    private JCheckBox whitespace;
+    private JCheckBox namespace;
 
     private JCheckBox quiet; // Should Tidy be quiet?
 
@@ -59,12 +59,7 @@ public class XMLConfPanel extends JPanel
         whitespace = new JCheckBox(JMeterUtils.getResString("xml_whitespace_button")); //$NON-NLS-1$
         validate = new JCheckBox(JMeterUtils.getResString("xml_validate_button")); //$NON-NLS-1$
         tolerant = new JCheckBox(JMeterUtils.getResString("xml_tolerant_button")); //$NON-NLS-1$
-        tolerant.addActionListener(new ActionListener(){
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                tolerant();
-            }
-        });
+        tolerant.addActionListener(e -> tolerant());
         downloadDTDs = new JCheckBox(JMeterUtils.getResString("xml_download_dtds")); //$NON-NLS-1$
         Box tidyOptions = Box.createHorizontalBox();
         tidyOptions.setBorder(BorderFactory.createEtchedBorder());

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLSchemaAssertionGUI.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLSchemaAssertionGUI.java?rev=1775482&r1=1775481&r2=1775482&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLSchemaAssertionGUI.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XMLSchemaAssertionGUI.java Wed Dec 21 16:06:45 2016
@@ -18,12 +18,12 @@
 
 package org.apache.jmeter.assertions.gui;
 
+
 import java.awt.BorderLayout;
 import javax.swing.BorderFactory;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
-// import javax.swing.event.ChangeEvent;
 import org.apache.jmeter.assertions.XMLSchemaAssertion;
 import org.apache.jmeter.gui.util.HorizontalPanel;
 import org.apache.jmeter.gui.util.VerticalPanel;
@@ -32,13 +32,10 @@ import org.apache.jmeter.util.JMeterUtil
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
-// See Bug 34383
-
 /**
- * XMLSchemaAssertionGUI.java author <a href="mailto:d.maung@mdl.com">Dave Maung</a>
+ * XMLSchemaAssertionGUI.java
  *
  */
-
 public class XMLSchemaAssertionGUI extends AbstractAssertionGui {
     // class attributes
      private static final Logger log = LoggingManager.getLoggerForClass();
@@ -137,9 +134,4 @@ public class XMLSchemaAssertionGUI exten
         mainPanel.add(assertionPanel, BorderLayout.NORTH);
         add(mainPanel, BorderLayout.CENTER);
     }
-
-    // public void stateChanged(ChangeEvent e) {
-    // log.debug("XMLSchemaAssertionGui.stateChanged() called");
-    // }
-
 }

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java?rev=1775482&r1=1775481&r2=1775482&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java Wed Dec 21 16:06:45 2016
@@ -18,8 +18,6 @@
 
 package org.apache.jmeter.assertions.gui;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.BorderLayout;
 
 import javax.swing.Box;
@@ -144,12 +142,7 @@ public class XPathPanel extends JPanel {
     public JButton getCheckXPathButton() {
         if (checkXPath == null) {
             checkXPath = new JButton(JMeterUtils.getResString("xpath_assertion_button")); //$NON-NLS-1$
-            checkXPath.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                    validXPath(xpath.getText(), true);
-                }
-            });
+            checkXPath.addActionListener(e -> validXPath(xpath.getText(), true));
         }
         return checkXPath;
     }
@@ -203,18 +196,21 @@ public class XPathPanel extends JPanel {
             testDoc.appendChild(el);
             XPathUtil.validateXPath(testDoc, xpathString);
         } catch (IllegalArgumentException e) {
-            log.warn(e.getLocalizedMessage());
+            log.warn(e.getLocalizedMessage(), e);
             success = false;
             ret = e.getLocalizedMessage();
         } catch (ParserConfigurationException | TransformerException e) {
+            log.warn(e.getLocalizedMessage(), e);
             success = false;
             ret = e.getLocalizedMessage();
         }
         if (showDialog) {
-            JOptionPane.showMessageDialog(null, (success) ? JMeterUtils.getResString("xpath_assertion_valid") : ret, //$NON-NLS-1$
-                    (success) ? JMeterUtils.getResString("xpath_assertion_valid") : JMeterUtils //$NON-NLS-1$
-                            .getResString("xpath_assertion_failed"), (success) ? JOptionPane.INFORMATION_MESSAGE //$NON-NLS-1$
-                            : JOptionPane.ERROR_MESSAGE);
+            JOptionPane.showMessageDialog(null, 
+                    success ? JMeterUtils.getResString("xpath_assertion_valid") : ret, //$NON-NLS-1$
+                    success ? JMeterUtils.getResString("xpath_assertion_valid") : //$NON-NLS-1$
+                        JMeterUtils.getResString("xpath_assertion_failed"), //$NON-NLS-1$
+                        success ? JOptionPane.INFORMATION_MESSAGE //$NON-NLS-1$
+                                : JOptionPane.ERROR_MESSAGE);
         }
         return success;