Burp Suite User Forum

Create new post

java.util.ConcurrentModificationException while automating

adithya | Last updated: Sep 03, 2018 01:07PM UTC

Hi, I am trying to replay every requests in proxyhistory and modify headers and makeHTTPRequest and compare the requests. while I do this, I am getting this ConcurrentModification Exception error. I believe this happens when the iterator which I am running on proxyhistory moves to the next iteration before closing the previous one. I tried searching for a workaround on this and found people usually do hasNext(). Well, as I am using Jython I didn't get any answers. As proxyhistory type refers to a nested array and every subsequent request will be burp.ckd which I don't understand the type. What is the best possible solution for this exception in Jython for burp?

PortSwigger Agent | Last updated: Sep 03, 2018 01:17PM UTC

Could you please let us know the version of Burp you're using, and provide a link to your extension source code?

quincybatten | Last updated: Feb 13, 2023 04:22AM UTC

This exception occurs because the iteration process relies on the stability of the collection and any modification made to the collection while the iteration is in progress could cause the iteration to behave in an unexpected way. To avoid this exception, you can use an Iterator object to iterate over the collection, as it provides methods for removing elements from the collection safely during iteration. example: Map<String, Integer> map = new HashMap<>(); map.put("A", 1); map.put("B", 2); map.put("C", 3); Map<String, Integer> newMap = new HashMap<>(); for (Map.Entry<String, Integer> entry : map.entrySet()) { if (!entry.getKey().equals("B")) { newMap.put(entry.getKey(), entry.getValue()); } } http://net-informations.com/java/col/hashmap.htm

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.