Buggy code:
@ Service public class CollectionBoServiceImpl extends AbstractResourceServiceImpl implements ConstantProperties , ParameterProperties , CollectionBoService { @ Autowired private CollectionDao collectionDao ; @ Autowired private GooruImageUtil gooruImageUtil ; @ Autowired private ResourceBoService resourceBoService ; @ Autowired private UserService userService ; @ Autowired private QuestionService questionService ; @ Autowired private ContentService contentService ; @ Autowired private CollaboratorRepository collaboratorRepository ; @ Autowired private CollectionEventLog collectionEventLog ; private static final String COLLECTION_IMAGE_DIMENSION = "160x120,75x56,120x90,80x60,800x600" ; private static final String LAST_USER_MODIFIED = "lastUserModified" ; @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void deleteCollection ( String courseId , String unitId , String lessonId , String collectionId , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public ActionResponseDTO < Collection > createCollection ( String courseId , String unitId , String lessonId , User user , Collection collection ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public ActionResponseDTO < Collection > createCollection ( String folderId , User user , Collection collection ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void updateCollection ( String parentId , String collectionId , Collection newCollection , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void updateCollectionItem ( String collectionId , final String collectionItemId , CollectionItem newCollectionItem , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public ActionResponseDTO < CollectionItem > createResource ( String collectionId , CollectionItem collectionItem , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void updateResource ( String collectionId , String collectionResourceItemId , CollectionItem newCollectionItem , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public CollectionItem createQuestion ( String collectionId , String data , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void updateQuestion ( String collectionId , String collectionQuestionItemId , String data , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public CollectionItem addResource ( String collectionId , String resourceId , User user ) { Collection collection = getCollectionDao ( ) . getCollectionByType ( collectionId , COLLECTION_TYPES ) ; rejectIfNull ( collection , GL0056 , 404 , COLLECTION ) ; Resource resource = getResourceBoService ( ) . getResource ( resourceId ) ; rejectIfNull ( resource , GL0056 , 404 , RESOURCE ) ; <START_BUG> updateCollectionMetaDataSummary ( collection . getContentId ( ) , QUESTION , ADD ) ; <END_BUG> CollectionItem collectionItem = new CollectionItem ( ) ; collectionItem . setItemType ( ADDED ) ; return createCollectionItem ( collectionItem , collection , resource , user ) ; } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public CollectionItem addQuestion ( String collectionId , String questionId , User user ) { } @ Override @ Transactional ( readOnly = true , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public Map < String , Object > getCollection ( String collectionId , String collectionType , User user , boolean includeItems , boolean includeLastModifiedUser ) { } private Map < String , Object > getLastCollectionModifyUser ( String userUid ) { } @ Override @ Transactional ( readOnly = true , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public List < Map < String , Object > > getCollections ( String lessonId , String collectionType , int limit , int offset ) { } @ Override @ Transactional ( readOnly = true , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public List < Map < String , Object > > getCollectionItems ( String collectionId , int limit , int offset ) { } @ Override public Map < String , Object > getCollectionItem ( String collectionId , String collectionItemId ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void moveCollection ( String courseId , String unitId , String lessonId , String collectionId , User user ) { } @ Override @ Transactional ( readOnly = false , propagation = Propagation . REQUIRED , rollbackFor = Exception . class ) public void moveCollection ( String folderId , String collectionId , User user ) { } private String moveCollection ( String collectionId , Collection targetCollection , User user ) { } private String getParentCollection ( Long collectionId , String collectionType , String gooruOid , Collection targetCollection ) { } private Map < String , Object > generateCollectionMetaData ( Collection collection , Collection newCollection , User user ) { } private void updateCollectionSettings ( Collection collection , Collection newCollection ) { } private Map < String , Object > mergeCollectionItemMetaData ( Map < String , Object > content ) { } private Collection createCollection ( User user , Collection collection , Collection parentCollection ) { } private void createCollectionSettings ( Collection collection ) { } @ SuppressWarnings ( "unchecked" ) private void updateCollectionMetaDataSummary ( Long collectionId , String type , String action ) { }

Fix:
updateCollectionMetaDataSummary ( collection . getContentId ( ) , RESOURCE , ADD ) ;