Example usage for com.liferay.portal.kernel.webcache WebCacheException WebCacheException

List of usage examples for com.liferay.portal.kernel.webcache WebCacheException WebCacheException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.webcache WebCacheException WebCacheException.

Prototype

public WebCacheException(String msg, Throwable cause) 

Source Link

Usage

From source file:com.liferay.rss.web.internal.util.RSSWebCacheItem.java

License:Open Source License

@Override
public Object convert(String key) throws WebCacheException {

    // com.liferay.portal.kernel.util.HttpUtil will break the connection
    // if it spends more than 5 seconds looking up a location. However,
    // German umlauts do not get encoded correctly. This may be a bug
    // with commons-httpclient or with how FeedParser uses
    // java.io.Reader.

    // Use http://xml.newsisfree.com/feeds/29/629.xml and
    // http://test.domosoft.com/up/RSS to test if German umlauts show up
    // correctly.

    /*Reader reader = new StringReader(
       new String(HttpUtil.URLtoByteArray(_url)));
            /*from   w ww . jav  a2 s  .  c  o m*/
    channel = FeedParser.parse(builder, reader);*/

    SyndFeedInput input = new SyndFeedInput();

    try (InputStream inputStream = _readURL()) {
        return input.build(new XmlReader(inputStream));
    } catch (Exception e) {
        throw new WebCacheException(_url + " " + e.toString(), e);
    }
}