diff --git a/src/main/java/com/github/nekolr/peashooter/service/impl/GroupServiceImpl.java b/src/main/java/com/github/nekolr/peashooter/service/impl/GroupServiceImpl.java index d9210af..f1772dd 100644 --- a/src/main/java/com/github/nekolr/peashooter/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/github/nekolr/peashooter/service/impl/GroupServiceImpl.java @@ -126,7 +126,7 @@ public void saveGroup(SaveGroup saveGroup) { @Override public void refreshRss(Long groupId) { Group group = this.getById(groupId); - + List items = new ArrayList<>(); List matchers = JSON.parseArray(group.getMatchersJson(), Matcher.class); ConvertContext convertContext = ConvertContext.builder() .groupId(group.getId()) @@ -142,14 +142,16 @@ public void refreshRss(Long groupId) { SyndFeed syndFeed = FeedUtils.getFeed(rss); List entryList = FeedUtils.getEntries(syndFeed); if (!CollectionUtils.isEmpty(entryList)) { - List items = entryList.stream() - .map(syndEntry -> rssConvertor.convert(syndEntry, convertContext)) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - String xml = rssConvertor.combine(items, group.getId()); - rssWriter.write(xml, getGroupRssFilepath(group.getId())); + for (SyndEntry entry : entryList) { + Item item = rssConvertor.convert(entry, convertContext); + if (Objects.nonNull(item)) { + items.add(item); + } + } } } + String xml = rssConvertor.combine(items, group.getId()); + rssWriter.write(xml, getGroupRssFilepath(group.getId())); } @Override