diff --git a/build.xml b/build.xml index 3a36de8b6448f4eb7b3549a807f349f03152890d..bf27fd748ddbc0ff9818c88c8279571a61f0085d 100644 --- a/build.xml +++ b/build.xml @@ -1827,7 +1827,6 @@ <copy file="build/addressbook.war" todir="pkg-temp/webapps/" /> <!-- decapitalized the file in 0.7.8 --> <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" /> - <copy file="installer/resources/continents.txt" todir="pkg-temp/geoip/" /> <!-- <copy file="installer/resources/public-suffix-list.txt" todir="pkg-temp/geoip/" /> --> @@ -1846,7 +1845,6 @@ <!-- GeoIP files --> <target name="prepgeoupdate" depends="prepgeoupdate-unlesspkg" > <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" /> - <copy file="installer/resources/continents.txt" todir="pkg-temp/geoip/" /> <!-- <copy file="installer/resources/public-suffix-list.txt" todir="pkg-temp/geoip/" /> --> diff --git a/core/java/build.xml b/core/java/build.xml index 895a93f978d9cf8e53fd9dcdba694bce1fe19754..217e5ae971f8c3cd431acad0e0e51137a5bda4df 100644 --- a/core/java/build.xml +++ b/core/java/build.xml @@ -109,9 +109,12 @@ <target name="jar" depends="compile, bundle, jarUpToDate, listChangedFiles" unless="jar.uptodate" > <!-- set if unset --> <property name="workspace.changes.tr" value="" /> + <mkdir dir="build/obj/net/i2p/util/resources" /> + <copy todir="build/obj/net/i2p/util/resources" > + <fileset dir="../resources" /> + </copy> <jar destfile="./build/i2p.jar" > - <fileset dir="./build/obj" includes="**/*.class" /> - <fileset dir="./src" includes="net/i2p/util/resources/*" /> + <fileset dir="./build/obj" /> <!-- the getopt translation files --> <fileset dir="src" includes="${translation.includes}" /> <manifest> diff --git a/core/java/src/net/i2p/util/resources/dohservers.txt b/core/resources/dohservers.txt similarity index 100% rename from core/java/src/net/i2p/util/resources/dohservers.txt rename to core/resources/dohservers.txt diff --git a/router/java/build.xml b/router/java/build.xml index 0e1c3db2105a07f37a54677c8f3b0932d03b8f9e..8ff50285ea85947974d69efc9d082d7ce11a5497 100644 --- a/router/java/build.xml +++ b/router/java/build.xml @@ -70,7 +70,11 @@ <target name="jar" depends="compile, bundle, jarUpToDate, listChangedFiles" unless="jar.uptodate" > <!-- set if unset --> <property name="workspace.changes.tr" value="" /> - <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" > + <mkdir dir="build/obj/net/i2p/router/util/resources" /> + <copy todir="build/obj/net/i2p/router/util/resources" > + <fileset dir="../resources" /> + </copy> + <jar destfile="./build/router.jar" basedir="./build/obj" > <manifest> <!-- so people with very old wrapper.config files will still work with Jetty 6 --> <attribute name="${manifest.classpath.name}" value="i2p.jar addressbook.jar jetty-i2p.jar jetty-rewrite-handler.jar jetty-start.jar jetty-util.jar" /> diff --git a/router/java/src/net/i2p/router/time/Zones.java b/router/java/src/net/i2p/router/time/Zones.java index d04c67408ee7f191e7781faccf255f0a48b7fbc1..ad13c6e5d962877643cef7cf5aa7ce5d3892cba7 100644 --- a/router/java/src/net/i2p/router/time/Zones.java +++ b/router/java/src/net/i2p/router/time/Zones.java @@ -3,7 +3,7 @@ package net.i2p.router.time; import java.io.BufferedReader; import java.io.IOException; import java.io.File; -import java.io.FileInputStream; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Locale; @@ -87,20 +87,14 @@ class Zones { * ref: http://dev.maxmind.com/geoip/legacy/codes/country_continent/ */ private void readContinentFile() { - String geoDir = _context.getProperty(GeoIP.PROP_GEOIP_DIR, GeoIP.GEOIP_DIR_DEFAULT); - File geoFile = new File(geoDir); - if (!geoFile.isAbsolute()) - geoFile = new File(_context.getBaseDir(), geoDir); - geoFile = new File(geoFile, CONTINENT_FILE_DEFAULT); - if (!geoFile.exists()) { - //if (_log.shouldWarn()) - // _log.warn("Continent file not found: " + geoFile.getAbsolutePath()); + InputStream is = Zones.class.getResourceAsStream("/net/i2p/router/util/resources/" + CONTINENT_FILE_DEFAULT); + if (is == null) { + System.out.println("Continent file not found"); return; } BufferedReader br = null; try { - br = new BufferedReader(new InputStreamReader( - new FileInputStream(geoFile), "UTF-8")); + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = null; while ((line = br.readLine()) != null) { try { @@ -118,8 +112,9 @@ class Zones { } catch (IndexOutOfBoundsException ioobe) {} } } catch (IOException ioe) { - System.out.println("Error reading the continent file " + geoFile.getAbsolutePath()); + System.out.println("Error reading the continent file"); } finally { + try { is.close(); } catch (IOException ioe) {} if (br != null) try { br.close(); } catch (IOException ioe) {} } } diff --git a/installer/resources/continents.txt b/router/resources/continents.txt similarity index 100% rename from installer/resources/continents.txt rename to router/resources/continents.txt