jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: svn commit: r1776638 - in /jmeter/trunk/src: components/org/apache/jmeter/visualizers/ core/org/apache/jmeter/engine/
Date Sat, 31 Dec 2016 11:36:47 GMT
Am 30.12.2016 um 21:48 schrieb pmouawad@apache.org:
> Author: pmouawad
> Date: Fri Dec 30 20:48:12 2016
> New Revision: 1776638
>
> URL: http://svn.apache.org/viewvc?rev=1776638&view=rev
> Log:
> sonar : fix code smell (Remove useless assignment)
> and false-positive
>
> Modified:
>      jmeter/trunk/src/components/org/apache/jmeter/visualizers/SearchTreePanel.java
>      jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
>      jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
>      jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
>      jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java
>
> Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SearchTreePanel.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SearchTreePanel.java?rev=1776638&r1=1776637&r2=1776638&view=diff
> ==============================================================================
> --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SearchTreePanel.java (original)
> +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SearchTreePanel.java Fri
Dec 30 20:48:12 2016
> @@ -138,13 +138,9 @@ public class SearchTreePanel extends JPa
>           if (StringUtils.isEmpty(wordToSearch)) {
>               return;
>           }
> -        Searcher searcher = null;
> -        if (isRegexpCB.isSelected()) {
> -            searcher = new RegexpSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText());
> -        } else {
> -            searcher = new RawTextSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText());
> -        }
> -
> +        Searcher searcher = isRegexpCB.isSelected() ?
> +            new RegexpSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText()) :
> +            new RawTextSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText());
I am not so sure, if the ternary operator is better readable than an if 
statement. Sonar will have probably about the useless searcher = null 
before the if statement.

Felix
>           searchInNode(searcher, (SearchableTreeNode)defaultMutableTreeNode);
>       }
>   
> @@ -157,7 +153,7 @@ public class SearchTreePanel extends JPa
>           Object userObject = node.getUserObject();
>           
>           try {
> -            Searchable searchable = null;
> +            Searchable searchable;
>               if(userObject instanceof Searchable) {
>                   searchable = (Searchable) userObject;
>               } else {
>
> Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java?rev=1776638&r1=1776637&r2=1776638&view=diff
> ==============================================================================
> --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java (original)
> +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java Fri
Dec 30 20:48:12 2016
> @@ -118,7 +118,7 @@ public class StatVisualizer extends Abst
>           JMeterUtils.runSafe(false, new Runnable() {
>               @Override
>               public void run() {
> -                SamplingStatCalculator row = null;
> +                SamplingStatCalculator row;
>                   final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
>                   synchronized (lock) {
>                       row = tableRows.get(sampleLabel);
>
> Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java?rev=1776638&r1=1776637&r2=1776638&view=diff
> ==============================================================================
> --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java (original)
> +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java Fri
Dec 30 20:48:12 2016
> @@ -185,7 +185,7 @@ public class SummaryReport extends Abstr
>           JMeterUtils.runSafe(false, new Runnable() {
>               @Override
>               public void run() {
> -                Calculator row = null;
> +                Calculator row;
>                   synchronized (lock) {
>                       row = tableRows.get(sampleLabel);
>                       if (row == null) {
>
> 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=1776638&r1=1776637&r2=1776638&view=diff
> ==============================================================================
> --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
(original)
> +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
Fri Dec 30 20:48:12 2016
> @@ -248,7 +248,7 @@ implements ActionListener, TreeSelection
>       @Override
>       public void valueChanged(TreeSelectionEvent e) {
>           lastSelectionEvent = e;
> -        DefaultMutableTreeNode node = null;
> +        DefaultMutableTreeNode node;
>           synchronized (this) {
>               node = (DefaultMutableTreeNode) jTree.getLastSelectedPathComponent();
>           }
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java?rev=1776638&r1=1776637&r2=1776638&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java Fri Dec 30
20:48:12 2016
> @@ -129,7 +129,7 @@ public class ClientJMeterEngine implemen
>               String scriptName = FileServer.getFileServer().getScriptName();
>               synchronized(LOCK)
>               {
> -                methodName="rconfigure()";
> +                methodName="rconfigure()"; // NOSONAR Used for tracing
>                   remote.rconfigure(testTree, host, baseDirRelative, scriptName);
>               }
>               log.info("sent test to " + host + " basedir='"+baseDirRelative+"'"); //
$NON-NLS-1$
> @@ -138,7 +138,7 @@ public class ClientJMeterEngine implemen
>               }
>               log.info("Sending properties "+savep);
>               try {
> -                methodName="rsetProperties()";
> +                methodName="rsetProperties()";// NOSONAR Used for tracing
>                   remote.rsetProperties(savep);
>               } catch (RemoteException e) {
>                   log.warn("Could not set properties: " + e.toString());
>
>


Mime
View raw message