svn commit: r1847974 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:16:32 2018
New Revision: 1847974

URL: http://svn.apache.org/viewvc?rev=1847974=rev
Log:
Extract code to create BackendListenerClient from a classname

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java?rev=1847974=1847973=1847974=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 Sun Dec  2 11:16:32 2018
@@ -169,10 +169,8 @@ public class BackendListenerGui extends
 
 String newClassName = ((String) 
classnameCombo.getSelectedItem()).trim();
 try {
-BackendListenerClient client = (BackendListenerClient) 
Class.forName(newClassName, true,
-
Thread.currentThread().getContextClassLoader()).newInstance();
-BackendListenerClient oldClient = (BackendListenerClient) 
Class.forName(className, true,
-
Thread.currentThread().getContextClassLoader()).newInstance();
+BackendListenerClient client = 
createBackendListenerClient(newClassName);
+BackendListenerClient oldClient = 
createBackendListenerClient(className);
 
 Arguments currArgs = new Arguments();
 argsPanel.modifyTestElement(currArgs);
@@ -222,6 +220,13 @@ public class BackendListenerGui extends
 }
 }
 
+
+private BackendListenerClient createBackendListenerClient(String 
newClassName)
+throws ReflectiveOperationException {
+return (BackendListenerClient) Class.forName(newClassName, true,
+
Thread.currentThread().getContextClassLoader()).getDeclaredConstructor().newInstance();
+}
+
 /**
  * Create a panel containing components allowing the user to provide
  * arguments to be passed to the test class instance.




svn commit: r1847985 - in /jmeter/trunk/src/core/org/apache/jmeter: gui/util/PowerTableModel.java testbeans/gui/TableEditor.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:27:21 2018
New Revision: 1847985

URL: http://svn.apache.org/viewvc?rev=1847985=rev
Log:
Replace calls to deprecated method Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java
jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java?rev=1847985=1847984=1847985=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java Sun 
Dec  2 11:27:21 2018
@@ -157,7 +157,7 @@ public class PowerTableModel extends Def
 private Object createDefaultValue(int i) { // CHECKSTYLE IGNORE ReturnCount
 Class colClass = getColumnClass(i);
 try {
-return colClass.newInstance();
+return colClass.getDeclaredConstructor().newInstance();
 } catch (Exception e) {
 try {
 Constructor constr = colClass.getConstructor(new Class[] { 
String.class });

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java?rev=1847985=1847984=1847985=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java Sun 
Dec  2 11:27:21 2018
@@ -298,7 +298,7 @@ public class TableEditor extends Propert
 @Override
 public void actionPerformed(ActionEvent e) {
 try {
-model.addRow(clazz.newInstance());
+model.addRow(clazz.getDeclaredConstructor().newInstance());
 
 removeButton.setEnabled(true);
 clearButton.setEnabled(true);
@@ -321,7 +321,7 @@ public class TableEditor extends Propert
 for (String clipboardLine : clipboardLines) {
 String[] columns = clipboardLine.split("\t"); // 
$NON-NLS-1$
 
-model.addRow(clazz.newInstance());
+model.addRow(clazz.getDeclaredConstructor().newInstance());
 
 for (int i=0; i < columns.length; i++) {
 model.setValueAt(columns[i], model.getRowCount() - 1, 
i);




svn commit: r1847986 - /jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:28:12 2018
New Revision: 1847986

URL: http://svn.apache.org/viewvc?rev=1847986=rev
Log:
With varargs there is no need for the arrays

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java?rev=1847986=1847985=1847986=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java Sun 
Dec  2 11:28:12 2018
@@ -160,48 +160,48 @@ public class PowerTableModel extends Def
 return colClass.getDeclaredConstructor().newInstance();
 } catch (Exception e) {
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
String.class });
-return constr.newInstance(new Object[] { "" });
+Constructor constr = colClass.getConstructor(String.class);
+return constr.newInstance("");
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Integer.TYPE });
-return constr.newInstance(new Object[] { Integer.valueOf(0) });
+Constructor constr = colClass.getConstructor(Integer.TYPE);
+return constr.newInstance(Integer.valueOf(0));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Long.TYPE });
-return constr.newInstance(new Object[] { Long.valueOf(0L) });
+Constructor constr = colClass.getConstructor(Long.TYPE);
+return constr.newInstance(Long.valueOf(0L));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Boolean.TYPE });
-return constr.newInstance(new Object[] { Boolean.FALSE });
+Constructor constr = colClass.getConstructor(Boolean.TYPE);
+return constr.newInstance(Boolean.FALSE);
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Float.TYPE });
-return constr.newInstance(new Object[] { Float.valueOf(0F) });
+Constructor constr = colClass.getConstructor(Float.TYPE);
+return constr.newInstance(Float.valueOf(0F));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Double.TYPE });
-return constr.newInstance(new Object[] { Double.valueOf(0D) });
+Constructor constr = colClass.getConstructor(Double.TYPE);
+return constr.newInstance(Double.valueOf(0D));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Character.TYPE });
-return constr.newInstance(new Object[] { Character.valueOf(' 
') });
+Constructor constr = 
colClass.getConstructor(Character.TYPE);
+return constr.newInstance(Character.valueOf(' '));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Byte.TYPE });
-return constr.newInstance(new Object[] { 
Byte.valueOf(Byte.MIN_VALUE) });
+Constructor constr = colClass.getConstructor(Byte.TYPE);
+return constr.newInstance(Byte.valueOf(Byte.MIN_VALUE));
 } catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
 }
 try {
-Constructor constr = colClass.getConstructor(new Class[] { 
Short.TYPE });
-return constr.newInstance(new Object[] { 
Short.valueOf(Short.MIN_VALUE) });
+   

svn commit: r1847961 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:07:03 2018
New Revision: 1847961

URL: http://svn.apache.org/viewvc?rev=1847961=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java?rev=1847961=1847960=1847961=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 Sun Dec  2 11:07:03 2018
@@ -309,7 +309,7 @@ public class AccessLogSampler extends HT
 try {
 filter = (Filter) 
Class.forName(filterClassName).getDeclaredConstructor().newInstance();
 } catch (Exception e) {
-log.warn("Couldn't instantiate filter '" + filterClassName + 
"'", e);
+log.warn("Couldn't instantiate filter '{}'", filterClassName, 
e);
 }
 }
 }




svn commit: r1847980 - /jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:22:07 2018
New Revision: 1847980

URL: http://svn.apache.org/viewvc?rev=1847980=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java?rev=1847980=1847979=1847980=diff
==
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java 
(original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java Sun 
Dec  2 11:22:07 2018
@@ -104,18 +104,18 @@ public class ObjectTableModel extends De
 
 int numClasses = classes.size();
 if (numClasses != numHeaders){
-log.warn("Header count="+numHeaders+" but classes 
count="+numClasses);
+log.warn("Header count={} but classes count={}", numHeaders, 
numClasses);
 }
 
 // Functor count = 0 is handled specially
 int numWrite = writeFunctors.length;
 if (numWrite > 0 && numWrite != numHeaders){
-log.warn("Header count="+numHeaders+" but writeFunctor 
count="+numWrite);
+log.warn("Header count={} but writeFunctor count={}", numHeaders, 
numWrite);
 }
 
 int numRead = readFunctors.length;
 if (numRead > 0 && numRead != numHeaders){
-log.warn("Header count="+numHeaders+" but readFunctor 
count="+numRead);
+log.warn("Header count={} but readFunctor count={}", numHeaders, 
numRead);
 }
 }
 
@@ -138,7 +138,7 @@ public class ObjectTableModel extends De
 }
 
 public void addRow(Object value) {
-log.debug("Adding row value: " + value);
+log.debug("Adding row value: {}", value);
 if (objectClass != null) {
 final Class valueClass = value.getClass();
 if (!objectClass.isAssignableFrom(valueClass)){
@@ -259,7 +259,7 @@ public class ObjectTableModel extends De
 try {
 value = objectClass.getDeclaredConstructor().newInstance();
 } catch (ReflectiveOperationException e) {
-log.error("Cannot create instance of class 
"+objectClass.getName(),e);
+log.error("Cannot create instance of class {}", 
objectClass.getName(),e);
 return false;
 }
 } else {
@@ -271,14 +271,14 @@ public class ObjectTableModel extends De
 if (setMethod != null
  && !setMethod.checkMethod(value,getColumnClass(i))) {
 status=false;
-log.warn(caller.getName()+" is attempting to use 
nonexistent "+setMethod.toString());
+log.warn("{} is attempting to use nonexistent {}", 
caller.getName(), setMethod);
 }
 
 Functor getMethod = readFunctors.get(i);
 if (getMethod != null 
  && !getMethod.checkMethod(value)) {
 status=false;
-log.warn(caller.getName()+" is attempting to use 
nonexistent "+getMethod.toString());
+log.warn("{} is attempting to use nonexistent {}", 
caller.getName(), getMethod);
 }
 
 }




svn commit: r1847979 - in /jmeter/trunk/src: jorphan/org/apache/jorphan/gui/ jorphan/org/apache/jorphan/reflect/ protocol/http/org/apache/jmeter/protocol/http/proxy/ protocol/java/org/apache/jmeter/pr

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:21:32 2018
New Revision: 1847979

URL: http://svn.apache.org/viewvc?rev=1847979=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java

jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java

jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java?rev=1847979=1847978=1847979=diff
==
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java 
(original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java Sun 
Dec  2 11:21:32 2018
@@ -257,11 +257,8 @@ public class ObjectTableModel extends De
 Object value;
 if (_value == null && objectClass != null) {
 try {
-value = objectClass.newInstance();
-} catch (InstantiationException e) {
-log.error("Cannot create instance of class 
"+objectClass.getName(),e);
-return false;
-} catch (IllegalAccessException e) {
+value = objectClass.getDeclaredConstructor().newInstance();
+} catch (ReflectiveOperationException e) {
 log.error("Cannot create instance of class 
"+objectClass.getName(),e);
 return false;
 }

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java?rev=1847979=1847978=1847979=diff
==
--- jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java 
(original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java Sun Dec 
 2 11:21:32 2018
@@ -41,9 +41,8 @@ public class ClassTools {
 public static Object construct(String className) throws JMeterException {
 Object instance = null;
 try {
-instance = ClassUtils.getClass(className).newInstance();
-} catch (ClassNotFoundException | IllegalAccessException
-| InstantiationException e) {
+instance = 
ClassUtils.getClass(className).getDeclaredConstructor().newInstance();
+} catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 throw new JMeterException(e);
 }
 return instance;

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java?rev=1847979=1847978=1847979=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
 Sun Dec  2 11:21:32 2018
@@ -128,7 +128,7 @@ public class Daemon extends Thread imple
 Socket clientSocket = mainSocket.accept();
 if (running) {
 // Pass request to new proxy thread
-Proxy thd = proxyClass.newInstance();
+Proxy thd = 
proxyClass.getDeclaredConstructor().newInstance();
 thd.configure(clientSocket, target, pageEncodings, 
formEncodings);
 thd.start();
 }

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java?rev=1847979=1847978=1847979=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java
 Sun Dec  2 11:21:32 2018
@@ -61,7 +61,7 @@ public class SamplerCreatorFactory {
 if(log.isDebugEnabled()) {
 log.debug("Instantiating: {}", 
commandClass.getName());
 }
-SamplerCreator creator = (SamplerCreator) 

svn commit: r1847981 - in /jmeter/trunk/src: components/org/apache/jmeter/visualizers/ components/org/apache/jmeter/visualizers/backend/graphite/ core/org/apache/jmeter/ core/org/apache/jmeter/engine/

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:23:44 2018
New Revision: 1847981

URL: http://svn.apache.org/viewvc?rev=1847981=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java

jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java

jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java

jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestElementConverter.java

jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestElementPropertyConverter.java

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/CollectionProperty.java

jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java?rev=1847981=1847980=1847981=diff
==
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java 
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java 
Sun Dec  2 11:23:44 2018
@@ -63,7 +63,7 @@ public class RequestPanel {
 for (String clazz : classesToAdd) {
 try {
 // Instantiate requestview classes
-final RequestView requestView = (RequestView) 
Class.forName(clazz).newInstance();
+final RequestView requestView = (RequestView) 
Class.forName(clazz).getDeclaredConstructor().newInstance();
 if (rawTab.equals(requestView.getLabel())) {
 rawObject = requestView; // use later
 } else {

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java?rev=1847981=1847980=1847981=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
 Sun Dec  2 11:23:44 2018
@@ -459,7 +459,7 @@ implements ActionListener, TreeSelection
 for (String clazz : classesToAdd) {
 try {
 // Instantiate render classes
-final ResultRenderer renderer = (ResultRenderer) 
Class.forName(clazz).newInstance();
+final ResultRenderer renderer = (ResultRenderer) 
Class.forName(clazz).getDeclaredConstructor().newInstance();
 if (textRenderer.equals(renderer.toString())){
 textObject=renderer;
 }

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java?rev=1847981=1847980=1847981=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
 Sun Dec  2 11:23:44 2018
@@ -340,7 +340,7 @@ public class GraphiteBackendListenerClie
 }
 }
 Class clazz = Class.forName(graphiteMetricsSenderClass);
-this.graphiteMetricsManager = (GraphiteMetricsSender) 
clazz.newInstance();
+this.graphiteMetricsManager = (GraphiteMetricsSender) 
clazz.getDeclaredConstructor().newInstance();
 graphiteMetricsManager.setup(graphiteHost, graphitePort, 
rootMetricsPrefix);
 if (useRegexpForSamplersList) {
 pattern = Pattern.compile(samplersList);

Modified: jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java?rev=1847981=1847980=1847981=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java Sun Dec  2 11:23:44 
2018
@@ -240,7 +240,7 @@ public final class NewDriver {
 
 try {
 

svn commit: r1847958 - /jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:00:28 2018
New Revision: 1847958

URL: http://svn.apache.org/viewvc?rev=1847958=rev
Log:
spacepolice

Modified:
jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java

Modified: jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java?rev=1847958=1847957=1847958=diff
==
--- jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java 
(original)
+++ jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java Sun Dec 
 2 11:00:28 2018
@@ -19,7 +19,6 @@
 /**
  * Package to test JOrphanUtils methods 
  */
