diff --git a/history.txt b/history.txt index 9d26d6dac4f4b5d6c24a5588588a43072e2d0b5f..aafbc61d0ae35fb63f7c297c4bea0acf45ddde04 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2011-05-22 zzz + * GeoIP: Read countries.txt in UTF-8 + * Jetty: Fix build error that omitted local jetty patches from org.mortbay.jetty.jar; + affected 0.8.4 and 0.8.6 installers. Include jar in the updater for the next release. + 2011-05-21 sponge * mbuild.sh document and fixes * mbuild-all.sh add cpu types diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 282c18b42238909e2faa8bba95d82c15667d116c..0725033fa600cfb5180ac82283f5194ee35b34b0 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 2; + public final static long BUILD = 3; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/transport/GeoIP.java b/router/java/src/net/i2p/router/transport/GeoIP.java index 1593487cf9d950d0f9fd413e0b8eab21bb6466b8..a701a24aff3292b20f126eb96f213762bc106471 100644 --- a/router/java/src/net/i2p/router/transport/GeoIP.java +++ b/router/java/src/net/i2p/router/transport/GeoIP.java @@ -4,10 +4,12 @@ package net.i2p.router.transport; * Use at your own risk. */ +import java.io.BufferedReader; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.net.InetAddress; +import java.io.InputStreamReader; import java.net.UnknownHostException; import java.util.Arrays; import java.util.Map; @@ -37,8 +39,8 @@ import net.i2p.util.Log; * @author zzz */ class GeoIP { - private Log _log; - private RouterContext _context; + private final Log _log; + private final RouterContext _context; private final Map<String, String> _codeToName; private final Map<Long, String> _IPToCountry; private final Set<Long> _pendingSearch; @@ -142,7 +144,7 @@ class GeoIP { private void readCountryFile() { File GeoFile = new File(_context.getBaseDir(), GEOIP_DIR_DEFAULT); GeoFile = new File(GeoFile, COUNTRY_FILE_DEFAULT); - if (GeoFile == null || (!GeoFile.exists())) { + if (!GeoFile.exists()) { if (_log.shouldLog(Log.WARN)) _log.warn("Country file not found: " + GeoFile.getAbsolutePath()); return; @@ -150,19 +152,17 @@ class GeoIP { FileInputStream in = null; try { in = new FileInputStream(GeoFile); - StringBuilder buf = new StringBuilder(128); - while (DataHelper.readLine(in, buf)) { + BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); + String line = null; + while ( (line = br.readLine()) != null) { try { - if (buf.charAt(0) == '#') { - buf.setLength(0); + if (line.charAt(0) == '#') { continue; } - String[] s = buf.toString().split(","); - // todo convert name to mixed upper/lower case + String[] s = line.split(","); _codeToName.put(s[0].toLowerCase(), s[1]); } catch (IndexOutOfBoundsException ioobe) { } - buf.setLength(0); } } catch (IOException ioe) { if (_log.shouldLog(Log.ERROR))