Get rid of some warnings

This commit is contained in:
Miron Cuperman
2012-02-02 14:51:31 -08:00
parent 69ee4c7729
commit be8d3c3896
8 changed files with 8 additions and 24 deletions

View File

@@ -243,4 +243,8 @@ public class AlertMessage extends Message {
public void setReserved(String reserved) {
this.reserved = reserved;
}
public long getVersion() {
return version;
}
}

View File

@@ -44,7 +44,7 @@ public class GetBlocksMessage extends Message {
int startCount = (int) readVarInt();
if (startCount > 500)
throw new ProtocolException("Number of locators cannot be > 500, received: " + startCount);
locator = new ArrayList(startCount);
locator = new ArrayList<Sha256Hash>(startCount);
for (int i = 0; i < startCount; i++) {
locator.add(readHash());
}

View File

@@ -20,8 +20,8 @@ package com.google.bitcoin.core;
* Thrown when a problem occurs in communicating with a peer, and we should
* retry.
*/
@SuppressWarnings("serial")
public class PeerException extends Exception {
@SuppressWarnings("serial")
public PeerException(String msg) {
super(msg);
}

View File

@@ -444,7 +444,6 @@ public class Transaction extends ChildMessage implements Serializable {
cursor = offset;
version = readUint32();
int marker = cursor;
// First come the inputs.
long numInputs = readVarInt();
@@ -569,7 +568,6 @@ public class Transaction extends ChildMessage implements Serializable {
* @param hashType This should always be set to SigHash.ALL currently. Other types are unused.
* @param wallet A wallet is required to fetch the keys needed for signing.
*/
@SuppressWarnings({"SameParameterValue"})
public void signInputs(SigHash hashType, Wallet wallet) throws ScriptException {
assert inputs.size() > 0;
assert outputs.size() > 0;

View File

@@ -254,7 +254,6 @@ public class DerbyBlockStore implements BlockStore {
}
}
@SuppressWarnings("unused")
public StoredBlock getChainHead() throws BlockStoreException {
return chainHeadBlock;
}
@@ -280,12 +279,10 @@ public class DerbyBlockStore implements BlockStore {
Statement s = conn.createStatement();
System.out.println("settings");
ResultSet rs = s.executeQuery("SELECT name, value FROM settings");
byte[] x = null;
while (rs.next()) {
System.out.print(rs.getString(1));
System.out.print(" ");
System.out.println(Utils.bytesToHexString(rs.getBytes(2)));
x = rs.getBytes(2);
}
rs.close();
System.out.println("blocks");

View File

@@ -77,7 +77,7 @@ public class BitcoinSerializerTest {
// the actual data from https://en.bitcoin.it/wiki/Protocol_specification#verack
ByteArrayInputStream bais = new ByteArrayInputStream(Hex.decode("f9beb4d976657261636b00000000000000000000"));
VersionAck va = (VersionAck)bs.deserialize(bais);
assertNotNull(va);
}
@Test

View File

@@ -55,6 +55,7 @@ public class BlockTest {
assertEquals("00000000a6e5eb79dcec11897af55e90cd571a4335383a3ccfbc12ec81085935", block.getHashAsString());
}
@SuppressWarnings("deprecation")
@Test
public void testDate() throws Exception {
Block block = new Block(params, blockBytes);

View File

@@ -18,7 +18,6 @@ package com.google.bitcoin.core;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import org.bouncycastle.util.encoders.Hex;
@@ -34,9 +33,6 @@ import com.google.bitcoin.store.MemoryBlockStore;
public class LazyParseByteCacheTest {
private final byte[] addrMessage = Hex.decode("f9beb4d96164647200000000000000001f000000" +
"ed52399b01e215104d010000000000000000000000000000000000ffff0a000001208d");
private final byte[] txMessage = Hex.decode(
"F9 BE B4 D9 74 78 00 00 00 00 00 00 00 00 00 00" +
"02 01 00 00 E2 93 CD BE 01 00 00 00 01 6D BD DB" +
@@ -63,13 +59,8 @@ public class LazyParseByteCacheTest {
"00 8B 48 30 45 02 21 00 F3 58 1E 19 72 AE 8A C7" +
"C7 36 7A 7A 25 3B C1 13 52 23 AD B9 A4 68 BB 3A");
private static final NetworkParameters testNet = NetworkParameters.testNet();
private BlockChain testNetChain;
private Wallet wallet;
private BlockChain chain;
private BlockStore blockStore;
private Address coinbaseTo;
private NetworkParameters unitTestParams;
private byte[] b1Bytes;
@@ -87,15 +78,11 @@ public class LazyParseByteCacheTest {
@Before
public void setUp() throws Exception {
testNetChain = new BlockChain(testNet, new Wallet(testNet), new MemoryBlockStore(testNet));
unitTestParams = NetworkParameters.unitTests();
wallet = new Wallet(unitTestParams);
wallet.addKey(new ECKey());
resetBlockStore();
chain = new BlockChain(unitTestParams, wallet, blockStore);
coinbaseTo = wallet.keychain.get(0).toAddress(unitTestParams);
Transaction tx1 = createFakeTx(unitTestParams,
Utils.toNanoCoins(2, 0),
@@ -527,9 +514,6 @@ public class LazyParseByteCacheTest {
int ind = superstring.indexOf(substring);
StringBuilder sb = new StringBuilder();
int len = superstring.length() - substring.length();
if (ind > -1)
len = ind;
for (int i = 0; i < superstring.indexOf(substring); i++)
sb.append(" ");