I would like use RSSUtil to read an RSS feed but i'm facing a problem with the class loader...
The exception thrown is :
com.sun.syndication.feed.synd.SyndFeedImpl cannot be cast to com.sun.syndication.feed.synd.SyndFeedImpl
My Code is :
SyndFeedImpl feed = null;
final String _CLASS_NAME = "com.liferay.portlet.rss.util.RSSUtil";
MethodKey _CONSTRUCTOR = new MethodKey(_CLASS_NAME, "getFeed", String.class);
ObjectValuePair ovp = (ObjectValuePair) PortalClassInvoker.invoke(true, _CONSTRUCTOR, url);
Class<SyndFeed> clazz = (Class<SyndFeed>) PortalClassLoaderUtil.getClassLoader().loadClass(
"com.sun.syndication.feed.synd.SyndFeedImpl");
feed = (SyndFeedImpl) ovp.getValue();
The problem is also explained in https://www.liferay.com/fr/community/forums/-/message_boards/message/15812507. I tried to do the same things but it doesn't work...
Thanks in advance for your help...
UPDATE : if i use the code below (other solution without RSSUtil) :
URL feedUrl = new URL(url);
HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection();
SyndFeedInput input = new SyndFeedInput();
XmlReader reader = new XmlReader(httpcon);
SyndFeed feed = input.build(reader);
The exception thrown is :
java.lang.ClassCastException: com.sun.syndication.feed.synd.impl.ConverterForAtom10 cannot be cast to com.sun.syndication.feed.synd.Converter