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

Key: SRC-75
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Dan Fabulich
Reporter: Kurt Rose
Votes: 0
Watchers: 0
Operations

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

doCommand checks that return string starts with "OK", getString removes first 3, creating StringIndexOutOfBoundsException if all that was returned was "OK"

Created: 30/May/06 03:24 PM   Updated: Tuesday 09:39 AM
Component/s: Client Driver - Java
Affects Version/s: 0.7.1
Fix Version/s: 0.8.0

Original Estimate: 0.08h Remaining Estimate: 0.08h Time Spent: Unknown
Environment: windows XP


 Description  « Hide
 getString parses too much sometimes, the result of a command may be simply "OK", in which case removing the first 3 characters is impossible and creates an error

I ran into this from the getEval() function and needed to add a no-op to the end of my javascript to get around it


   public String doCommand(String commandName, String[] args) {
        DefaultSeleneseCommand command = new DefaultSeleneseCommand(commandName,args);
        String result = executeCommandOnServlet(command.getCommandURLString());
        if (result == null) {
            throw new NullPointerException("Selenium Bug! result must not be null");
        }
        if (!result.startsWith("OK")) { //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            throw new SeleniumException(result);
        }
        return result;
    }

public String getString(String commandName, String[] args) {
        return doCommand(commandName, args).substring(3); // skip "OK," //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    }

please, getString() to something like this:

public String getString(String commandName, String[] args) {
        String result = doCommand(commandName, args);
        return result.length() >= 3 ? result.substring(3) : " "; // skip "OK," or "OK"
    }


 All   Comments   Work Log   Change History      Sort Order:
Dan Fabulich - 30/May/06 03:31 PM
Should be fixed in Selenium Core, revision 1049.