Liferay java.lang.IndexOutOfBoundsException:索引:0,大小:0

时间:2015-03-20 14:50:30

标签: liferay liferay-6

我使用了liferay 6.1.1 GA2,

我的JSP中有这个消息异常:

*/
public List<JournalArticle> getLastJournalArticleViews(Map<String,String> allStructures, Long groupId) {

    List<JournalArticle> lastestView = new ArrayList<JournalArticle>();
    try {
        DynamicQuery tableIdForExpandoLatestViewQuery = DynamicQueryFactoryUtil.forClass(ExpandoColumn.class).add(PropertyFactoryUtil.forName("name").eq("recent_view_date"));

        List<ExpandoColumn> tableIdForLatestViewResult = ExpandoColumnLocalServiceUtil.dynamicQuery(tableIdForExpandoLatestViewQuery);
        long tableId = tableIdForLatestViewResult.get(0).getTableId();
        long columnId = tableIdForLatestViewResult.get(0).getPrimaryKey();

        Order lastViewDateOrder = OrderFactoryUtil.desc("data");

        DynamicQuery latestViewArticleExpandoQuery = DynamicQueryFactoryUtil.forClass(ExpandoValue.class)
                                                      .add(PropertyFactoryUtil.forName("tableId").eq(tableId))
                                                      .add(PropertyFactoryUtil.forName("columnId").eq(columnId))
                                                      .addOrder(lastViewDateOrder);

        List<ExpandoValue> lastestViewExpandoValues = ExpandoValueLocalServiceUtil.dynamicQuery(latestViewArticleExpandoQuery, 0, 100);
        if(groupId != null){
            for (ExpandoValue expandoValue : lastestViewExpandoValues) {
                try{
                    JournalArticle article = JournalArticleServiceUtil.getArticle(expandoValue.getClassPK());
                    if(article.getGroupId() == groupId){
                        lastestView.add(article);
                    }
                }catch(NoSuchArticleException e){
                    continue;
                }catch(PrincipalException e){
                    continue;
                }
            }
        }
    }catch (Exception e) {System.out.println("[journal_article_utils.jsp getLastJournalArticleViews] Exception : "+e);}

    return lastestView;
}

如何查看我的列表是否为空或空?

提前致谢。

0 个答案:

没有答案