diff --git a/README.md b/README.md index 85b02a7f..940df348 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Java 14 must be installed. ## Configuration -Sparrow has a number of command line options, for example to change it's home folder or use testnet: +Sparrow has a number of command line options, for example to change its home folder or use testnet: ``` ./sparrow -h @@ -56,7 +56,7 @@ A final fallback which can be useful when running the Sparrow binary is to creat Note that if you are connecting to an Electrum server when using testnet, that server will need to running on testnet configuration as well. -When not explicitly configured using the command line argument above, Sparrow stores it's mainnet config file, log file and wallets in a home folder location appropriate to the operating system: +When not explicitly configured using the command line argument above, Sparrow stores its mainnet config file, log file and wallets in a home folder location appropriate to the operating system: Platform | Location -------- | -------- diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index db6e9a10..113f5c91 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -28,8 +28,6 @@ import java.util.*; import java.util.stream.Collectors; public class MainApp extends Application { - private static final Logger log = LoggerFactory.getLogger(MainApp.class); - public static final String APP_NAME = "Sparrow"; public static final String APP_VERSION = "0.9.9"; public static final String APP_HOME_PROPERTY = "sparrow.home"; @@ -110,8 +108,8 @@ public class MainApp extends Application { } if(args.dir != null) { - log.info("Using configured Sparrow home folder of " + args.dir); System.setProperty(APP_HOME_PROPERTY, args.dir); + getLogger().info("Using configured Sparrow home folder of " + args.dir); } if(args.network != null) { @@ -122,7 +120,7 @@ public class MainApp extends Application { try { Network.set(Network.valueOf(envNetwork.toUpperCase())); } catch(Exception e) { - log.warn("Invalid " + NETWORK_ENV_PROPERTY + " property: " + envNetwork); + getLogger().warn("Invalid " + NETWORK_ENV_PROPERTY + " property: " + envNetwork); } } } @@ -133,9 +131,13 @@ public class MainApp extends Application { } if(Network.get() != Network.MAINNET) { - log.info("Using " + Network.get() + " configuration"); + getLogger().info("Using " + Network.get() + " configuration"); } com.sun.javafx.application.LauncherImpl.launchApplication(MainApp.class, MainAppPreloader.class, argv); } + + private static Logger getLogger() { + return LoggerFactory.getLogger(MainApp.class); + } } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index ec539792..db555c40 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -343,12 +343,13 @@ public class Config { flush(); } - private void flush() { + private synchronized void flush() { Gson gson = getGson(); try { File configFile = getConfigFile(); Writer writer = new FileWriter(configFile); gson.toJson(this, writer); + writer.flush(); writer.close(); } catch (IOException e) { //Ignore diff --git a/~/.sparrow-peak/config b/~/.sparrow-peak/config deleted file mode 100644 index 9abaecf5..00000000 --- a/~/.sparrow-peak/config +++ /dev/null @@ -1,10 +0,0 @@ -{ - "mode": "OFFLINE", - "bitcoinUnit": "AUTO", - "groupByAddress": true, - "includeMempoolChange": true, - "notifyNewTransactions": true, - "checkNewVersions": true, - "theme": "LIGHT", - "useProxy": false -} \ No newline at end of file