History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SRC-372
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Andras Hatvani
Reporter: Øystein Lunde
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Selenium Remote Control

HttpCommandProcessor.getBooleanArray will always return a 'false'-array

Created: 22/Oct/07 05:49 AM   Updated: 18/Nov/08 06:50 AM
Component/s: Client Driver - Java
Affects Version/s: 0.9.2
Fix Version/s: 1.0

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Class: com.thoughtworks.selenium.HttpCommandProcessor
Method: getBooleanArray(String commandName, String[] args)

Bug: String equals String[] will always return false (line 244 & 248). The method will always return an array consisting of only "false"-element, irrespective of the args-array.

Fix: Compare with the correct element in the args-array rather than with the array itself.

    public boolean[] getBooleanArray(String commandName, String[] args) {
        String[] result = getStringArray(commandName, args);
        boolean[] b = new boolean[result.length];
        for (int i = 0; i < result.length; i++) {
            if ("true".equals(result[i])) {
                b[i] = true;
                continue;
            }
            if ("false".equals(result[i])) {
                b[i] = false;
                continue;
            }
            throw new RuntimeException("result was neither 'true' nor 'false': " + result);
        }
        return b;
    }
----------------------------

Patch:

Index: C:/Projects/current/external/selenium_rc/clients/java/src/main/java/com/thoughtworks/selenium/HttpCommandProcessor.java
===================================================================
--- C:/Projects/current/external/selenium_rc/clients/java/src/main/java/com/thoughtworks/selenium/HttpCommandProcessor.java (revision 2045)
+++ C:/Projects/current/external/selenium_rc/clients/java/src/main/java/com/thoughtworks/selenium/HttpCommandProcessor.java (working copy)
@@ -241,11 +241,11 @@
         String[] result = getStringArray(commandName, args);
         boolean[] b = new boolean[result.length];
         for (int i = 0; i < result.length; i++) {
- if ("true".equals(result)) {
+ if ("true".equals(result[i])) {
                 b[i] = true;
                 continue;
             }
- if ("false".equals(result)) {
+ if ("false".equals(result[i])) {
                 b[i] = false;
                 continue;
             }


 All   Comments   Work Log   Change History      Sort Order:
Andras Hatvani - 19/Oct/08 06:40 PM
Fixed in r2480.