diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java index 110d62984..17049626c 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java @@ -1463,6 +1463,7 @@ public class I2PTunnel implements Logging, EventDispatcher { /** * Create a new destination, storing the destination and its private keys where * instructed + * Deprecated - only used by CLI * * @param writeTo location to store the private keys * @param pubDest location to store the destination @@ -1487,6 +1488,7 @@ public class I2PTunnel implements Logging, EventDispatcher { /** * Read in the given destination, display it, and write it to the given location + * Deprecated - only used by CLI * * @param readFrom stream to read the destination from * @param pubDest stream to write the destination to @@ -1508,6 +1510,7 @@ public class I2PTunnel implements Logging, EventDispatcher { /** * Write out the destination to the stream + * Deprecated - only used by CLI * * @param d Destination to write * @param o stream to write the destination to @@ -1525,6 +1528,9 @@ public class I2PTunnel implements Logging, EventDispatcher { * also supported, where filename is a file that either contains a * binary Destination structure or the Base64 encoding of that * structure. + * + * Since file: isn't really used, this method is deprecated, + * just call context.namingService.lookup() directly. */ public static Destination destFromName(String name) throws DataFormatException { diff --git a/core/java/src/net/i2p/I2PAppContext.java b/core/java/src/net/i2p/I2PAppContext.java index aac61d4be..1bfde4aad 100644 --- a/core/java/src/net/i2p/I2PAppContext.java +++ b/core/java/src/net/i2p/I2PAppContext.java @@ -586,12 +586,14 @@ public class I2PAppContext { } } + /** @deprecated unused */ public HMAC256Generator hmac256() { if (!_hmac256Initialized) initializeHMAC256(); return _hmac256; } + /** @deprecated unused */ private void initializeHMAC256() { synchronized (this) { if (_hmac256 == null) { diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java index 3c83d6527..0743defde 100644 --- a/core/java/src/net/i2p/data/DataHelper.java +++ b/core/java/src/net/i2p/data/DataHelper.java @@ -98,6 +98,10 @@ public class DataHelper { /** * Write a mapping to the stream, as defined by the I2P data structure spec, * and store it into a Properties object. See readProperties for the format. + * Property keys and values must not contain '=' or ';', this is not checked and they are not escaped + * Keys and values must be 255 bytes or less, + * Formatted length must not exceed 65535 bytes + * @throws DataFormatException if either is too long. * * @param rawStream stream to write to * @param props properties to write out @@ -111,6 +115,11 @@ public class DataHelper { /** * Writes the props to the stream, sorted by property name. + * See readProperties() for the format. + * Property keys and values must not contain '=' or ';', this is not checked and they are not escaped + * Keys and values must be 255 bytes or less, + * Formatted length must not exceed 65535 bytes + * @throws DataFormatException if either is too long. * * jrandom disabled UTF-8 in mid-2004, for performance reasons, * i.e. slow foo.getBytes("UTF-8") @@ -151,8 +160,19 @@ public class DataHelper { } /* - * Reads the props from the byte array - * @param props returned OrderedProperties (sorted by property name) + * Writes the props to the byte array, sorted + * See readProperties() for the format. + * Property keys and values must not contain '=' or ';', this is not checked and they are not escaped + * Keys and values must be 255 bytes or less, + * @throws DataFormatException if too long. + * Formatted length must not exceed 65535 bytes + * Should throw DataFormatException if too long but it doesn't. + * Warning - confusing method name, Properties is the source. + * + * @deprecated unused + * + * @param target returned array as specified in data structure spec + * @param props source * @return new offset */ public static int toProperties(byte target[], int offset, Properties props) throws DataFormatException, IOException { @@ -185,8 +205,14 @@ public class DataHelper { } /** - * Writes the props to the byte array, not sorted - * (unless the target param is an OrderedProperties) + * Reads the props from the byte array and puts them in the Properties target + * See readProperties() for the format. + * Warning - confusing method name, Properties is the target. + * + * @deprecated unused + * + * @param source source + * @param target returned Properties * @return new offset */ public static int fromProperties(byte source[], int offset, Properties target) throws DataFormatException, IOException { @@ -214,6 +240,15 @@ public class DataHelper { /** * Writes the props to returned byte array, not sorted * (unless the opts param is an OrderedProperties) + * See readProperties() for the format. + * Property keys and values must not contain '=' or ';', this is not checked and they are not escaped + * Keys and values must be 255 bytes or less, + * Formatted length must not exceed 65535 bytes + * Warning - confusing method name, Properties is the source. + * + * @deprecated unused + * + * @throws RuntimeException if either is too long. */ public static byte[] toProperties(Properties opts) { try { @@ -604,6 +639,7 @@ public class DataHelper { * @throws DataFormatException if the boolean is not valid * @throws IOException if there is an IO error reading the boolean * @return boolean value, or null + * @deprecated unused */ public static Boolean readBoolean(InputStream in) throws DataFormatException, IOException { int val = (int) readLong(in, 1); @@ -626,6 +662,7 @@ public class DataHelper { * @param bool boolean value, or null * @throws DataFormatException if the boolean is not valid * @throws IOException if there is an IO error writing the boolean + * @deprecated unused */ public static void writeBoolean(OutputStream out, Boolean bool) throws DataFormatException, IOException { @@ -637,6 +674,7 @@ public class DataHelper { writeLong(out, 1, BOOLEAN_FALSE); } + /** @deprecated unused */ public static Boolean fromBoolean(byte data[], int offset) { if (data[offset] == BOOLEAN_TRUE) return Boolean.TRUE; @@ -646,9 +684,12 @@ public class DataHelper { return null; } + /** @deprecated unused */ public static void toBoolean(byte data[], int offset, boolean value) { data[offset] = (value ? BOOLEAN_TRUE : BOOLEAN_FALSE); } + + /** @deprecated unused */ public static void toBoolean(byte data[], int offset, Boolean value) { if (value == null) data[offset] = BOOLEAN_UNKNOWN; @@ -656,9 +697,13 @@ public class DataHelper { data[offset] = (value.booleanValue() ? BOOLEAN_TRUE : BOOLEAN_FALSE); } + /** deprecated - used only in DatabaseLookupMessage */ public static final byte BOOLEAN_TRUE = 0x1; + /** deprecated - used only in DatabaseLookupMessage */ public static final byte BOOLEAN_FALSE = 0x0; + /** @deprecated unused */ public static final byte BOOLEAN_UNKNOWN = 0x2; + /** @deprecated unused */ public static final int BOOLEAN_LENGTH = 1; // diff --git a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java index 108ee0eb0..ae22437b8 100644 --- a/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java +++ b/router/java/src/net/i2p/data/i2np/I2NPMessageImpl.java @@ -58,6 +58,10 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM //_context.statManager().createRateStat("i2np.readTime", "How long it takes to read an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 }); } + /** + * Read the whole message (including the type) and throw it away. + * @deprecated Unused, why would you do this + */ public void readBytes(InputStream in) throws DataFormatException, IOException { try { readBytes(in, -1, new byte[1024]); diff --git a/router/java/src/net/i2p/router/peermanager/PeerProfile.java b/router/java/src/net/i2p/router/peermanager/PeerProfile.java index a0e4f76a0..6f7fe54bb 100644 --- a/router/java/src/net/i2p/router/peermanager/PeerProfile.java +++ b/router/java/src/net/i2p/router/peermanager/PeerProfile.java @@ -224,6 +224,7 @@ public class PeerProfile { public double getIntegrationValue() { return _integrationValue; } /** * is this peer actively failing (aka not worth touching)? + * deprecated - unused - always false */ public boolean getIsFailing() { return _isFailing; } @@ -476,7 +477,9 @@ public class PeerProfile { private double calculateSpeed() { return _context.speedCalculator().calc(this); } private double calculateCapacity() { return _context.capacityCalculator().calc(this); } private double calculateIntegration() { return _context.integrationCalculator().calc(this); } + /** deprecated - unused - always false */ private boolean calculateIsFailing() { return false; } + /** deprecated - unused - always false */ void setIsFailing(boolean val) { _isFailing = val; } @Override diff --git a/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java b/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java index 0749e8d6c..747c923ec 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java +++ b/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java @@ -703,6 +703,9 @@ public class EstablishState { * - 4 byte i2p network time as known by the remote side (seconds since the epoch) * - uninterpreted padding data, up to byte 223 * - xor of the local router's identity hash and the SHA256 of bytes 32 through bytes 223 + * + * @return should always be false since nobody ever sends a check info message + * */ private static boolean isCheckInfo(I2PAppContext ctx, Hash us, byte first256[]) { Log log = ctx.logManager().getLog(EstablishState.class); @@ -742,6 +745,8 @@ public class EstablishState { } } + /** @deprecated unused */ +/********* public static void checkHost(String args[]) { if (args.length != 3) { System.err.println("Usage: EstablishState ipOrHostname portNum peerHashBase64"); @@ -779,7 +784,9 @@ public class EstablishState { e.printStackTrace(); } } +*******/ +/******* public static void main(String args[]) { if (args.length == 3) { checkHost(args); @@ -943,6 +950,7 @@ public class EstablishState { e.printStackTrace(); } } +*******/ /** * Mark a string for extraction by xgettext and translation. diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java index 705552c19..7be46e0c7 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java @@ -498,6 +498,8 @@ class BuildHandler { long nextId = req.readNextTunnelId(); boolean isInGW = req.readIsInboundGateway(); boolean isOutEnd = req.readIsOutboundEndpoint(); + // time is in hours, and only for log below - what's the point? + // tunnel-alt-creation.html specifies that this is enforced +/- 1 hour but it is not. long time = req.readRequestTime(); long now = (_context.clock().now() / (60l*60l*1000l)) * (60*60*1000); int ourSlot = -1;