Project

General

Profile

Bug #14721

ConcurrentModificationException when getting entry

Added by Kyle Hazelwood about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
High
Category:
Server
Target version:
Start date:
11/30/2016
Due date:
% Done:

0%

Estimated time:
Duration:

History

#1 Updated by Kyle Hazelwood about 3 years ago

The problem is I'm removing hidden comments in an ArrayList:

                commentsLoop: for (ElogComment comment : comments)
                {
                    comment.setAuthor(ElogDataBase.getCommentAuthor(comment.getId()));
                    comment.setCoAuthors(ElogDataBase.getCommentCoAuthors(comment.getId()));

                    //Don't attach comment if hidden and the user doesn't have privileges
                    if (comment.isHidden())
                    {
                        for (ElogUser coAuthor : comment.getCoAuthors())
                        {
                            if (clientUserBean.equals(coAuthor) && 
                                    !clientUserBean.equals(comment.getAuthor()) &&
                                    !clientUserBean.isSuperAdmin())
                            {
                                comments.remove(comment);
                                continue commentsLoop;
                            }
                        }
                    }

#2 Updated by Kyle Hazelwood about 3 years ago

This is probably an issue in multiple API methods with hidden entries/comments.

#3 Updated by Michael Wren about 3 years ago

I've noticed that when doing API searches with limits (i.e. &limit=1) that would return hidden entries (that I do not have permission to view) the hidden entries count against the limit and can even result in empty responses. Is this a related to this bug?

#4 Updated by Kyle Hazelwood about 3 years ago

Michael Wren wrote:

I've noticed that when doing API searches with limits (i.e. &limit=1) that would return hidden entries (that I do not have permission to view) the hidden entries count against the limit and can even result in empty responses. Is this a related to this bug?

It is not directly related to this bug. The limit is applied on the dbquery and the user permissions is applied after the db results are processed. So, yes if you do limit 1 and don't have permissions to the entry/comment then you will get zero returned entries/comments. If you were seeing this error you would get an HTTP 500 response instead of a HTTP 200 with no data.

#5 Updated by Kyle Hazelwood about 3 years ago

Apparently, I noticed this bug a year ago on the test server but only implemented its fix for the searchEntries methods and not the get methods.

ArrayList<ElogComment> comments = new ArrayList<ElogComment>(Arrays.asList(ElogDataBase.getEntryComments(entry.getId())));

                commentsLoop: for (Iterator<ElogComment> commentsIterator = comments.iterator(); commentsIterator.hasNext();)
                {

                }

#6 Updated by Kyle Hazelwood about 3 years ago

  • Status changed from Assigned to Resolved

Fixed on test server. Will be out next elog restart.

#7 Updated by Kyle Hazelwood about 3 years ago

  • Status changed from Resolved to Closed

Released today.



Also available in: Atom PDF