summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-06-20 21:51:40 +0200
committerMichael Bien <[email protected]>2010-06-20 21:51:40 +0200
commitfa50256fae31ad8499ade311a4bfa4dc446a2ada (patch)
treea8eb8522b77558ce376d694e80775be227406d52 /src/main
parent116a6c13ca44efce27b228d96eb607f0c112763c (diff)
maven jar assambler plugin + configuration loading fix.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/jogamp/hungryharry/FeedAggregator.java15
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;
}