View | Details | Raw Unified | Return to bug 57981
Collapse All | Expand All

(-)a/src/components/org/apache/jmeter/visualizers/AxisGraph.java (-6 / +5 lines)
Lines 316-327 public class AxisGraph extends JPanel { Link Here
316
    }
316
    }
317
317
318
    private double findMax(double _data[][]) {
318
    private double findMax(double _data[][]) {
319
        double max = 0;
319
        double max = _data[0][0];
320
        max = _data[0][0];
320
        for (double[] dArray : _data) {
321
        for (int i = 0; i < _data.length; i++) {
321
            for (double d : dArray) {
322
            for (int j = 0; j < _data[i].length; j++) {
322
                if (d > max) {
323
                if (_data[i][j] > max) {
323
                    max = d;
324
                    max = _data[i][j];
325
                }
324
                }
326
            }
325
            }
327
        }
326
        }
(-)a/src/functions/org/apache/jmeter/functions/CharFunction.java (-5 / +5 lines)
Lines 56-69 public class CharFunction extends AbstractFunction { Link Here
56
            throws InvalidVariableException {
56
            throws InvalidVariableException {
57
57
58
        StringBuilder sb = new StringBuilder(values.length);
58
        StringBuilder sb = new StringBuilder(values.length);
59
        for (int i=0; i < values.length; i++){
59
        for (Object val : values) {
60
            String numberString = ((CompoundVariable) values[i]).execute().trim();
60
            String numberString = ((CompoundVariable) val).execute().trim();
61
            try {
61
            try {
62
                long value=Long.decode(numberString).longValue();
62
                long value = Long.decode(numberString).longValue();
63
                char ch = (char) value;
63
                char ch = (char) value;
64
                sb.append(ch);
64
                sb.append(ch);
65
            } catch (NumberFormatException e){
65
            } catch (NumberFormatException e) {
66
                log.warn("Could not parse "+numberString+" : "+e);
66
                log.warn("Could not parse " + numberString + " : " + e);
67
            }
67
            }
68
        }
68
        }
69
        return sb.toString();
69
        return sb.toString();
(-)a/src/jorphan/org/apache/commons/cli/avalon/CLArgsParser.java (-12 / +11 lines)
Lines 153-161 public final class CLArgsParser { Link Here
153
     * @return the descriptor
153
     * @return the descriptor
154
     */
154
     */
155
    private final CLOptionDescriptor getDescriptorFor(final int id) {
155
    private final CLOptionDescriptor getDescriptorFor(final int id) {
156
        for (int i = 0; i < m_optionDescriptors.length; i++) {
156
        for (CLOptionDescriptor optionDescriptor : m_optionDescriptors) {
157
            if (m_optionDescriptors[i].getId() == id) {
157
            if (optionDescriptor.getId() == id) {
158
                return m_optionDescriptors[i];
158
                return optionDescriptor;
159
            }
159
            }
160
        }
160
        }
161
161
Lines 170-178 public final class CLArgsParser { Link Here
170
     * @return the descriptor
170
     * @return the descriptor
171
     */
171
     */
172
    private final CLOptionDescriptor getDescriptorFor(final String name) {
172
    private final CLOptionDescriptor getDescriptorFor(final String name) {
173
        for (int i = 0; i < m_optionDescriptors.length; i++) {
173
        for (CLOptionDescriptor optionDescriptor : m_optionDescriptors) {
174
            if (m_optionDescriptors[i].getName().equals(name)) {
174
            if (optionDescriptor.getName().equals(name)) {
175
                return m_optionDescriptors[i];
175
                return optionDescriptor;
176
            }
176
            }
177
        }
177
        }
178
178
Lines 277-284 public final class CLArgsParser { Link Here
277
            final CLOption option = arguments.elementAt(i);
277
            final CLOption option = arguments.elementAt(i);
278
            final int id = option.getDescriptor().getId();
278
            final int id = option.getDescriptor().getId();
279
279
280
            for (int j = 0; j < incompatible.length; j++) {
280
            for (int anIncompatible : incompatible) {
281
                if (id == incompatible[j]) {
281
                if (id == anIncompatible) {
282
                    final CLOption originalOption = arguments.elementAt(original);
282
                    final CLOption originalOption = arguments.elementAt(original);
283
                    final int originalId = originalOption.getDescriptor().getId();
283
                    final int originalId = originalOption.getDescriptor().getId();
284
284
Lines 495-502 public final class CLArgsParser { Link Here
495
    }
495
    }
496
496
497
    private final boolean isSeparator(final char ch, final char[] separators) {
497
    private final boolean isSeparator(final char ch, final char[] separators) {
498
        for (int i = 0; i < separators.length; i++) {
498
        for (char separator : separators) {
499
            if (ch == separators[i]) {
499
            if (ch == separator) {
500
                return true;
500
                return true;
501
            }
501
            }
502
        }
502
        }
Lines 668-675 public final class CLArgsParser { Link Here
668
        final int size = m_options.size();
668
        final int size = m_options.size();
669
        m_optionIndex = new Hashtable<>(size * 2);
669
        m_optionIndex = new Hashtable<>(size * 2);
670
670
671
        for (int i = 0; i < size; i++) {
671
        for (final CLOption option : m_options) {
672
            final CLOption option = m_options.get(i);
673
            final CLOptionDescriptor optionDescriptor = getDescriptorFor(option.getDescriptor().getId());
672
            final CLOptionDescriptor optionDescriptor = getDescriptorFor(option.getDescriptor().getId());
674
673
675
            m_optionIndex.put(Integer.valueOf(option.getDescriptor().getId()), option);
674
            m_optionIndex.put(Integer.valueOf(option.getDescriptor().getId()), option);
(-)a/src/junit/org/apache/jmeter/protocol/java/control/gui/ClassFilter.java (-6 / +4 lines)
Lines 36-49 class ClassFilter { Link Here
36
36
37
    private boolean include(String text) {
37
    private boolean include(String text) {
38
        if (pkgs.length == 0) return true; // i.e. no filter
38
        if (pkgs.length == 0) return true; // i.e. no filter
39
        boolean inc = false;
39
        for (String pkg : pkgs) {
40
        for (int idx=0; idx < pkgs.length; idx++) {
40
            if (text.startsWith(pkg)) {
41
            if (text.startsWith(pkgs[idx])){
41
                return true;
42
                inc = true;
43
                break;
44
            }
42
            }
45
        }
43
        }
46
        return inc;
44
        return false;
47
    }
45
    }
48
46
49
    String[] filterArray(List<String> items) {
47
    String[] filterArray(List<String> items) {
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java (-7 / +4 lines)
Lines 316-330 public class AjpSampler extends HTTPSamplerBase implements Interruptible { Link Here
316
    private String encode(String value)  {
316
    private String encode(String value)  {
317
        StringBuilder newValue = new StringBuilder();
317
        StringBuilder newValue = new StringBuilder();
318
        char[] chars = value.toCharArray();
318
        char[] chars = value.toCharArray();
319
        for (int i = 0; i < chars.length; i++)
319
        for (char c : chars) {
320
        {
320
            if (c == '\\')//$NON-NLS-1$
321
            if (chars[i] == '\\')//$NON-NLS-1$
322
            {
321
            {
323
                newValue.append("\\\\");//$NON-NLS-1$
322
                newValue.append("\\\\");//$NON-NLS-1$
324
            }
323
            } else {
325
            else
324
                newValue.append(c);
326
            {
327
                newValue.append(chars[i]);
328
            }
325
            }
329
        }
326
        }
330
        return newValue.toString();
327
        return newValue.toString();
(-)a/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (-15 / +15 lines)
Lines 33-38 import java.util.Collection; Link Here
33
import java.util.Collections;
33
import java.util.Collections;
34
import java.util.HashMap;
34
import java.util.HashMap;
35
import java.util.List;
35
import java.util.List;
36
import java.util.Locale;
36
import java.util.Map;
37
import java.util.Map;
37
import java.util.concurrent.ConcurrentHashMap;
38
import java.util.concurrent.ConcurrentHashMap;
38
39
Lines 85-95 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
85
86
86
        //Get all fields in java.sql.Types and store the corresponding int values
87
        //Get all fields in java.sql.Types and store the corresponding int values
87
        Field[] fields = java.sql.Types.class.getFields();
88
        Field[] fields = java.sql.Types.class.getFields();
88
        for (int i=0; i<fields.length; i++) {
89
        for (Field field : fields) {
89
            try {
90
            try {
90
                String name = fields[i].getName();
91
                String name = field.getName();
91
                Integer value = (Integer)fields[i].get(null);
92
                Integer value = (Integer) field.get(null);
92
                mapJdbcNameToInt.put(name.toLowerCase(java.util.Locale.ENGLISH),value);
93
                mapJdbcNameToInt.put(name.toLowerCase(Locale.ENGLISH), value);
93
            } catch (IllegalAccessException e) {
94
            } catch (IllegalAccessException e) {
94
                throw new RuntimeException(e); // should not happen
95
                throw new RuntimeException(e); // should not happen
95
            }
96
            }
Lines 431-437 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
431
        
432
        
432
433
433
        JMeterVariables jmvars = getThreadContext().getVariables();
434
        JMeterVariables jmvars = getThreadContext().getVariables();
434
        String varnames[] = getVariableNames().split(COMMA);
435
        String varNames[] = getVariableNames().split(COMMA);
435
        String resultVariable = getResultVariable().trim();
436
        String resultVariable = getResultVariable().trim();
436
        List<Map<String, Object> > results = null;
437
        List<Map<String, Object> > results = null;
437
        if(resultVariable.length() > 0) {
438
        if(resultVariable.length() > 0) {
Lines 460-467 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
460
                } else {
461
                } else {
461
                    sb.append('\t');
462
                    sb.append('\t');
462
                }
463
                }
463
                if (i <= varnames.length) { // i starts at 1
464
                if (i <= varNames.length) { // i starts at 1
464
                    String name = varnames[i - 1].trim();
465
                    String name = varNames[i - 1].trim();
465
                    if (name.length()>0){ // Save the value in the variable if present
466
                    if (name.length()>0){ // Save the value in the variable if present
466
                        jmvars.put(name+UNDERSCORE+j, o == null ? null : o.toString());
467
                        jmvars.put(name+UNDERSCORE+j, o == null ? null : o.toString());
467
                    }
468
                    }
Lines 469-484 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
469
            }
470
            }
470
        }
471
        }
471
        // Remove any additional values from previous sample
472
        // Remove any additional values from previous sample
472
        for(int i=0; i < varnames.length; i++){
473
        for (String varName : varNames) {
473
            String name = varnames[i].trim();
474
            String name = varName.trim();
474
            if (name.length()>0 && jmvars != null){
475
            if (name.length() > 0 && jmvars != null) {
475
                final String varCount = name+"_#"; // $NON-NLS-1$
476
                final String varCount = name + "_#"; // $NON-NLS-1$
476
                // Get the previous count
477
                // Get the previous count
477
                String prevCount = jmvars.get(varCount);
478
                String prevCount = jmvars.get(varCount);
478
                if (prevCount != null){
479
                if (prevCount != null) {
479
                    int prev = Integer.parseInt(prevCount);
480
                    int prev = Integer.parseInt(prevCount);
480
                    for (int n=j+1; n <= prev; n++ ){
481
                    for (int n = j + 1; n <= prev; n++) {
481
                        jmvars.remove(name+UNDERSCORE+n);
482
                        jmvars.remove(name + UNDERSCORE + n);
482
                    }
483
                    }
483
                }
484
                }
484
                jmvars.put(varCount, Integer.toString(j)); // save the current count
485
                jmvars.put(varCount, Integer.toString(j)); // save the current count
485
- 

Return to bug 57981