jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1779802 - in /jmeter/trunk/src/protocol: http/org/apache/jmeter/protocol/http/control/ http/org/apache/jmeter/protocol/http/gui/ http/org/apache/jmeter/protocol/http/parser/ http/org/apache/jmeter/protocol/http/proxy/ http/org/apache/jmete...
Date Sun, 22 Jan 2017 12:49:15 GMT
Author: fschumacher
Date: Sun Jan 22 12:49:15 2017
New Revision: 1779802

URL: http://svn.apache.org/viewvc?rev=1779802&view=rev
Log:
Utilised Java 8 (and 7) features to tidy up code. Removed unnecessary types. Contributed by
Graham Russell (graham at ham1.co.uk). Part 2/8 of github pr #255

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParserCacheLoader.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapExtTestSamplerGui.java
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
Sun Jan 22 12:49:15 2017
@@ -476,7 +476,7 @@ public class CacheManager extends Config
                 // Bug 51942 - this map may be used from multiple threads
                 @SuppressWarnings("unchecked") // LRUMap is not generic currently
                 Map<String, CacheEntry> map = new LRUMap(getMaxSize());
-                return Collections.<String, CacheEntry>synchronizedMap(map);
+                return Collections.synchronizedMap(map);
             }
         };
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java Sun
Jan 22 12:49:15 2017
@@ -430,7 +430,7 @@ public class CookiePanel extends Abstrac
         selectHandlerPanel.addActionListener(this);
 
         // if no results render in jmeter.properties, load Standard (default)
