Skip to content

Commit

Permalink
build: spotlessApply to fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
antonydenyer committed Sep 24, 2019
1 parent aa08736 commit feacac4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ private Set<String> getDuplicateFunctionNames(List<AbiDefinition> functionDefini
Set<String> duplicateNames = new HashSet<>();
Set<String> functionNames = new HashSet<>();
for (AbiDefinition functionDefinition : functionDefinitions) {
if (functionDefinition.getName() != null && TYPE_FUNCTION.equals(functionDefinition.getType())) {
if (functionDefinition.getName() != null
&& TYPE_FUNCTION.equals(functionDefinition.getType())) {
String functionName = funcNameToConst(functionDefinition.getName(), true);
if (!functionNames.add(functionName)) {
duplicateNames.add(functionName);
Expand Down Expand Up @@ -444,8 +445,10 @@ Iterable<FieldSpec> buildFuncNameConstants(List<AbiDefinition> functionDefinitio
fieldNames.add(Contract.FUNC_DEPLOY);
Set<String> duplicateFunctionNames = getDuplicateFunctionNames(functionDefinitions);
if (!duplicateFunctionNames.isEmpty()) {
System.out.println("\nWarning: Duplicate field(s) found: " + duplicateFunctionNames
+ ". Please don't use names which will be the same in uppercase.");
System.out.println(
"\nWarning: Duplicate field(s) found: "
+ duplicateFunctionNames
+ ". Please don't use names which will be the same in uppercase.");
}
for (AbiDefinition functionDefinition : functionDefinitions) {
if (functionDefinition.getType().equals(TYPE_FUNCTION)) {
Expand Down Expand Up @@ -917,7 +920,8 @@ MethodSpec buildFunction(AbiDefinition functionDefinition) throws ClassNotFoundE
return buildFunction(functionDefinition, true);
}

MethodSpec buildFunction(AbiDefinition functionDefinition, boolean useUpperCase) throws ClassNotFoundException {
MethodSpec buildFunction(AbiDefinition functionDefinition, boolean useUpperCase)
throws ClassNotFoundException {
return buildFunctions(functionDefinition, useUpperCase).get(0);
}

Expand Down Expand Up @@ -960,7 +964,11 @@ List<MethodSpec> buildFunctions(AbiDefinition functionDefinition, boolean useUpp
// Avoid generating runtime exception call
if (functionDefinition.hasOutputs()) {
buildConstantFunction(
functionDefinition, methodBuilder, outputParameterTypes, inputParams, useUpperCase);
functionDefinition,
methodBuilder,
outputParameterTypes,
inputParams,
useUpperCase);

results.add(methodBuilder.build());
}
Expand Down Expand Up @@ -1097,7 +1105,10 @@ private static ParameterizedTypeName buildRemoteFunctionCall(TypeName typeName)
}

private void buildTransactionFunction(
AbiDefinition functionDefinition, MethodSpec.Builder methodBuilder, String inputParams, boolean useUpperCase)
AbiDefinition functionDefinition,
MethodSpec.Builder methodBuilder,
String inputParams,
boolean useUpperCase)
throws ClassNotFoundException {

if (functionDefinition.hasOutputs()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;

import org.junit.Ignore;
import org.junit.Test;

import org.web3j.TempFileProvider;
Expand Down
7 changes: 4 additions & 3 deletions core/src/main/java/org/web3j/crypto/WalletUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,16 @@ public static Credentials loadBip39Credentials(String password, String mnemonic)

/**
* Load credentials from JSON wallet string.
*
* @param password - password to decrypt JSON wallet string
* @param content - JSON wallet content string
* @return Ethereum credentials
* @throws CipherException if the underlying cipher is not available
* @throws IOException if a low-level I/O problem (unexpected end-of-input,
* network error) occurs
* @throws IOException if a low-level I/O problem (unexpected end-of-input, network error)
* occurs
*/
public static Credentials loadJsonCredentials(String password, String content)
throws IOException, CipherException {
throws IOException, CipherException {
WalletFile walletFile = objectMapper.readValue(content, WalletFile.class);
return Credentials.create(Wallet.decrypt(password, walletFile));
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/java/org/web3j/crypto/WalletUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ public void testLoadJsonCredentials() throws Exception {
Credentials credentials =
WalletUtils.loadJsonCredentials(
PASSWORD,
convertStreamToString(WalletUtilsTest.class
.getResourceAsStream(
"/keyfiles/"
+ "UTC--2016-11-03T05-55-06."
+ "340672473Z--ef678007d18427e6022059dbc264f27507cd1ffc")));
convertStreamToString(
WalletUtilsTest.class.getResourceAsStream(
"/keyfiles/"
+ "UTC--2016-11-03T05-55-06."
+ "340672473Z--ef678007d18427e6022059dbc264f27507cd1ffc")));

assertThat(credentials, equalTo(CREDENTIALS));
}
Expand Down

0 comments on commit feacac4

Please sign in to comment.