3

I'm looking to automate some testing of calls we make to an external service. I've gotten Browsermob-proxy and selenium to play together nicely. I'd now like to monitor the requests as they occur, however I am receiving a ConcurrentModificationException in line 5 of the below loop:

while (!found) {
    har = server.getHar();
    HarLog harLog = har.getLog();
    List<HarEntry> entries = harLog.getEntries();
    for (HarEntry entry : entries) { //Exception occurs on this line
        for (HarNameValuePair queryData : entry.getRequest().getQueryString()) {
            found = (queryData.getName().compareToIgnoreCase("events") == 0)
                 && (queryData.getValue().contains("event5"));
            if (found) {
               //Do some processing & break out
            }
        }
    }
}

Is this something I should be doing with a HttpRequestInterceptor instead?

A slight modification to the example will allow this code to work:

List<HarEntry> entries = new CopyOnWriteArrayList<HarEntry>(harLog.getEntries());
3

I created Issue 39, due to the request made at browsermob-proxy google group.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.