Adopt table row width, remove transient form static fields, cleanups

This commit is contained in:
Manfred Karrer 2016-01-18 16:02:04 +01:00
parent 995a23a619
commit 474ec2145a
27 changed files with 43 additions and 45 deletions

View File

@ -39,7 +39,7 @@ public class PubKeyRing implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(PubKeyRing.class);
private static final Logger log = LoggerFactory.getLogger(PubKeyRing.class);
private final byte[] signaturePubKeyBytes;
private final byte[] encryptionPubKeyBytes;

View File

@ -37,7 +37,7 @@ import java.security.SignatureException;
import static org.bitcoinj.core.Utils.HEX;
public class AlertManager {
transient private static final Logger log = LoggerFactory.getLogger(AlertManager.class);
private static final Logger log = LoggerFactory.getLogger(AlertManager.class);
private final AlertService alertService;
private final KeyRing keyRing;

View File

@ -55,7 +55,7 @@ import java.util.stream.Collectors;
import static org.bitcoinj.core.Utils.HEX;
public class ArbitratorManager {
transient private static final Logger log = LoggerFactory.getLogger(ArbitratorManager.class);
private static final Logger log = LoggerFactory.getLogger(ArbitratorManager.class);
private final KeyRing keyRing;
private final ArbitratorService arbitratorService;

View File

@ -40,7 +40,7 @@ import java.util.List;
public class Dispute implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(Dispute.class);
private static final Logger log = LoggerFactory.getLogger(Dispute.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Fields

View File

@ -33,7 +33,7 @@ import java.util.Date;
public class DisputeResult implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(DisputeResult.class);
private static final Logger log = LoggerFactory.getLogger(DisputeResult.class);
public enum FeePaymentPolicy {
LOSER,

View File

@ -35,7 +35,7 @@ import java.util.List;
public final class DisputeMailMessage extends DisputeMessage {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(DisputeMailMessage.class);
private static final Logger log = LoggerFactory.getLogger(DisputeMailMessage.class);
private final long date;
private final String tradeId;
@ -189,7 +189,7 @@ public final class DisputeMailMessage extends DisputeMessage {
public static class Attachment implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(Attachment.class);
private static final Logger log = LoggerFactory.getLogger(Attachment.class);
private final byte[] bytes;
private final String fileName;

View File

@ -41,7 +41,7 @@ public class AddressEntry implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private transient static final Logger log = LoggerFactory.getLogger(AddressEntry.class);
private static final Logger log = LoggerFactory.getLogger(AddressEntry.class);
public enum Context {
TRADE,
@ -52,7 +52,7 @@ public class AddressEntry implements Serializable {
// It will be restored when the wallet is ready at setDeterministicKey
// So after startup it never must be null
@Nullable
private transient DeterministicKey keyPair;
transient private DeterministicKey keyPair;
// Only set if its a TRADE Context
@Nullable

View File

@ -34,7 +34,7 @@ import java.util.ArrayList;
public class AddressEntryList extends ArrayList<AddressEntry> implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(AddressEntryList.class);
private static final Logger log = LoggerFactory.getLogger(AddressEntryList.class);
final transient private Storage<AddressEntryList> storage;
transient private Wallet wallet;

View File

@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import io.bitsquare.app.Log;
import io.bitsquare.btc.data.InputsAndChangeOutput;
import io.bitsquare.btc.data.PreparedDepositTxAndOffererInputs;
import io.bitsquare.btc.data.RawInput;
@ -816,13 +817,11 @@ public class TradeWalletService {
* @throws VerificationException
*/
public Transaction addTransactionToWallet(Transaction transaction) throws VerificationException {
log.trace("addTxToWallet called");
log.trace("transaction " + transaction.toString());
Log.traceCall("transaction " + transaction.toString());
// We need to recreate the transaction otherwise we get a null pointer...
Transaction result = new Transaction(params, transaction.bitcoinSerialize());
result.getConfidence(Context.get()).setSource(TransactionConfidence.Source.SELF);
log.trace("transaction " + result.toString());
if (wallet != null)
wallet.receivePending(result, null, true);
@ -835,12 +834,12 @@ public class TradeWalletService {
* @throws VerificationException
*/
public Transaction addTransactionToWallet(byte[] serializedTransaction) throws VerificationException {
log.trace("addTxToWallet called");
Log.traceCall();
// We need to recreate the tx otherwise we get a null pointer...
Transaction transaction = new Transaction(params, serializedTransaction);
transaction.getConfidence(Context.get()).setSource(TransactionConfidence.Source.NETWORK);
log.trace("transaction " + transaction.toString());
log.trace("transaction from serializedTransaction: " + transaction.toString());
if (wallet != null)
wallet.receivePending(transaction, null, true);

View File

@ -25,7 +25,7 @@ import java.util.*;
import java.util.stream.Collectors;
public class CurrencyUtil {
transient private static final Logger log = LoggerFactory.getLogger(CurrencyUtil.class);
private static final Logger log = LoggerFactory.getLogger(CurrencyUtil.class);
private static final List<TradeCurrency> allSortedCurrencies = createAllSortedCurrenciesList();

View File

@ -32,7 +32,7 @@ public class SepaAccountContractData extends PaymentAccountContractData implemen
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(SepaAccountContractData.class);
private static final Logger log = LoggerFactory.getLogger(SepaAccountContractData.class);
private String holderName;
private String iban;

View File

@ -39,7 +39,7 @@ public class BuyerAsOffererTrade extends BuyerTrade implements OffererTrade, Ser
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -39,7 +39,7 @@ public class BuyerAsTakerTrade extends BuyerTrade implements TakerTrade, Seriali
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -34,7 +34,7 @@ public abstract class BuyerTrade extends Trade implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
BuyerTrade(Offer offer, Coin tradeAmount, Address tradingPeerAddress, Storage<? extends TradableList> storage) {
super(offer, tradeAmount, tradingPeerAddress, storage);

View File

@ -38,8 +38,6 @@ public class Contract implements Serializable {
@JsonExclude
public static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
public static final String TAC = "I commit to the trade conditions as defined above.";
public final Offer offer;
private final long tradeAmount;
public final String takeOfferFeeTxID;

View File

@ -35,7 +35,7 @@ public class SellerAsOffererTrade extends SellerTrade implements OffererTrade, S
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(SellerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(SellerAsOffererTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -36,7 +36,7 @@ public class SellerAsTakerTrade extends SellerTrade implements TakerTrade, Seria
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(SellerAsTakerTrade.class);
private static final Logger log = LoggerFactory.getLogger(SellerAsTakerTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -34,7 +34,7 @@ public abstract class SellerTrade extends Trade implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsTakerTrade.class);
public SellerTrade(Offer offer, Coin tradeAmount, Address tradingPeerAddress, Storage<? extends TradableList> storage) {
super(offer, tradeAmount, tradingPeerAddress, storage);

View File

@ -33,7 +33,7 @@ public class TradableList<T extends Tradable> extends ArrayList<T> implements Se
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(TradableList.class);
private static final Logger log = LoggerFactory.getLogger(TradableList.class);
transient final private Storage<TradableList<T>> storage;
// Use getObservableList() also class locally, to be sure that object exists in case we use the object as deserialized form

View File

@ -60,7 +60,7 @@ abstract public class Trade implements Tradable, Model, Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private transient static final Logger log = LoggerFactory.getLogger(Trade.class);
private static final Logger log = LoggerFactory.getLogger(Trade.class);
public enum State {
PREPARATION(Phase.PREPARATION),
@ -128,8 +128,8 @@ abstract public class Trade implements Tradable, Model, Serializable {
// Mutable
private Coin tradeAmount;
private Address tradingPeerAddress;
private transient ObjectProperty<Coin> tradeAmountProperty;
private transient ObjectProperty<Fiat> tradeVolumeProperty;
transient private ObjectProperty<Coin> tradeAmountProperty;
transient private ObjectProperty<Fiat> tradeVolumeProperty;
///////////////////////////////////////////////////////////////////////////////////////////
@ -137,9 +137,9 @@ abstract public class Trade implements Tradable, Model, Serializable {
///////////////////////////////////////////////////////////////////////////////////////////
// Transient/Immutable
private transient ObjectProperty<State> processStateProperty;
private transient ObjectProperty<DisputeState> disputeStateProperty;
private transient ObjectProperty<TradePeriodState> tradePeriodStateProperty;
transient private ObjectProperty<State> processStateProperty;
transient private ObjectProperty<DisputeState> disputeStateProperty;
transient private ObjectProperty<TradePeriodState> tradePeriodStateProperty;
// Trades are saved in the TradeList
transient private Storage<? extends TradableList> storage;
transient protected TradeProtocol tradeProtocol;

View File

@ -50,7 +50,7 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
@JsonExclude
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
@JsonExclude
transient private static final Logger log = LoggerFactory.getLogger(Offer.class);
private static final Logger log = LoggerFactory.getLogger(Offer.class);
public static final long TTL = 10 * 60 * 1000; // 10 min.
public final static String TAC_OFFERER = "When placing that offer I accept that anyone who fulfills my conditions can " +

View File

@ -36,7 +36,7 @@ public class OpenOffer implements Tradable, Serializable {
private static final Logger log = LoggerFactory.getLogger(OpenOffer.class);
// Timeout for offer reservation during takeoffer process. If deposit tx is not completed in that time we reset the offer to AVAILABLE state.
transient private static final long TIMEOUT_SEC = 30;
private static final long TIMEOUT_SEC = 30;
transient private java.util.Timer timeoutTimer;
public enum State {

View File

@ -34,7 +34,7 @@ public class TradingPeer implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(TradingPeer.class);
private static final Logger log = LoggerFactory.getLogger(TradingPeer.class);
// Mutable
private String accountId;

View File

@ -43,10 +43,10 @@ public class Preferences implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(Preferences.class);
private static final Logger log = LoggerFactory.getLogger(Preferences.class);
// Deactivate mBit for now as most screens are not supporting it yet
transient private static final List<String> BTC_DENOMINATIONS = Arrays.asList(MonetaryFormat.CODE_BTC/*, MonetaryFormat.CODE_MBTC*/);
private static final List<String> BTC_DENOMINATIONS = Arrays.asList(MonetaryFormat.CODE_BTC/*, MonetaryFormat.CODE_MBTC*/);
transient static final private ArrayList<BlockChainExplorer> blockChainExplorersTestNet = new ArrayList<>(Arrays.asList(
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/tBTC/tx/", "https://www.blocktrail.com/tBTC/address/"),
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/testnet/tx/", "https://blockexplorer.com/testnet/address/"),
@ -66,13 +66,13 @@ public class Preferences implements Serializable {
return BTC_DENOMINATIONS;
}
private transient static Locale defaultLocale = Locale.getDefault();
private static Locale defaultLocale = Locale.getDefault();
public static Locale getDefaultLocale() {
return defaultLocale;
}
private transient static TradeCurrency defaultTradeCurrency = new TradeCurrency(CurrencyUtil.getCurrencyByCountryCode(CountryUtil.getDefaultCountryCode()).getCurrency().getCurrencyCode());
private static TradeCurrency defaultTradeCurrency = new TradeCurrency(CurrencyUtil.getCurrencyByCountryCode(CountryUtil.getDefaultCountryCode()).getCurrency().getCurrencyCode());
public static TradeCurrency getDefaultTradeCurrency() {
return defaultTradeCurrency;
@ -219,7 +219,8 @@ public class Preferences implements Serializable {
bitsquareEnvironment.saveBitcoinNetwork(bitcoinNetwork);
this.bitcoinNetwork = bitcoinNetwork;
storage.queueUpForSave();
// We don't store the bitcoinNetwork locally as BitcoinNetwork is not serializable!
}
private void setTradeCurrencies(List<TradeCurrency> tradeCurrencies) {

View File

@ -52,7 +52,7 @@ public class User implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(User.class);
private static final Logger log = LoggerFactory.getLogger(User.class);
// Transient immutable fields
transient final private Storage<User> storage;

View File

@ -34,9 +34,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
public class Navigation implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
transient private static final Logger log = LoggerFactory.getLogger(Navigation.class);
private static final Logger log = LoggerFactory.getLogger(Navigation.class);
transient private static final ViewPath DEFAULT_VIEW_PATH = ViewPath.to(MainView.class, MarketView.class);
private static final ViewPath DEFAULT_VIEW_PATH = ViewPath.to(MainView.class, MarketView.class);
public interface Listener {

View File

@ -28,8 +28,8 @@
<TableView fx:id="table" VBox.vgrow="ALWAYS">
<columns>
<TableColumn text="Trade ID" fx:id="tradeIdColumn" minWidth="100" sortable="false"/>
<TableColumn text="Date/Time" fx:id="dateColumn" minWidth="130"/>
<TableColumn text="Trade ID" fx:id="tradeIdColumn" minWidth="80" sortable="false"/>
<TableColumn text="Date/Time" fx:id="dateColumn" minWidth="150"/>
<TableColumn text="Trade amount in BTC" fx:id="amountColumn" minWidth="130" sortable="false"/>
<TableColumn text="Price" fx:id="priceColumn" minWidth="100" sortable="false"/>
<TableColumn text="Trade amount" fx:id="volumeColumn" minWidth="130" sortable="false"/>