diff options
author | Michael Bien <[email protected]> | 2010-06-20 21:51:40 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-06-20 21:51:40 +0200 |
commit | fa50256fae31ad8499ade311a4bfa4dc446a2ada (patch) | |
tree | a8eb8522b77558ce376d694e80775be227406d52 /src | |
parent | 116a6c13ca44efce27b228d96eb607f0c112763c (diff) |
maven jar assambler plugin + configuration loading fix.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/jogamp/hungryharry/FeedAggregator.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/com/jogamp/hungryharry/FeedAggregator.java b/src/main/java/com/jogamp/hungryharry/FeedAggregator.java index 7d2ea1d..2f5ec27 100644 --- a/src/main/java/com/jogamp/hungryharry/FeedAggregator.java +++ b/src/main/java/com/jogamp/hungryharry/FeedAggregator.java @@ -9,7 +9,9 @@ import com.sun.syndication.io.SyndFeedOutput; import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.fetcher.FetcherException; import com.sun.syndication.io.FeedException; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -26,6 +28,7 @@ import freemarker.template.DefaultObjectWrapper; import freemarker.template.Template; import freemarker.template.TemplateException; import java.io.File; +import java.io.FileInputStream; import java.io.FileWriter; import java.io.Writer; import java.util.Comparator; @@ -64,6 +67,8 @@ public class FeedAggregator { config = readConfiguration(); } catch (JAXBException ex) { throw new RuntimeException("can not read configuration", ex); + } catch (FileNotFoundException ex) { + throw new RuntimeException("can not read configuration", ex); } List<Config.Feed> feeds = config.feed; @@ -176,9 +181,15 @@ public class FeedAggregator { return entries; } - private Config readConfiguration() throws JAXBException { + private Config readConfiguration() throws JAXBException, FileNotFoundException { Unmarshaller unmarshaller = JAXBContext.newInstance(Config.class).createUnmarshaller(); - Object obj = unmarshaller.unmarshal(getClass().getResourceAsStream(configFile)); + LOG.info("reading config file: " + configFile); + InputStream is = getClass().getResourceAsStream(configFile); + if(is == null) { + is = new FileInputStream(configFile); + } + + Object obj = unmarshaller.unmarshal(is); return (Config) obj; } |