X

Geertjan's Blog

  • July 5, 2012

Feed Reader Fix

Geertjan Wielenga
Product Manager

In the FeedReader sample (available in the New Projects window), there's this piece of code:

private static Feed getFeed(Node node) {
InstanceCookie ck = node.getLookup().lookup(InstanceCookie.class);
if (ck == null) {
throw new IllegalStateException("Bogus file in feeds folder: " +
node.getLookup().lookup(FileObject.class));
}
try {
return (Feed) ck.instanceCreate();
} catch (ClassNotFoundException ex) {
Exceptions.printStackTrace(ex);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}

Since 7.1, for some reason, the above doesn't work. What does work, and is simpler, is this, instead of the above:

private static Feed getFeed(Node node) {
Feed f = FileUtil.getConfigObject("RssFeeds/sample.instance", Feed.class);
if (f == null) {
throw new IllegalStateException("Bogus file in feeds folder: " +
node.getLookup().lookup(FileObject.class));
}
return f;
}

So, the code needs to be fixed in the sample.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.