forked from I2P_Developers/i2p.i2p
* Clone System properties before iterating to avoid
ConcurrentModificationException (ticket #680)
This commit is contained in:
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
@ -36,7 +37,7 @@ public class I2PSocketManagerFactory {
|
|||||||
* @return the newly created socket manager, or null if there were errors
|
* @return the newly created socket manager, or null if there were errors
|
||||||
*/
|
*/
|
||||||
public static I2PSocketManager createManager() {
|
public static I2PSocketManager createManager() {
|
||||||
return createManager(getHost(), getPort(), System.getProperties());
|
return createManager(getHost(), getPort(), (Properties) System.getProperties().clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +60,7 @@ public class I2PSocketManagerFactory {
|
|||||||
* @return the newly created socket manager, or null if there were errors
|
* @return the newly created socket manager, or null if there were errors
|
||||||
*/
|
*/
|
||||||
public static I2PSocketManager createManager(String host, int port) {
|
public static I2PSocketManager createManager(String host, int port) {
|
||||||
return createManager(host, port, System.getProperties());
|
return createManager(host, port, (Properties) System.getProperties().clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +96,7 @@ public class I2PSocketManagerFactory {
|
|||||||
* @return the newly created socket manager, or null if there were errors
|
* @return the newly created socket manager, or null if there were errors
|
||||||
*/
|
*/
|
||||||
public static I2PSocketManager createManager(InputStream myPrivateKeyStream) {
|
public static I2PSocketManager createManager(InputStream myPrivateKeyStream) {
|
||||||
return createManager(myPrivateKeyStream, getHost(), getPort(), System.getProperties());
|
return createManager(myPrivateKeyStream, getHost(), getPort(), (Properties) System.getProperties().clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,10 +127,11 @@ public class I2PSocketManagerFactory {
|
|||||||
I2PClient client = I2PClientFactory.createClient();
|
I2PClient client = I2PClientFactory.createClient();
|
||||||
if (opts == null)
|
if (opts == null)
|
||||||
opts = new Properties();
|
opts = new Properties();
|
||||||
for (Iterator iter = System.getProperties().keySet().iterator(); iter.hasNext(); ) {
|
Properties syscopy = (Properties) System.getProperties().clone();
|
||||||
String name = (String)iter.next();
|
for (Map.Entry e : syscopy.entrySet()) {
|
||||||
|
String name = (String) e.getKey();
|
||||||
if (!opts.containsKey(name))
|
if (!opts.containsKey(name))
|
||||||
opts.setProperty(name, System.getProperty(name));
|
opts.setProperty(name, (String) e.getValue());
|
||||||
}
|
}
|
||||||
//boolean oldLib = DEFAULT_MANAGER.equals(opts.getProperty(PROP_MANAGER, DEFAULT_MANAGER));
|
//boolean oldLib = DEFAULT_MANAGER.equals(opts.getProperty(PROP_MANAGER, DEFAULT_MANAGER));
|
||||||
//if (oldLib && false) {
|
//if (oldLib && false) {
|
||||||
|
@ -124,8 +124,7 @@ public class SAMStreamSession {
|
|||||||
|
|
||||||
_log.debug("SAM STREAM session instantiated");
|
_log.debug("SAM STREAM session instantiated");
|
||||||
|
|
||||||
Properties allprops = new Properties();
|
Properties allprops = (Properties) System.getProperties().clone();
|
||||||
allprops.putAll(System.getProperties());
|
|
||||||
allprops.putAll(props);
|
allprops.putAll(props);
|
||||||
|
|
||||||
String i2cpHost = allprops.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
|
String i2cpHost = allprops.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
|
||||||
|
@ -85,8 +85,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
|
|
||||||
_log.debug("SAM STREAM session instantiated");
|
_log.debug("SAM STREAM session instantiated");
|
||||||
|
|
||||||
Properties allprops = new Properties();
|
Properties allprops = (Properties) System.getProperties().clone();
|
||||||
allprops.putAll(System.getProperties());
|
|
||||||
allprops.putAll(rec.getProps());
|
allprops.putAll(rec.getProps());
|
||||||
|
|
||||||
String i2cpHost = allprops.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
|
String i2cpHost = allprops.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
|
||||||
|
@ -516,7 +516,8 @@ public class I2PAppContext {
|
|||||||
* @return set of Strings containing the names of defined system properties
|
* @return set of Strings containing the names of defined system properties
|
||||||
*/
|
*/
|
||||||
public Set getPropertyNames() {
|
public Set getPropertyNames() {
|
||||||
Set names = new HashSet(System.getProperties().keySet());
|
// clone to avoid ConcurrentModificationException
|
||||||
|
Set names = new HashSet(((Properties) System.getProperties().clone()).keySet());
|
||||||
if (_overrideProps != null)
|
if (_overrideProps != null)
|
||||||
names.addAll(_overrideProps.keySet());
|
names.addAll(_overrideProps.keySet());
|
||||||
return names;
|
return names;
|
||||||
@ -531,8 +532,8 @@ public class I2PAppContext {
|
|||||||
* @since 0.8.4
|
* @since 0.8.4
|
||||||
*/
|
*/
|
||||||
public Properties getProperties() {
|
public Properties getProperties() {
|
||||||
Properties rv = new Properties();
|
// clone to avoid ConcurrentModificationException
|
||||||
rv.putAll(System.getProperties());
|
Properties rv = (Properties) System.getProperties().clone();
|
||||||
rv.putAll(_overrideProps);
|
rv.putAll(_overrideProps);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
_log = context.logManager().getLog(getClass());
|
_log = context.logManager().getLog(getClass());
|
||||||
_closed = true;
|
_closed = true;
|
||||||
if (options == null)
|
if (options == null)
|
||||||
options = System.getProperties();
|
options = (Properties) System.getProperties().clone();
|
||||||
loadConfig(options);
|
loadConfig(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2012-08-06 zzz
|
||||||
|
* Clone System properties before iterating to avoid
|
||||||
|
ConcurrentModificationException (ticket #680)
|
||||||
|
* Console: Fix flag links on /console to return to same page
|
||||||
|
* i2psnark: Add support for DHT (disabled by default)
|
||||||
|
* jbigi: Add ARMv6 libjbigi.so for Raspberry Pi
|
||||||
|
|
||||||
2012-08-05 zzz
|
2012-08-05 zzz
|
||||||
* I2PSessionImpl: One more volatile (ticket #659)
|
* I2PSessionImpl: One more volatile (ticket #659)
|
||||||
* i2ptunnel, I2CP, EepGet: Buffer socket input streams (ticket #666)
|
* i2ptunnel, I2CP, EepGet: Buffer socket input streams (ticket #666)
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 3;
|
public final static long BUILD = 4;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user