- 
 package org.apache.jorphan.exec;
 
 import static org.junit.Assert.fail;
@@ -44,7 +43,7 @@ public class TestKeyToolUtils {
 public void setup() throws IOException {
 keystore = File.createTempFile("dummy-keystore", "jks");
 keystore.deleteOnExit();
-KeyToolUtils.generateProxyCA(keystore, password , validity );
+KeyToolUtils.generateProxyCA(keystore, password, validity );
 }
 
 @After




svn commit: r1847964 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/util/ test/src/org/apache/jorphan/test/

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:09:06 2018
New Revision: 1847964

URL: http://svn.apache.org/viewvc?rev=1847964=rev
Log:
Replace calls to deprecated Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java

jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java?rev=1847964=1847963=1847964=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java Sun 
Dec  2 11:09:06 2018
@@ -369,7 +369,7 @@ public final class ActionRouter implemen
 }
 for (String strClassName : listClasses) {
 Class commandClass = Class.forName(strClassName);
-Command command = (Command) commandClass.newInstance();
+Command command = (Command) 
commandClass.getDeclaredConstructor().newInstance();
 for (String commandName : command.getActionNames()) {
 Set commandObjects = 
commands.computeIfAbsent(commandName, k -> new HashSet<>());
 commandObjects.add(command);

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java?rev=1847964=1847963=1847964=diff
==
--- 
jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java
 (original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java
 Sun Dec  2 11:09:06 2018
@@ -132,12 +132,13 @@ public class AddThinkTimeBetweenEachStep
  * @param guiPackage {@link GuiPackage}
  * @param parentNode {@link JMeterTreeNode}
  * @return array of {@link JMeterTreeNode}
- * @throws IllegalUserActionException
+ * @throws ReflectiveOperationException when class instantiation for 
{@value #DEFAULT_IMPLEMENTATION} fails
+ * @throws IllegalUserActionException when {@link 
ThinkTimeCreator#createThinkTime(GuiPackage, JMeterTreeNode)} throws this
  */
-private JMeterTreeNode[] createThinkTime(GuiPackage guiPackage, 
JMeterTreeNode parentNode) 
-throws Exception {
+private JMeterTreeNode[] createThinkTime(GuiPackage guiPackage, 
JMeterTreeNode parentNode)
+throws ReflectiveOperationException, IllegalUserActionException  {
 Class clazz = Class.forName(DEFAULT_IMPLEMENTATION);
-ThinkTimeCreator thinkTimeCreator = (ThinkTimeCreator) 
clazz.newInstance();
+ThinkTimeCreator thinkTimeCreator = (ThinkTimeCreator) 
clazz.getDeclaredConstructor().newInstance();
 return thinkTimeCreator.createThinkTime(guiPackage, parentNode);
 }
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?rev=1847964=1847963=1847964=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Sun 
Dec  2 11:09:06 2018
@@ -114,8 +114,8 @@ public class BeanShellInterpreter {
 throw new ClassNotFoundException(BSH_INTERPRETER);
 }
 try {
-bshInstance = bshClass.newInstance();
-} catch (InstantiationException | IllegalAccessException e) {
+bshInstance = bshClass.getDeclaredConstructor().newInstance();
+} catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 log.error("Can't instantiate BeanShell", e);
 throw new ClassNotFoundException("Can't instantiate BeanShell", e);
 } 

Modified: jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java?rev=1847964=1847963=1847964=diff
==
--- jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java (original)
+++ jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java Sun Dec  2 
11:09:06 2018
@@ -308,11 +308,10 @@ public final class AllTests {
 if (args.length >= 3) {
 try {
 System.out.println("Using initializeProperties() from " + 

svn commit: r1847965 - /jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:10:02 2018
New Revision: 1847965

URL: http://svn.apache.org/viewvc?rev=1847965=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?rev=1847965=1847964=1847965=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Sun 
Dec  2 11:10:02 2018
@@ -136,16 +136,16 @@ public class BeanShellInterpreter {
 +File.separator+initFile;
 in = new File(fileToUse);
 if (!in.exists()) {
-log.warn("Cannot find init file: "+initFile);
+log.warn("Cannot find init file: {}", initFile);
 }
 }
 if (!in.canRead()) {
-log.warn("Cannot read init file: "+fileToUse);
+log.warn("Cannot read init file: {}", fileToUse);
 }
 try {
 source(fileToUse);
 } catch (JMeterException e) {
-log.warn("Cannot source init file: "+fileToUse,e);
+log.warn("Cannot source init file: {}", fileToUse,e);
 }
 }
 }




svn commit: r1847987 - /jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:33:14 2018
New Revision: 1847987

URL: http://svn.apache.org/viewvc?rev=1847987=rev
Log:
Simplify code that tries to find the correct constructor

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java?rev=1847987=1847986=1847987=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java Sun 
Dec  2 11:33:14 2018
@@ -19,9 +19,9 @@
 package org.apache.jmeter.gui.util;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import javax.swing.event.TableModelEvent;
@@ -40,6 +40,10 @@ public class PowerTableModel extends Def
 
 private Class[] columnClasses;
 
+private static final List DEFAULT_ARGS = 
Collections.unmodifiableList(Arrays.asList("", Integer.valueOf(0),
+Long.valueOf(0L), Boolean.FALSE, Float.valueOf(0F), 
Double.valueOf(0D), Character.valueOf(' '),
+Byte.valueOf(Byte.MIN_VALUE), Short.valueOf(Short.MIN_VALUE)));
+
 public PowerTableModel(String[] headers, Class[] classes) {
 if (headers.length != classes.length){
 throw new IllegalArgumentException("Header and column array sizes 
differ");
@@ -159,50 +163,13 @@ public class PowerTableModel extends Def
 try {
 return colClass.getDeclaredConstructor().newInstance();
 } catch (Exception e) {
-try {
-Constructor constr = colClass.getConstructor(String.class);
-return constr.newInstance("");
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Integer.TYPE);
-return constr.newInstance(Integer.valueOf(0));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Long.TYPE);
-return constr.newInstance(Long.valueOf(0L));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Boolean.TYPE);
-return constr.newInstance(Boolean.FALSE);
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Float.TYPE);
-return constr.newInstance(Float.valueOf(0F));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Double.TYPE);
-return constr.newInstance(Double.valueOf(0D));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = 
colClass.getConstructor(Character.TYPE);
-return constr.newInstance(Character.valueOf(' '));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Byte.TYPE);
-return constr.newInstance(Byte.valueOf(Byte.MIN_VALUE));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
-}
-try {
-Constructor constr = colClass.getConstructor(Short.TYPE);
-return constr.newInstance(Short.valueOf(Short.MIN_VALUE));
-} catch (NoSuchMethodException | InstantiationException | 
IllegalAccessException | InvocationTargetException ignored) {
+for (Object initArg: DEFAULT_ARGS) {
+try {
+Constructor constr = 
colClass.getConstructor(initArg.getClass());
+return constr.newInstance(initArg);
+} catch (ReflectiveOperationException ignored) {
+// no need to log this, as we are just trying out 

svn commit: r1847966 - /jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:11:31 2018
New Revision: 1847966

URL: http://svn.apache.org/viewvc?rev=1847966=rev
Log:
Simplify code

Newer java versions have changed the method signatures to varargs. Use those 
varargs.
Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?rev=1847966=1847965=1847966=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Sun 
Dec  2 11:11:31 2018
@@ -66,14 +66,10 @@ public class BeanShellInterpreter {
 Class string = String.class;
 Class object = Object.class;
 
-get = clazz.getMethod("get", //$NON-NLS-1$
-new Class[] { string });
-eval = clazz.getMethod("eval", //$NON-NLS-1$
-new Class[] { string });
-set = clazz.getMethod("set", //$NON-NLS-1$
-new Class[] { string, object });
-source = clazz.getMethod("source", //$NON-NLS-1$
-new Class[] { string });
+get = clazz.getMethod("get", string); //$NON-NLS-1$
+eval = clazz.getMethod("eval", string); //$NON-NLS-1$
+set = clazz.getMethod("set", string, object); //$NON-NLS-1$
+source = clazz.getMethod("source", string); //$NON-NLS-1$
 } catch (ClassNotFoundException|SecurityException | 
NoSuchMethodException e) {
 log.error("Beanshell Interpreter not found", e);
 } finally {




svn commit: r1847969 - /jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:12:48 2018
New Revision: 1847969

URL: http://svn.apache.org/viewvc?rev=1847969=rev
Log:
Use Java naming conventions for parameter names

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?rev=1847969=1847968=1847969=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Sun 
Dec  2 11:12:48 2018
@@ -95,12 +95,12 @@ public class BeanShellInterpreter {
 /**
  *
  * @param init initialisation file
- * @param _log logger to pass to interpreter
+ * @param log logger to pass to interpreter
  * @throws ClassNotFoundException when beanshell can not be instantiated
  */
-public BeanShellInterpreter(String init, Logger _log)  throws 
ClassNotFoundException {
+public BeanShellInterpreter(String init, Logger log)  throws 
ClassNotFoundException {
 initFile = init;
-logger = _log;
+logger = log;
 init();
 }
 




svn commit: r1847973 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:14:49 2018
New Revision: 1847973

URL: http://svn.apache.org/viewvc?rev=1847973=rev
Log:
Replace calls to deprecated Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java?rev=1847973=1847972=1847973=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java
 Sun Dec  2 11:14:49 2018
@@ -279,7 +279,7 @@ public class BackendListener extends Abs
 return new ErrorBackendListenerClient();
 }
 try {
-return (BackendListenerClient) clientClass.newInstance();
+return (BackendListenerClient) 
clientClass.getDeclaredConstructor().newInstance();
 } catch (Exception e) {
 log.error("Exception creating: {}", clientClass, e);
 return new ErrorBackendListenerClient();




svn commit: r1847991 - /jmeter/trunk/xdocs/changes.xml

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:39:02 2018
New Revision: 1847991

URL: http://svn.apache.org/viewvc?rev=1847991=rev
Log:
Add changelog entry.

Closes #435
Bugzilla Id: 62972

Modified:
jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1847991=1847990=1847991=diff
==
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Dec  2 11:39:02 2018
@@ -139,6 +139,7 @@ of previous time slot as a base. Startin
 406Add a short paragraph on how to use a security manager 
with JMeter.
 62893Use StringEscapeUtils from commons-text (version 1.6) 
instead of the deprecated ones from commons-lang3.
 Update to ActiveMQ 5.15.7 (from 5.5.16)
+62972435Replace calls to deprecated method 
Class#newInstance.
 
 
  




svn commit: r1847959 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:04:09 2018
New Revision: 1847959

URL: http://svn.apache.org/viewvc?rev=1847959=rev
Log:
Use StringUtils.isNotBlank to make intent clearer

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java?rev=1847959=1847958=1847959=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 Sun Dec  2 11:04:09 2018
@@ -197,8 +197,8 @@ public class AccessLogSampler extends HT
 public void instantiateParser() {
 if (parser == null) {
 try {
-if (this.getParserClassName() != null && 
this.getParserClassName().length() > 0) {
-if (this.getLogFile() != null && 
this.getLogFile().length() > 0) {
+if (StringUtils.isNotBlank(this.getParserClassName())) {
+if (StringUtils.isNotBlank(this.getLogFile())) {
 parser = (LogParser) 
Class.forName(getParserClassName()).newInstance();
 parser.setSourceFile(this.getLogFile());
 parser.setFilter(filter);
@@ -306,7 +306,7 @@ public class AccessLogSampler extends HT
 }
 
 protected void initFilter() {
-if (filter == null && filterClassName != null && 
filterClassName.length() > 0) {
+if (filter == null && StringUtils.isNotBlank(filterClassName)) {
 try {
 filter = (Filter) Class.forName(filterClassName).newInstance();
 } catch (Exception e) {
@@ -321,26 +321,24 @@ public class AccessLogSampler extends HT
 @Override
 public Object clone() {
 AccessLogSampler s = (AccessLogSampler) super.clone();
-if (started) {
-if (filterClassName != null && filterClassName.length() > 0) {
+if (started && StringUtils.isNotBlank(filterClassName)) {
 
-try {
-if 
(TestCloneable.class.isAssignableFrom(Class.forName(filterClassName))) {
-initFilter();
-s.filter = (Filter) ((TestCloneable) filter).clone();
-}
-if 
(TestCloneable.class.isAssignableFrom(Class.forName(parserClassName)))
+try {
+if 
(TestCloneable.class.isAssignableFrom(Class.forName(filterClassName))) {
+initFilter();
+s.filter = (Filter) ((TestCloneable) filter).clone();
+}
+if 
(TestCloneable.class.isAssignableFrom(Class.forName(parserClassName)))
+{
+instantiateParser();
+s.parser = (LogParser)((TestCloneable)parser).clone();
+if (filter != null)
 {
-instantiateParser();
-s.parser = (LogParser)((TestCloneable)parser).clone();
-if (filter != null)
-{
-s.parser.setFilter(s.filter);
-}
+s.parser.setFilter(s.filter);
 }
-} catch (Exception e) {
-log.warn("Could not clone cloneable filter", e);
 }
+} catch (Exception e) {
+log.warn("Could not clone cloneable filter", e);
 }
 }
 return s;




svn commit: r1847960 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:05:50 2018
New Revision: 1847960

URL: http://svn.apache.org/viewvc?rev=1847960=rev
Log:
Replace deprecated newInstance calls

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java?rev=1847960=1847959=1847960=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
 Sun Dec  2 11:05:50 2018
@@ -199,15 +199,14 @@ public class AccessLogSampler extends HT
 try {
 if (StringUtils.isNotBlank(this.getParserClassName())) {
 if (StringUtils.isNotBlank(this.getLogFile())) {
-parser = (LogParser) 
Class.forName(getParserClassName()).newInstance();
+parser = (LogParser) 
Class.forName(getParserClassName()).getDeclaredConstructor().newInstance();
 parser.setSourceFile(this.getLogFile());
 parser.setFilter(filter);
 } else {
 log.error("No log file specified");
 }
 }
-} catch (InstantiationException | ClassNotFoundException
-| IllegalAccessException e) {
+} catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 log.error("", e);
 }
 }
@@ -308,7 +307,7 @@ public class AccessLogSampler extends HT
 protected void initFilter() {
 if (filter == null && StringUtils.isNotBlank(filterClassName)) {
 try {
-filter = (Filter) Class.forName(filterClassName).newInstance();
+filter = (Filter) 
Class.forName(filterClassName).getDeclaredConstructor().newInstance();
 } catch (Exception e) {
 log.warn("Couldn't instantiate filter '" + filterClassName + 
"'", e);
 }




svn commit: r1847975 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:17:25 2018
New Revision: 1847975

URL: http://svn.apache.org/viewvc?rev=1847975=rev
Log:
Extract code into private methods to make intent clearer

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java?rev=1847975=1847974=1847975=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 Sun Dec  2 11:17:25 2018
@@ -177,39 +177,8 @@ public class BackendListenerGui extends
 Map currArgsMap = currArgs.getArgumentsAsMap();
 Map userArgMap = new HashMap<>();
 userArgMap.putAll(currArgsMap);
-Arguments newArgs = new Arguments();
-Arguments defaultArgs = null;
-try {
-defaultArgs = client.getDefaultParameters();
-Arguments currentUserArgs = 
oldClient.getDefaultParameters();
-if(currentUserArgs != null) {
-
userArgMap.keySet().removeAll(currentUserArgs.getArgumentsAsMap().keySet());
-}
-} catch (AbstractMethodError e) {
-log.warn("BackendListenerClient doesn't implement "
-+ "getDefaultParameters.  Default parameters won't 
"
-+ "be shown.  Please update your client class: 
{}", newClassName);
-}
-
-if (defaultArgs != null) {
-for (JMeterProperty jMeterProperty : 
defaultArgs.getArguments()) {
-Argument arg = (Argument) 
jMeterProperty.getObjectValue();
-String name = arg.getName();
-String value = arg.getValue();
-
-// If a user has set parameters in one test, and then
-// selects a different test which supports the same
-// parameters, those parameters should have the same
-// values that they did in the original test.
-if (currArgsMap.containsKey(name)) {
-String newVal = currArgsMap.get(name);
-if (newVal != null && newVal.length() > 0) {
-value = newVal;
-}
-}
-newArgs.addArgument(name, value);
-}
-}
+Arguments defaultArgs = extractDefaultArguments(client, 
userArgMap, oldClient.getDefaultParameters());
+Arguments newArgs = copyDefaultArguments(currArgsMap, 
defaultArgs);
 userArgMap.forEach(newArgs::addArgument);
 
 className = newClassName;
@@ -221,6 +190,48 @@ public class BackendListenerGui extends
 }
 
 
+private Arguments copyDefaultArguments(Map currArgsMap, 
Arguments defaultArgs) {
+Arguments newArgs = new Arguments();
+if (defaultArgs != null) {
+for (JMeterProperty jMeterProperty : defaultArgs.getArguments()) {
+Argument arg = (Argument) jMeterProperty.getObjectValue();
+String name = arg.getName();
+String value = arg.getValue();
+
+// If a user has set parameters in one test, and then
+// selects a different test which supports the same
+// parameters, those parameters should have the same
+// values that they did in the original test.
+if (currArgsMap.containsKey(name)) {
+String newVal = currArgsMap.get(name);
+if (newVal != null && newVal.length() > 0) {
+value = newVal;
+}
+}
+newArgs.addArgument(name, value);
+}
+}
+return newArgs;
+}
+
+
+private Arguments extractDefaultArguments(BackendListenerClient client, 
Map userArgMap,
+Arguments currentUserArguments) {
+Arguments defaultArgs = null;
+try {
+defaultArgs = client.getDefaultParameters();
+if(currentUserArguments != null) {
+
userArgMap.keySet().removeAll(currentUserArguments.getArgumentsAsMap().keySet());
+}
+} catch (AbstractMethodError e) {
+log.warn("BackendListenerClient doesn't implement "
++ "getDefaultParameters.  Default parameters won't "
+  

svn commit: r1847976 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:18:35 2018
New Revision: 1847976

URL: http://svn.apache.org/viewvc?rev=1847976=rev
Log:
Use StringUtils.isNotBlank to make intent of code clearer

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java?rev=1847976=1847975=1847976=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
 Sun Dec  2 11:18:35 2018
@@ -35,6 +35,7 @@ import javax.swing.JPanel;
 import javax.swing.JTextField;
 
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.config.gui.ArgumentsPanel;
@@ -204,7 +205,7 @@ public class BackendListenerGui extends
 // values that they did in the original test.
 if (currArgsMap.containsKey(name)) {
 String newVal = currArgsMap.get(name);
-if (newVal != null && newVal.length() > 0) {
+if (StringUtils.isNotBlank(newVal)) {
 value = newVal;
 }
 }




svn commit: r1847990 - /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:35:31 2018
New Revision: 1847990

URL: http://svn.apache.org/viewvc?rev=1847990=rev
Log:
Adapt test case to new method of constructing instances

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java

Modified: 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1847990=1847989=1847990=diff
==
--- 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
 (original)
+++ 
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
 Sun Dec  2 11:35:31 2018
@@ -326,7 +326,7 @@ public class TestHTMLParser extends JMet
 HTMLParser.getParser(TestClass.class.getName());
 fail("Should not have been able to create the parser");
 } catch (LinkExtractorParseException e) {
-if (e.getCause() instanceof InstantiationException) {
+if (e.getCause() instanceof ReflectiveOperationException) {
 return;
 }
 throw e;




svn commit: r1847989 - in /jmeter/trunk/src: components/org/apache/jmeter/visualizers/backend/influxdb/ core/org/apache/jmeter/gui/util/ core/org/apache/jmeter/save/ core/org/apache/jmeter/testbeans/g

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:34:38 2018
New Revision: 1847989

URL: http://svn.apache.org/viewvc?rev=1847989=rev
Log:
Replace calls to deprecated method Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java

jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java

jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java?rev=1847989=1847988=1847989=diff
==
--- 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
 (original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
 Sun Dec  2 11:34:38 2018
@@ -365,7 +365,7 @@ public class InfluxdbBackendListenerClie
 userTag = userTagBuilder.toString();
 
 Class clazz = Class.forName(influxdbMetricsSender);
-this.influxdbMetricsManager = (InfluxdbMetricsSender) 
clazz.newInstance();
+this.influxdbMetricsManager = (InfluxdbMetricsSender) 
clazz.getDeclaredConstructor().newInstance();
 influxdbMetricsManager.setup(influxdbUrl);
 samplersToFilter = Pattern.compile(samplersRegex);
 addAnnotation(true);

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java?rev=1847989=1847988=1847989=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java 
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java Sun Dec 
 2 11:34:38 2018
@@ -222,7 +222,7 @@ public class JMeterMenuBar extends JMenu
 Class commandClass = Class.forName(strClassName);
 if (!Modifier.isAbstract(commandClass.getModifiers())) {
 log.debug("Instantiating: {}", commandClass);
-MenuCreator creator = (MenuCreator) 
commandClass.newInstance();
+MenuCreator creator = (MenuCreator) 
commandClass.getDeclaredConstructor().newInstance();
 creators.add(creator);
 }
 } catch (Exception e) {

Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java?rev=1847989=1847988=1847989=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java Sun Dec  2 
11:34:38 2018
@@ -284,7 +284,7 @@ public class SaveService {
 if (useMapper){
 jmxsaver.registerConverter((Converter) 
Class.forName(key).getConstructor(Mapper.class).newInstance(jmxsaver.getMapper()));
 } else {
-jmxsaver.registerConverter((Converter) 
Class.forName(key).newInstance());
+jmxsaver.registerConverter((Converter) 
Class.forName(key).getDeclaredConstructor().newInstance());
 }
 }
 

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java?rev=1847989=1847988=1847989=diff
==
--- 
jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
 (original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
 Sun Dec  2 11:34:38 2018
@@ -243,8 +243,8 @@ public class GenericTestBeanCustomizer e
 
 if (editorClass != null) {
 try {
-propertyEditor = (PropertyEditor) 
editorClass.newInstance();
-} catch (InstantiationException | IllegalAccessException 
e) {
+propertyEditor = (PropertyEditor) 
editorClass.getDeclaredConstructor().newInstance();
+} catch (ReflectiveOperationException e) {
 log.error("Can't create property editor.", e);
 throw new 

svn commit: r1847977 - in /jmeter/trunk/src: core/org/apache/jmeter/testelement/AbstractTestElement.java core/org/apache/jmeter/testelement/property/AbstractProperty.java protocol/http/org/apache/jmet

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:19:45 2018
New Revision: 1847977

URL: http://svn.apache.org/viewvc?rev=1847977=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java?rev=1847977=1847976=1847977=diff
==
--- 
jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java 
(original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java 
Sun Dec  2 11:19:45 2018
@@ -71,7 +71,7 @@ public abstract class AbstractTestElemen
 @Override
 public Object clone() {
 try {
-TestElement clonedElement = this.getClass().newInstance();
+TestElement clonedElement = 
this.getClass().getDeclaredConstructor().newInstance();
 
 PropertyIterator iter = propertyIterator();
 while (iter.hasNext()) {
@@ -79,7 +79,7 @@ public abstract class AbstractTestElemen
 }
 clonedElement.setRunningVersion(runningVersion);
 return clonedElement;
-} catch (InstantiationException | IllegalAccessException e) {
+} catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 throw new AssertionError(e); // clone should never return null
 }
 }

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java?rev=1847977=1847976=1847977=diff
==
--- 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java
 (original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java
 Sun Dec  2 11:19:45 2018
@@ -255,7 +255,7 @@ public abstract class AbstractProperty i
 
 protected JMeterProperty getBlankProperty() {
 try {
-JMeterProperty prop = getPropertyType().newInstance();
+JMeterProperty prop = 
getPropertyType().getDeclaredConstructor().newInstance();
 if (prop instanceof NullProperty) {
 return new StringProperty();
 }
@@ -295,7 +295,7 @@ public abstract class AbstractProperty i
 protected Collection normalizeList(Collection coll) {
 try {
 @SuppressWarnings("unchecked") // empty collection
-Collection newColl = coll.getClass().newInstance();
+Collection newColl = 
coll.getClass().getDeclaredConstructor().newInstance();
 for (Object item : coll) {
 newColl.add(convertObject(item));
 }
@@ -317,7 +317,7 @@ public abstract class AbstractProperty i
 protected Map normalizeMap(Map coll) {
 try {
 @SuppressWarnings("unchecked") // empty collection
-Map newColl = 
coll.getClass().newInstance();
+Map newColl = 
coll.getClass().getDeclaredConstructor().newInstance();
 for (Map.Entry entry : coll.entrySet()) {
 Object key = entry.getKey();
 Object prop = entry.getValue();

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java?rev=1847977=1847976=1847977=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
 Sun Dec  2 11:19:45 2018
@@ -63,14 +63,13 @@ public abstract class BaseParser impleme
 }
 
 try {
-Object clazz = Class.forName(parserClassName).newInstance();
+Object clazz = 
Class.forName(parserClassName).getDeclaredConstructor().newInstance();
 if (clazz instanceof LinkExtractorParser) {
 parser = (LinkExtractorParser) clazz;
 } else {
 throw new LinkExtractorParseException(new 
ClassCastException(parserClassName));
 }
-} catch (InstantiationException | ClassNotFoundException
-| IllegalAccessException e) {
+} catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 throw 

svn commit: r1847978 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:20:26 2018
New Revision: 1847978

URL: http://svn.apache.org/viewvc?rev=1847978=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:

jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java?rev=1847978=1847977=1847978=diff
==
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java
 Sun Dec  2 11:20:26 2018
@@ -58,7 +58,7 @@ public abstract class BaseParser impleme
 // Is there a cached parser?
 LinkExtractorParser parser = PARSERS.get(parserClassName);
 if (parser != null) {
-LOG.debug("Fetched " + parserClassName);
+LOG.debug("Fetched {}", parserClassName);
 return parser;
 }
 
@@ -72,7 +72,7 @@ public abstract class BaseParser impleme
 } catch (IllegalArgumentException | ReflectiveOperationException | 
SecurityException e) {
 throw new LinkExtractorParseException(e);
 }
-LOG.info("Created " + parserClassName);
+LOG.info("Created {}", parserClassName);
 if (parser.isReusable()) {
 LinkExtractorParser currentParser = PARSERS.putIfAbsent(
 parserClassName, parser);// cache the parser if not already




svn commit: r1847982 - in /jmeter/trunk/src/core/org/apache/jmeter: gui/util/MenuFactory.java testelement/property/MapProperty.java util/BeanShellServer.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:24:36 2018
New Revision: 1847982

URL: http://svn.apache.org/viewvc?rev=1847982=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java?rev=1847982=1847981=1847982=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java Sun Dec  
2 11:24:36 2018
@@ -171,7 +171,7 @@ public final class MenuFactory {
 || (testBeanGUI.isExpert() && 
!JMeterUtils.isExpertMode());
 item = testBeanGUI;
 } else {
-item = (JMeterGUIComponent) c.newInstance();
+item = (JMeterGUIComponent) 
c.getDeclaredConstructor().newInstance();
 }
 } catch (NoClassDefFoundError e) {
 log.warn("Configuration error, probably corrupt or missing third 
party library(jar)? Could not create class: {}.",

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java?rev=1847982=1847981=1847982=diff
==
--- 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java 
(original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java 
Sun Dec  2 11:24:36 2018
@@ -118,7 +118,7 @@ public class MapProperty extends MultiPr
 private Map cloneMap() {
 try {
 @SuppressWarnings("unchecked") // value is the correct class
-Map newCol = 
value.getClass().newInstance();
+Map newCol = 
value.getClass().getDeclaredConstructor().newInstance();
 PropertyIterator iter = valueIterator();
 while (iter.hasNext()) {
 JMeterProperty item = iter.next();

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java?rev=1847982=1847981=1847982=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java Sun Dec  
2 11:24:36 2018
@@ -73,7 +73,7 @@ public class BeanShellServer implements
 
 try {
 Class interpreter = 
loader.loadClass("bsh.Interpreter");//$NON-NLS-1$
-Object instance = interpreter.newInstance();
+Object instance = 
interpreter.getDeclaredConstructor().newInstance();
 Class string = String.class;
 Class object = Object.class;
 




svn commit: r1847984 - /jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java

2018-12-02 Thread fschumacher
Author: fschumacher
Date: Sun Dec  2 11:25:42 2018
New Revision: 1847984

URL: http://svn.apache.org/viewvc?rev=1847984=rev
Log:
With varargs there is no need for an extra array

Part of #435 and Bugzilla Id: 62972

Modified:
jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java?rev=1847984=1847983=1847984=diff
==
--- jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java Sun Dec  
2 11:25:42 2018
@@ -77,17 +77,17 @@ public class BeanShellServer implements
 Class string = String.class;
 Class object = Object.class;
 
-Method eval = interpreter.getMethod("eval", new Class[] { string 
});//$NON-NLS-1$
-Method setObj = interpreter.getMethod("set", new Class[] { string, 
object });//$NON-NLS-1$
-Method setInt = interpreter.getMethod("set", new Class[] { string, 
int.class });//$NON-NLS-1$
-Method source = interpreter.getMethod("source", new Class[] { 
string });//$NON-NLS-1$
+Method eval = interpreter.getMethod("eval", string);//$NON-NLS-1$
+Method setObj = interpreter.getMethod("set", string, 
object);//$NON-NLS-1$
+Method setInt = interpreter.getMethod("set", string, 
int.class);//$NON-NLS-1$
+Method source = interpreter.getMethod("source", 
string);//$NON-NLS-1$
 
-setObj.invoke(instance, new Object[] { "t", this });//$NON-NLS-1$
-setInt.invoke(instance, new Object[] { "portnum", 
Integer.valueOf(serverport) });//$NON-NLS-1$
+setObj.invoke(instance, "t", this );//$NON-NLS-1$
+setInt.invoke(instance, "portnum", 
Integer.valueOf(serverport));//$NON-NLS-1$
 
 if (serverfile.length() > 0) {
 try {
-source.invoke(instance, new Object[] { serverfile });
+source.invoke(instance, serverfile);
 } catch (InvocationTargetException ite) {
 Throwable cause = ite.getCause();
 if (log.isWarnEnabled()) {
@@ -99,8 +99,8 @@ public class BeanShellServer implements
 }
 }
 }
-eval.invoke(instance, new Object[] { "setAccessibility(true);" 
});//$NON-NLS-1$
-eval.invoke(instance, new Object[] { "server(portnum);" 
});//$NON-NLS-1$
+eval.invoke(instance, "setAccessibility(true);");//$NON-NLS-1$
+eval.invoke(instance, "server(portnum);");//$NON-NLS-1$
 
 } catch (ClassNotFoundException e) {
 log.error("Beanshell Interpreter not found");