-        List<String> classesToAdd = Collections.<String>emptyList();
+        List<String> classesToAdd = Collections.emptyList();
         try {
             classesToAdd = JMeterUtils.findClassesThatExtend(CookieHandler.class);
         } catch (IOException e1) {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java Sun
Jan 22 12:49:15 2017
@@ -40,7 +40,7 @@ import com.github.benmanes.caffeine.cach
  * @since 3.0
  */
 public class CssParser implements LinkExtractorParser {
-    private static final URLCollection EMPTY_URL_COLLECTION = new URLCollection(Collections.<URLString>emptyList());
+    private static final URLCollection EMPTY_URL_COLLECTION = new URLCollection(Collections.emptyList());
     private static final Logger LOG = LoggingManager.getLoggerForClass();
 
     /**

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParserCacheLoader.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParserCacheLoader.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParserCacheLoader.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParserCacheLoader.java
Sun Jan 22 12:49:15 2017
@@ -69,7 +69,7 @@ public class CssParserCacheLoader implem
         final CascadingStyleSheet aCSS = CSSReader.readFromStringReader(
                 cssContent, readerSettings);
 
-        final URLCollection urls = new URLCollection(new ArrayList<URLString>());
+        final URLCollection urls = new URLCollection(new ArrayList<>());
 
         if (aCSS == null) {
             LOG.warn("Failed parsing CSS: " + baseUrl

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Sun Jan 22 12:49:15 2017
@@ -313,8 +313,8 @@ public class ProxyControl extends Generi
 
     public ProxyControl() {
         setPort(DEFAULT_PORT);
-        setExcludeList(new HashSet<String>());
-        setIncludeList(new HashSet<String>());
+        setExcludeList(new HashSet<>());
+        setIncludeList(new HashSet<>());
         setCaptureHttpHeaders(true); // maintain original behaviour
     }
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
Sun Jan 22 12:49:15 2017
@@ -61,7 +61,7 @@ public class SessionFilter implements Fi
      * Creates a new SessionFilter and initializes its fields to new collections
      */
     public SessionFilter() {
-        this(new ConcurrentHashMap<String, CookieManager>(), Collections.synchronizedSet(new
HashSet<CookieManager>()));
+        this(new ConcurrentHashMap<>(), Collections.synchronizedSet(new HashSet<>()));
     }
 
     /**

Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
(original)
+++ jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Sun Jan 22 12:49:15 2017
@@ -120,7 +120,7 @@ public class JavaSampler extends Abstrac
         String name = getClassname().trim();
         try {
             javaClass = Class.forName(name, false, Thread.currentThread().getContextClassLoader());
-            Method method = javaClass.getMethod("teardownTest", new Class[]{JavaSamplerContext.class});
+            Method method = javaClass.getMethod("teardownTest", JavaSamplerContext.class);
             isToBeRegistered = !method.getDeclaringClass().equals(AbstractJavaSamplerClient.class);
             log.info("Created class: " + name + ". Uses tearDownTest: " + isToBeRegistered);
         } catch (Exception e) {

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
Sun Jan 22 12:49:15 2017
@@ -270,7 +270,7 @@ public class PublisherSampler extends Ba
                 obj = value;
             } else {
                 Class <?> clazz = Class.forName(type);
-                Method method = clazz.getMethod("valueOf", new Class<?>[]{String.class});
+                Method method = clazz.getMethod("valueOf", String.class);
                 obj = method.invoke(clazz, value);                
             }
             m.put(name, obj);

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapExtTestSamplerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapExtTestSamplerGui.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapExtTestSamplerGui.java
(original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapExtTestSamplerGui.java
Sun Jan 22 12:49:15 2017
@@ -78,7 +78,7 @@ public class LdapExtTestSamplerGui exten
     @Override
     public void modifyTestElement(TestElement sampler) {
         sampler.clear();
-        ((LDAPExtSampler) sampler).addTestElement(ldapDefaultPanel.createTestElement());
+        sampler.addTestElement(ldapDefaultPanel.createTestElement());
         super.configureTestElement(sampler);
     }
 

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java
(original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/control/gui/LdapTestSamplerGui.java
Sun Jan 22 12:49:15 2017
@@ -72,8 +72,8 @@ public class LdapTestSamplerGui extends
     @Override
     public void modifyTestElement(TestElement sampler) {
         sampler.clear();
-        ((LDAPSampler) sampler).addTestElement(ldapDefaultPanel.createTestElement());
-        ((LDAPSampler) sampler).addTestElement(loginPanel.createTestElement());
+        sampler.addTestElement(ldapDefaultPanel.createTestElement());
+        sampler.addTestElement(loginPanel.createTestElement());
         super.configureTestElement(sampler);
     }
 

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
Sun Jan 22 12:49:15 2017
@@ -22,7 +22,6 @@ import java.awt.BorderLayout;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.io.File;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -38,14 +37,12 @@ import javax.swing.JPasswordField;
 import javax.swing.JTextArea;
 import javax.swing.JTextField;
 import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.gui.util.HorizontalPanel;
 import org.apache.jmeter.gui.util.VerticalPanel;
 import org.apache.jmeter.protocol.smtp.sampler.SmtpSampler;
 import org.apache.jmeter.testelement.property.CollectionProperty;
-import org.apache.jmeter.testelement.property.TestElementProperty;
 import org.apache.jmeter.util.JMeterUtils;
 
 /**
@@ -510,7 +507,7 @@ public class SmtpPanel extends JPanel {
     public void setHeaderFields(CollectionProperty fields) {
         clearHeaderFields();
         for (int i = 0; i < fields.size(); i++) {
-            Argument argument = (Argument)((TestElementProperty)fields.get(i)).getObjectValue();
+            Argument argument = (Argument) fields.get(i).getObjectValue();
             String name = argument.getName();
             JButton removeButton = addHeaderActionPerformed(null);
             JTextField nameTF = removeButtons.get(removeButton);

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java?rev=1779802&r1=1779801&r2=1779802&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java
Sun Jan 22 12:49:15 2017
@@ -265,7 +265,7 @@ public class SendMailCommand {
         }
 
         for (int i = 0; i < headerFields.size(); i++) {
-            Argument argument = (Argument)((TestElementProperty)headerFields.get(i)).getObjectValue();
+            Argument argument = (Argument) headerFields.get(i).getObjectValue();
             message.setHeader(argument.getName(), argument.getValue());
         }
 



Mime
View raw message