Skip to content

Commit

Permalink
SendTransactionError parse bug deal data is null (#48)
Browse files Browse the repository at this point in the history
* SendTransactionError parse bug deal data is null
  • Loading branch information
Pana authored Aug 30, 2023
1 parent f38d890 commit 923dd3c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

### 1.2.10

1. Fix SendTransactionError parse method to handle data is null

### 1.2.6
* Add support for Batch Requests

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = 'io.github.conflux-chain'
version = '1.2.9' // SNAPSHOT
version = '1.2.10' // SNAPSHOT

repositories {
jcenter()
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/conflux/web3j/types/SendTransactionError.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ private SendTransactionError(String prefix, String... texts) {
}

private boolean matches(String message) {
if (message == null) {
return false;
}
if (this.prefix != null && !message.startsWith(this.prefix)) {
return false;
}
Expand Down Expand Up @@ -61,11 +64,11 @@ public static SendTransactionError parse(Error rpcError) {
String data = rpcError.getData();
if (data != null) {
data = data.replace("\"", "").replace("\\", "");
}

for (SendTransactionError error : SendTransactionError.values()) {
if (error.matches(data)) {
return error;

for (SendTransactionError error : SendTransactionError.values()) {
if (error.matches(data)) {
return error;
}
}
}

Expand Down

0 comments on commit 923dd3c

Please sign in to comment.