Index: src/main/java/info/magnolia/module/templatingkit/paragraphs/AbstractItemListModel.java =================================================================== --- src/main/java/info/magnolia/module/templatingkit/paragraphs/AbstractItemListModel.java (revision 23373) +++ src/main/java/info/magnolia/module/templatingkit/paragraphs/AbstractItemListModel.java Mon Nov 23 11:05:19 MST 2009 @@ -118,8 +118,8 @@ return subNodeSearchPath; } - public Collection getItems() throws RepositoryException{ - List itemsList = search(); + public Collection getItems() throws RepositoryException{ + List itemsList = search(); this.filter(itemsList); this.sort(itemsList); @@ -134,7 +134,7 @@ return new STKPager(currentPageLink, getItems(), content); } - protected List search() throws RepositoryException { + protected List search() throws RepositoryException { return STKUtil.getContentListByTemplateCategorySubCategory(getSearchRoot(), getCategoryName(), getSubcategoryName()); } Index: src/main/java/info/magnolia/module/templatingkit/util/STKUtil.java =================================================================== --- src/main/java/info/magnolia/module/templatingkit/util/STKUtil.java (revision 28812) +++ src/main/java/info/magnolia/module/templatingkit/util/STKUtil.java Mon Nov 23 11:07:38 MST 2009 @@ -275,7 +275,7 @@ final InheritanceContentWrapper wrapper = new InheritanceContentWrapper(content); if(!wrapper.hasContent(name)){ - return Collections.EMPTY_LIST; + return Collections.emptyList(); } Collection children = wrapper.getContent(name).getChildren(new InheritanceContentFilter(content)); @@ -384,7 +384,7 @@ return null; } - public static List getContentListByTemplateName(Content searchRoot, String templateName) throws RepositoryException{ + public static List getContentListByTemplateName(Content searchRoot, String templateName) throws RepositoryException{ HierarchyManager hm = searchRoot.getHierarchyManager(); String path = searchRoot.getHandle(); String repository = hm.getName(); @@ -406,9 +406,9 @@ return itemsList; } - public static List getContentListByTemplateCategorySubCategory(Content siteRoot, String category, String subCategory) throws RepositoryException { + public static List getContentListByTemplateCategorySubCategory(Content siteRoot, String category, String subCategory) throws RepositoryException { - List templates = new ArrayList(); + List templates = new ArrayList(); Iterator templatesIterator = TemplateManager.getInstance().getAvailableTemplates(); Template template; @@ -427,12 +427,11 @@ public static Content getNearestContentByTemplateCategorySubCategory(Content siteRoot, String category, String subCategory, Content current) throws RepositoryException { - List contentList = getContentListByTemplateCategorySubCategory(siteRoot, category, subCategory); + List contentList = getContentListByTemplateCategorySubCategory(siteRoot, category, subCategory); if(!contentList.isEmpty()) { Content bestMatching = null; int bestMatchingLength =-1; - for (Iterator iterator = contentList.iterator(); iterator.hasNext();) { - Content content = (Content) iterator.next(); + for (Content content : contentList) { int matchingLegth = StringUtils.indexOfDifference(content.getHandle(), current.getHandle()); if(matchingLegth > bestMatchingLength){ bestMatchingLength = matchingLegth; @@ -446,7 +445,7 @@ public static Content getContentByTemplateCategorySubCategory(Content siteRoot, String category, String subCategory) throws RepositoryException { - List contentList = getContentListByTemplateCategorySubCategory(siteRoot, category, subCategory); + List contentList = getContentListByTemplateCategorySubCategory(siteRoot, category, subCategory); if(!contentList.isEmpty()) { Collections.sort(contentList, new Comparator(){ public int compare(final Object arg0, final Object arg1) { @@ -459,7 +458,7 @@ } } }); - return (Content) contentList.get(0); + return contentList.get(0); } return null; }