Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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());
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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