<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS</title>
				<description><![CDATA[ Hello all,
I am using the georss module.

I was successful with using this a month ago.
Recently I revisited my code and now I am receiving the following error:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>java.lang.ClassCastException: com.sun.syndication.feed.module.georss.SimpleModuleImpl
        at com.sun.syndication.feed.module.georss.GeoRSSUtils.getGeoRSS&#40;Unknown Source&#41;
</pre>
		</div>

I tried using the simple example on <a href='http://georss.geonames.org/' target='_new' rel="nofollow">http://georss.geonames.org/</a>

Specifically:
[/url]

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>

   SyndFeedInput input = new SyndFeedInput&#40;&#41;;
   SyndFeed feed = input.build&#40;new XmlReader&#40;new URL&#40;
         "http://www.geonames.org/recent-changes.xml"&#41;&#41;&#41;;

   List entries = feed.getEntries&#40;&#41;;
   for &#40;SyndEntry entry : entries&#41; {
        GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS&#40;entry&#41;;
        System.out.println&#40;entry.getTitle&#40;&#41; + " : lat="
              + geoRSSModule.getLatitude&#40;&#41; + ",lng="
              + geoRSSModule.getLongitude&#40;&#41; + ", desc="
              + entry.getDescription&#40;&#41;.getValue&#40;&#41; + "; time="
              + entry.getPublishedDate&#40;&#41;&#41;;
   }

</pre>
		</div>

The error is pointing to this line:
GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS(entry);

Any ideas?
TIA!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/216.page#1146</guid>
				<link>http://forum.geonames.org/gforum/posts/list/216.page#1146</link>
				<pubDate><![CDATA[Wed, 15 Nov 2006 19:59:57]]> GMT</pubDate>
				<author><![CDATA[ Anonymous]]></author>
			</item>
			<item>
				<title>Re:ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS</title>
				<description><![CDATA[ OK I figured it out.


1 other problem.

I want to be able to input any RSS feed geo or otherwise.

What I am doing currently is the following:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>       
            SyndFeed feed = input.build&#40;new XmlReader&#40;url&#41;&#41;;
             List entries = feed.getEntries&#40;&#41;;
                for &#40;Iterator it=entries.iterator&#40;&#41;;it.hasNext&#40;&#41;;&#41; 
                {
                    SyndEntry entry = &#40;SyndEntry&#41; it.next&#40;&#41;;
                    GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS&#40;entry&#41;;
                }
                if&#40;geoRSSModule != null&#41;
                {
                 System.out.println&#40;"NOT NULL"&#41;;
                 out.println&#40;convert.getGeoJSON2&#40;feed&#41;&#41;;
                }
                else
                {
                    System.out.println&#40;"NULL"&#41;;
                    out.println&#40;convert.getJSON&#40;feed&#41;&#41;;
                }
        }
</pre>
		</div>

I am trying to test for null on geoRSSModule but am not successful. Is there another way to check the feed for georss?

Thanks again!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/216.page#1149</guid>
				<link>http://forum.geonames.org/gforum/posts/list/216.page#1149</link>
				<pubDate><![CDATA[Wed, 15 Nov 2006 23:36:38]]> GMT</pubDate>
				<author><![CDATA[ Anonymous]]></author>
			</item>
			<item>
				<title>Re:ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS</title>
				<description><![CDATA[ Hi 

Would you mind sharing with us the solution to your first problem? In case other user are facing the same problem.
My guess is you were using the wrong rome release. Correct?

You can check the geoRSSModule for null to know whether a feed entry has a GeoRSS Element. It does not work for the entire feed, however, as even in a geoRSS feed not every single element necessarily has a geoRSS part. It is legal to mix geoRSS with non geoRSS. If you want to know whether all elements are geoRSS you have to loop over all entries and break the loop as soon as you find the first non-geoRSS element.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/216.page#1150</guid>
				<link>http://forum.geonames.org/gforum/posts/list/216.page#1150</link>
				<pubDate><![CDATA[Thu, 16 Nov 2006 08:03:35]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS</title>
				<description><![CDATA[ I must have corrupted the georss.jar because all I did was to download the jar with source and it started working.

Weird!


I am having trouble with this line of code: 

GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS(entry);

If I pass a non geo rss feed I get a null pointer exception.

I cant figure out how to check it for null.

I tried:
converting it to a string an checking for null.
I tried:
if(geoRSSModule.equals(null))
if(geoRSSModule == null)
etc..
Still I get the null pointer.

Any ideas?
Thanks.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/216.page#1152</guid>
				<link>http://forum.geonames.org/gforum/posts/list/216.page#1152</link>
				<pubDate><![CDATA[Thu, 16 Nov 2006 17:19:09]]> GMT</pubDate>
				<author><![CDATA[ Anonymous]]></author>
			</item>
			<item>
				<title>Re:ClassCastException at ...feed.module.georss.GeoRSSUtils.getGeoRSS</title>
				<description><![CDATA[ Your first code fragment should do the job, but you have to put the if within the for loop.

Regards

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/216.page#1155</guid>
				<link>http://forum.geonames.org/gforum/posts/list/216.page#1155</link>
				<pubDate><![CDATA[Thu, 16 Nov 2006 21:45:46]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
	</channel>
</rss>