From dd265bbd542c3f9e63f99d25c60b0b82447ec77d Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 11 Apr 2015 19:34:34 +0000 Subject: [PATCH] Updates after review: Remove meeh.i2p as update host (ticket #1515) Re-add 193.xxx https reseed Fix SocketManagerFactory property handling Restore UPnP locale fix lost in the merge i2ptunnel finals I2NP unique id fixes duplicate done() in ReseedChecker bigger langbox in CSS reformatting Javadocs --- .../java/src/net/i2p/i2ptunnel/TunnelController.java | 2 ++ .../java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java | 4 ++-- .../java/src/net/i2p/i2ptunnel/web/IndexBean.java | 2 +- .../i2p/client/streaming/I2PSocketManagerFactory.java | 2 +- .../java/src/net/i2p/router/web/ConfigNavHelper.java | 2 ++ .../java/src/net/i2p/router/web/ConfigUpdateHandler.java | 6 +++--- .../freenet/support/CPUInformation/IntelInfoImpl.java | 5 ++--- core/java/src/net/i2p/crypto/SHA256Generator.java | 3 ++- core/java/src/net/i2p/util/LogWriter.java | 6 ++++++ core/java/src/net/i2p/util/LogWriterBase.java | 1 + core/java/src/net/i2p/util/NativeBigInteger.java | 9 ++++----- history.txt | 3 +++ installer/resources/themes/console/classic/console.css | 2 +- installer/resources/themes/console/dark/console.css | 2 +- installer/resources/themes/console/light/console.css | 2 +- .../java/src/net/i2p/data/i2np/DatabaseStoreMessage.java | 2 +- router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java | 9 ++++++++- router/java/src/net/i2p/data/i2np/TunnelDataMessage.java | 2 +- router/java/src/net/i2p/router/Router.java | 2 +- router/java/src/net/i2p/router/RouterVersion.java | 2 +- .../net/i2p/router/networkdb/reseed/ReseedChecker.java | 1 - .../src/net/i2p/router/networkdb/reseed/Reseeder.java | 1 + router/java/src/org/cybergarage/util/FileUtil.java | 3 ++- 23 files changed, 47 insertions(+), 26 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java index 3d822f335..368e81577 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java @@ -44,6 +44,7 @@ public class TunnelController implements Logging { private List _sessions; private volatile TunnelState _state; + /** @since 0.9.19 */ private enum TunnelState { START_ON_LOAD, STARTING, @@ -849,6 +850,7 @@ public class TunnelController implements Logging { return true; } + /** @since 0.9.19 */ private synchronized void changeState(TunnelState state) { _state = state; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java index 6405e98d4..2073efdf2 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java @@ -44,8 +44,8 @@ public class GeneralHelper { private static final String OPT = TunnelController.PFX_OPTION; - private I2PAppContext _context; - protected TunnelControllerGroup _group; + private final I2PAppContext _context; + protected final TunnelControllerGroup _group; public GeneralHelper(TunnelControllerGroup tcg) { this(I2PAppContext.getGlobalContext(), tcg); diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java index 0480527f4..ccb30ca99 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java @@ -53,7 +53,7 @@ public class IndexBean { private String _curNonce; //private long _nextNonce; - private TunnelConfig _config; + private final TunnelConfig _config; private boolean _removeConfirmed; private int _hashCashValue; private int _certType; diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java index 00c04d83b..863c5d31a 100644 --- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java +++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java @@ -227,7 +227,7 @@ public class I2PSocketManagerFactory { Properties syscopy = (Properties) System.getProperties().clone(); for (Map.Entry e : syscopy.entrySet()) { String name = (String) e.getKey(); - if (opts.getProperty(name) != null) + if (opts.getProperty(name) == null) opts.setProperty(name, (String) e.getValue()); } // as of 0.8.1 (I2CP default is BestEffort) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java index 56371c1c2..5282b4a89 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNavHelper.java @@ -27,6 +27,7 @@ public class ConfigNavHelper extends HelperBase { _x("Clients"), _x("Peers"), _x("Keyring"), _x("Logging"), _x("Stats"), _x("Reseeding"), _x("Advanced") }; + /** @since 0.9.19 */ private static class Tab { public final String page, title; public Tab(String p, String t) { @@ -34,6 +35,7 @@ public class ConfigNavHelper extends HelperBase { } } + /** @since 0.9.19 */ private class TabComparator implements Comparator { private static final long serialVersionUID = 1L; private final Collator coll; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java index 3b1b576da..3cd9adbf8 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java @@ -69,7 +69,7 @@ public class ConfigUpdateHandler extends FormHandler { private static final String PACK200_URLS = "http://echelon.i2p/i2p/i2pupdate.su2\r\n" + "http://inr.i2p/i2p/i2pupdate.su2\r\n" + - "http://meeh.i2p/i2pupdate/i2pupdate.su2\r\n" + + //"http://meeh.i2p/i2pupdate/i2pupdate.su2\r\n" + "http://stats.i2p/i2p/i2pupdate.su2\r\n" + // "http://www.i2p2.i2p/_static/i2pupdate.su2\r\n" + "http://update.dg.i2p/files/i2pupdate.su2\r\n" + @@ -79,7 +79,7 @@ public class ConfigUpdateHandler extends FormHandler { private static final String NO_PACK200_URLS = "http://echelon.i2p/i2p/i2pupdate.sud\r\n" + "http://inr.i2p/i2p/i2pupdate.sud\r\n" + - "http://meeh.i2p/i2pupdate/i2pupdate.sud\r\n" + + //"http://meeh.i2p/i2pupdate/i2pupdate.sud\r\n" + "http://stats.i2p/i2p/i2pupdate.sud\r\n" + // "http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" + "http://update.dg.i2p/files/i2pupdate.sud\r\n" + @@ -113,7 +113,7 @@ public class ConfigUpdateHandler extends FormHandler { private static final String DEFAULT_SU3_UPDATE_URLS = "http://echelon.i2p/i2p/i2pupdate.su3\r\n" + "http://inr.i2p/i2p/i2pupdate.su3\r\n" + - "http://meeh.i2p/i2pupdate/i2pupdate.su3\r\n" + + //"http://meeh.i2p/i2pupdate/i2pupdate.su3\r\n" + "http://stats.i2p/i2p/i2pupdate.su3\r\n" + // "http://www.i2p2.i2p/_static/i2pupdate.su3\r\n" + "http://update.dg.i2p/files/i2pupdate.su3\r\n" + diff --git a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java index d18024b34..4e87e2ce7 100644 --- a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java +++ b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java @@ -156,9 +156,8 @@ class IntelInfoImpl extends CPUIDCPUInfo implements IntelCPUInfo isPentiumMCompatible = true; isCore2Compatible = true; isX64 = true; - } - if (extmodel >= 2) { - isCoreiCompatible = true; + if (extmodel >= 2) + isCoreiCompatible = true; } switch (model) { case 0: diff --git a/core/java/src/net/i2p/crypto/SHA256Generator.java b/core/java/src/net/i2p/crypto/SHA256Generator.java index 217147f7b..66d630087 100644 --- a/core/java/src/net/i2p/crypto/SHA256Generator.java +++ b/core/java/src/net/i2p/crypto/SHA256Generator.java @@ -77,8 +77,9 @@ public final class SHA256Generator { digest.digest(out, outOffset, Hash.HASH_LENGTH); } catch (DigestException e) { throw new RuntimeException(e); + } finally { + release(digest); } - release(digest); } private MessageDigest acquire() { diff --git a/core/java/src/net/i2p/util/LogWriter.java b/core/java/src/net/i2p/util/LogWriter.java index f695b08a2..d44bcb1b0 100644 --- a/core/java/src/net/i2p/util/LogWriter.java +++ b/core/java/src/net/i2p/util/LogWriter.java @@ -74,6 +74,9 @@ class LogWriter extends LogWriterBase { } } + /** + * @since 0.9.19 + */ protected void flushWriter() { try { if (_currentOut != null) @@ -84,6 +87,9 @@ class LogWriter extends LogWriterBase { } } + /** + * @since 0.9.19 renamed from closeFile() + */ protected void closeWriter() { Writer out = _currentOut; if (out != null) { diff --git a/core/java/src/net/i2p/util/LogWriterBase.java b/core/java/src/net/i2p/util/LogWriterBase.java index 8c2430c43..117e2786f 100644 --- a/core/java/src/net/i2p/util/LogWriterBase.java +++ b/core/java/src/net/i2p/util/LogWriterBase.java @@ -16,6 +16,7 @@ import java.util.Queue; * the log. This also periodically instructs the LogManager to reread its config * file. * + * @since 0.9.19 pulled from LogWriter so Android may extend */ abstract class LogWriterBase implements Runnable { /** every 10 seconds? why? Just have the gui force a reread after a change?? */ diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index 550060656..afb380cf9 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -196,15 +196,14 @@ public class NativeBigInteger extends BigInteger { private final static String sCPUType; //The CPU Type to optimize for (one of the above strings) static { - if (_isX86) {// Don't try to resolve CPU type on non x86 hardware + if (_isX86) { // Don't try to resolve CPU type on non x86 hardware sCPUType = resolveCPUType(); - } - else if (_isArm) { + } else if (_isArm) { sCPUType = JBIGI_OPTIMIZATION_ARM; } else if (_isPPC && !_isMac) { - sCPUType = JBIGI_OPTIMIZATION_PPC; + sCPUType = JBIGI_OPTIMIZATION_PPC; } else { - sCPUType = null; + sCPUType = null; } loadNative(); } diff --git a/history.txt b/history.txt index f9404548d..e54b81611 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2015-04-11 zzz + * Updates after review + 2015-04-09 kytv * Updates to geoip.txt and geoipv6.dat.gz based on Maxmind GeoLite Country database from 2015-04-07. diff --git a/installer/resources/themes/console/classic/console.css b/installer/resources/themes/console/classic/console.css index b95f609bc..398329923 100644 --- a/installer/resources/themes/console/classic/console.css +++ b/installer/resources/themes/console/classic/console.css @@ -995,7 +995,7 @@ p img:first-child { margin: 5px 5px 0 5px; color: #001; font-size: 7pt; - width: 320px; + width: 330px; text-align: right; float: right; valign: middle; diff --git a/installer/resources/themes/console/dark/console.css b/installer/resources/themes/console/dark/console.css index a36b22281..282d0d599 100644 --- a/installer/resources/themes/console/dark/console.css +++ b/installer/resources/themes/console/dark/console.css @@ -882,7 +882,7 @@ button:active { padding: 0; color: #EE9; font-size: 7pt; - width: 290px; + width: 300px; text-align: right; float: right; vertical-align: middle; diff --git a/installer/resources/themes/console/light/console.css b/installer/resources/themes/console/light/console.css index fe5ef0fe9..62b7969f3 100644 --- a/installer/resources/themes/console/light/console.css +++ b/installer/resources/themes/console/light/console.css @@ -1088,7 +1088,7 @@ button:active { padding: 2px 5px; color: #001; font-size: 7pt; - width: 320px; + width: 330px; text-align: right; float: right; vertical-align: middle; diff --git a/router/java/src/net/i2p/data/i2np/DatabaseStoreMessage.java b/router/java/src/net/i2p/data/i2np/DatabaseStoreMessage.java index 8d50fabd1..cff476b61 100644 --- a/router/java/src/net/i2p/data/i2np/DatabaseStoreMessage.java +++ b/router/java/src/net/i2p/data/i2np/DatabaseStoreMessage.java @@ -256,7 +256,7 @@ public class DatabaseStoreMessage extends FastI2NPMessageImpl { StringBuilder buf = new StringBuilder(); buf.append("[DatabaseStoreMessage: "); buf.append("\n\tExpiration: ").append(new Date(_expiration)); - buf.append("\n\tUnique ID: ").append(_uniqueId); + buf.append("\n\tUnique ID: ").append(getUniqueId()); if (_replyToken != 0) { buf.append("\n\tReply token: ").append(_replyToken); buf.append("\n\tReply tunnel: ").append(_replyTunnel); diff --git a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java index 432a5e813..ea080d374 100644 --- a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java +++ b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java @@ -31,6 +31,13 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM protected final Log _log; protected final I2PAppContext _context; protected long _expiration; + + /** + * Warning, lazily initialized by readBytes(), writeBytes(), toByteArray(), + * getUniqueId(), and setUniqueId(); otherwise will be -1. + * Extending classes should take care when accessing this field; + * to ensure initialization, use getUniqueId() instead. + */ protected long _uniqueId = -1; public final static long DEFAULT_EXPIRATION_MS = 1*60*1000; // 1 minute by default @@ -257,7 +264,7 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM } /** - * The ID is set to a random value in the constructor but it can be overridden here. + * The ID is set to a random value when written but it can be overridden here. */ public void setUniqueId(long id) { _uniqueId = id; } diff --git a/router/java/src/net/i2p/data/i2np/TunnelDataMessage.java b/router/java/src/net/i2p/data/i2np/TunnelDataMessage.java index f31e6cc4d..bac9b5b3f 100644 --- a/router/java/src/net/i2p/data/i2np/TunnelDataMessage.java +++ b/router/java/src/net/i2p/data/i2np/TunnelDataMessage.java @@ -234,7 +234,7 @@ public class TunnelDataMessage extends FastI2NPMessageImpl { public String toString() { StringBuilder buf = new StringBuilder(); buf.append("[TunnelDataMessage:"); - buf.append(" MessageId: ").append(_uniqueId); + buf.append(" MessageId: ").append(getUniqueId()); buf.append(" Tunnel ID: ").append(_tunnelId); buf.append("]"); return buf.toString(); diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 4916d8d72..9007cdea1 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -1508,7 +1508,7 @@ public class Router implements RouterClock.ClockShiftListener { * Context must be available. * Unzip update file found in the router dir OR base dir, to the base dir * - * If successfull, will call exit() and never return. + * If successful, will call exit() and never return. * * If we can't write to the base dir, complain. * Note: _log not available here. diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 987fc2f75..78754ef28 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 = 19; + public final static long BUILD = 20; /** for example "-test" */ public final static String EXTRA = "-rc"; diff --git a/router/java/src/net/i2p/router/networkdb/reseed/ReseedChecker.java b/router/java/src/net/i2p/router/networkdb/reseed/ReseedChecker.java index df4f31300..d6620b262 100644 --- a/router/java/src/net/i2p/router/networkdb/reseed/ReseedChecker.java +++ b/router/java/src/net/i2p/router/networkdb/reseed/ReseedChecker.java @@ -158,7 +158,6 @@ public class ReseedChecker { } catch (IOException ioe) { if (ioe.getMessage() != null) setError(DataHelper.escapeHTML(ioe.getMessage())); - done(); throw ioe; } finally { done(); diff --git a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java index 1cfe767be..1782c7d06 100644 --- a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java +++ b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java @@ -88,6 +88,7 @@ public class Reseeder { "https://netdb.rows.io:444/" + "," + // Only HTTPS and SU3 (v3) support "https://i2pseed.zarrenspry.info/" + "," + // Only HTTPS and SU3 (v3) support "https://i2p.mooo.com/netDb/" + "," + + "https://193.150.121.66/netDb/" + "," + "https://netdb.i2p2.no/" + "," + // Only SU3 (v3) support "https://us.reseed.i2p2.no:444/" + "," + "https://uk.reseed.i2p2.no:444/" + "," + diff --git a/router/java/src/org/cybergarage/util/FileUtil.java b/router/java/src/org/cybergarage/util/FileUtil.java index 5c2744d4d..5b1cc5cdc 100644 --- a/router/java/src/org/cybergarage/util/FileUtil.java +++ b/router/java/src/org/cybergarage/util/FileUtil.java @@ -18,6 +18,7 @@ package org.cybergarage.util; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; +import java.util.Locale; public final class FileUtil { @@ -72,7 +73,7 @@ public final class FileUtil { if (StringUtil.hasData(name) == false) return false; - String lowerName = name.toLowerCase(); + String lowerName = name.toLowerCase(Locale.US); return lowerName.endsWith("xml"); } }