From 234ae6db273f225e1a9a12828bb5c5537eb2860f Mon Sep 17 00:00:00 2001 From: Mike Drob Date: Mon, 3 Aug 2015 10:10:33 -0500 Subject: [PATCH] Use classloader to get config.txt stream --- .gitignore | 2 ++ pom.xml | 24 ++++--------------- src/main/java/SolrLogReader.java | 4 ++-- .../main/resources/chart_template.html | 0 config.txt => src/main/resources/config.txt | 0 5 files changed, 8 insertions(+), 22 deletions(-) rename chart_template.html => src/main/resources/chart_template.html (100%) rename config.txt => src/main/resources/config.txt (100%) diff --git a/.gitignore b/.gitignore index 2a49122..44dd9bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /bin/ /.settings/ target +.classpath +.project diff --git a/pom.xml b/pom.xml index 7309fb5..f1055a3 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,10 @@ + + UTF-8 + + @@ -130,26 +134,6 @@ - - - org.apache.maven.plugins - maven-antrun-plugin - 1.1 - - - prepare-package - - run - - - - - - - - - - diff --git a/src/main/java/SolrLogReader.java b/src/main/java/SolrLogReader.java index ad35ac5..a15b9b5 100644 --- a/src/main/java/SolrLogReader.java +++ b/src/main/java/SolrLogReader.java @@ -18,10 +18,10 @@ import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.PrintStream; import java.io.RandomAccessFile; import java.nio.file.FileAlreadyExistsException; @@ -75,7 +75,7 @@ public static void main(String[] args) throws IOException { public static Map summarize(String[] args) throws FileNotFoundException, IOException { PrintStream out = System.out; Properties props = new Properties(); - FileInputStream fis = new FileInputStream(new File("config.txt")); + InputStream fis = ClassLoader.getSystemResourceAsStream("config.txt"); try { props.load(fis); } finally { diff --git a/chart_template.html b/src/main/resources/chart_template.html similarity index 100% rename from chart_template.html rename to src/main/resources/chart_template.html diff --git a/config.txt b/src/main/resources/config.txt similarity index 100% rename from config.txt rename to src/main/resources/config.txt