mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Apply code inspection suggestions
This commit is contained in:
parent
11eb24bb53
commit
3242d86321
@ -47,6 +47,7 @@ public class Capabilities {
|
||||
|
||||
// Defines which most recent capability any node need to support.
|
||||
// This helps to clean network from very old inactive but still running nodes.
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final Capability MANDATORY_CAPABILITY = Capability.DAO_STATE;
|
||||
|
||||
protected final Set<Capability> capabilities = new HashSet<>();
|
||||
|
@ -39,7 +39,7 @@ public enum BaseCurrencyNetwork {
|
||||
@Getter
|
||||
private final String network;
|
||||
@Getter
|
||||
private String currencyName;
|
||||
private final String currencyName;
|
||||
|
||||
BaseCurrencyNetwork(NetworkParameters parameters, String currencyCode, String network, String currencyName) {
|
||||
this.parameters = parameters;
|
||||
|
@ -110,7 +110,7 @@ public class BisqHelpFormatter implements HelpFormatter {
|
||||
// without any spaces (e.g. a URL) are allowed to overflow the 80-char margin.
|
||||
while (remainder.length() > 72) {
|
||||
int idxFirstSpace = remainder.indexOf(' ');
|
||||
int chunkLen = idxFirstSpace == -1 ? remainder.length() : idxFirstSpace > 73 ? idxFirstSpace : 73;
|
||||
int chunkLen = idxFirstSpace == -1 ? remainder.length() : Math.max(idxFirstSpace, 73);
|
||||
String chunk = remainder.substring(0, chunkLen);
|
||||
int idxLastSpace = chunk.lastIndexOf(' ');
|
||||
int idxBreak = idxLastSpace > 0 ? idxLastSpace : chunk.length();
|
||||
|
@ -815,6 +815,7 @@ public class Config {
|
||||
private static String randomAppName() {
|
||||
try {
|
||||
File file = Files.createTempFile("Bisq", "Temp").toFile();
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
file.delete();
|
||||
return file.toPath().getFileName().toString();
|
||||
} catch (IOException ex) {
|
||||
|
@ -65,8 +65,7 @@ public class Encryption {
|
||||
try {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(ASYM_KEY_ALGO);
|
||||
keyPairGenerator.initialize(2048);
|
||||
KeyPair keyPair = keyPairGenerator.genKeyPair();
|
||||
return keyPair;
|
||||
return keyPairGenerator.genKeyPair();
|
||||
} catch (Throwable e) {
|
||||
log.error("Could not create key.", e);
|
||||
throw new RuntimeException("Could not create key.");
|
||||
|
@ -60,8 +60,7 @@ public class Sig {
|
||||
try {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGO);
|
||||
keyPairGenerator.initialize(1024);
|
||||
KeyPair keyPair = keyPairGenerator.genKeyPair();
|
||||
return keyPair;
|
||||
return keyPairGenerator.genKeyPair();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
log.error("Could not create key.", e);
|
||||
throw new RuntimeException("Could not create key.");
|
||||
|
@ -39,7 +39,6 @@ public interface UserThreadMappedPersistableEnvelope extends PersistableEnvelope
|
||||
default Message toPersistableMessage() {
|
||||
FutureTask<Message> toProtoOnUserThread = new FutureTask<>(this::toProtoMessage);
|
||||
UserThread.execute(toProtoOnUserThread);
|
||||
//noinspection UnstableApiUsage
|
||||
return Futures.getUnchecked(toProtoOnUserThread);
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,6 @@ public class FileManager<T extends PersistableEnvelope> {
|
||||
try {
|
||||
if (fileOutputStream != null)
|
||||
fileOutputStream.close();
|
||||
//noinspection ConstantConditions,ConstantConditions
|
||||
if (printWriter != null)
|
||||
printWriter.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -72,7 +72,7 @@ public class MathUtils {
|
||||
}
|
||||
|
||||
public static long doubleToLong(double value) {
|
||||
return new Double(value).longValue();
|
||||
return Double.valueOf(value).longValue();
|
||||
}
|
||||
|
||||
public static double scaleUpByPowerOf10(double value, int exponent) {
|
||||
|
@ -425,13 +425,13 @@ public class Utilities {
|
||||
return toTruncatedString(message, maxLength, true);
|
||||
}
|
||||
|
||||
public static String toTruncatedString(Object message, int maxLength, boolean removeLinebreaks) {
|
||||
public static String toTruncatedString(Object message, int maxLength, boolean removeLineBreaks) {
|
||||
if (message == null)
|
||||
return "null";
|
||||
|
||||
|
||||
String result = StringUtils.abbreviate(message.toString(), maxLength);
|
||||
if (removeLinebreaks)
|
||||
if (removeLineBreaks)
|
||||
return result.replace("\n", "");
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user