As the exception message suggests, you cannot add a Field
or a Manager
(which is a Field
) to another container, more than once, unless you remove it first. When you call getAlbumsForLanguage()
the second time, you will call this:
add(fieldManager);// **here i am getting exception**
a second time, which is illegal. To solve this, just surround that line with:
if (fieldManager.getManager() == null) {
add(fieldManager);
}