prevent NPE

This commit is contained in:
Athou
2013-03-31 14:05:17 +02:00
parent 6d971fa3f3
commit 38a85fcf6f
2 changed files with 14 additions and 11 deletions

View File

@@ -15,7 +15,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jpa.datasource.name>java:openejb/Resource/My DataSource</jpa.datasource.name> <jpa.datasource.name>java:openejb/Resource/My DataSource</jpa.datasource.name>
<jpa.show_sql>true</jpa.show_sql> <jpa.show_sql>false</jpa.show_sql>
</properties> </properties>
<build> <build>

View File

@@ -54,9 +54,11 @@ public class EntriesREST extends AbstractREST {
if (type == Type.feed) { if (type == Type.feed) {
FeedSubscription subscription = feedSubscriptionService.findById( FeedSubscription subscription = feedSubscriptionService.findById(
getUser(), Long.valueOf(id)); getUser(), Long.valueOf(id));
entries.setName(subscription.getTitle()); if (subscription != null) {
entries.getEntries().addAll( entries.setName(subscription.getTitle());
buildEntries(subscription, offset, limit, unreadOnly)); entries.getEntries().addAll(
buildEntries(subscription, offset, limit, unreadOnly));
}
} else { } else {
@@ -76,13 +78,14 @@ public class EntriesREST extends AbstractREST {
} else { } else {
FeedCategory feedCategory = feedCategoryService.findById( FeedCategory feedCategory = feedCategoryService.findById(
getUser(), Long.valueOf(id)); getUser(), Long.valueOf(id));
List<FeedCategory> childrenCategories = feedCategoryService if (feedCategory != null) {
.findAllChildrenCategories(getUser(), feedCategory); List<FeedCategory> childrenCategories = feedCategoryService
entries.getEntries().addAll( .findAllChildrenCategories(getUser(), feedCategory);
buildEntries(childrenCategories, subMapping, offset, entries.getEntries().addAll(
limit, unreadOnly)); buildEntries(childrenCategories, subMapping,
entries.setName(feedCategory.getName()); offset, limit, unreadOnly));
entries.setName(feedCategory.getName());
}
} }
} }