XRPLF / xrpl4j

A 100% Java implementation to interact with the XRP Ledger.
ISC License
93 stars 52 forks source link

NullPointerException when result is null #283

Open manthanhd opened 2 years ago

manthanhd commented 2 years ago

The code in question is:

// snip --
ledgerResult = client.ledger(LedgerRequestParams.builder()
    .ledgerIndex(LedgerIndex.of(UnsignedInteger.valueOf(index)))
    .transactions(true)
    .build());

Exception is:

Caused by: java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.toString()" because "result" is null
    at org.xrpl.xrpl4j.client.JsonRpcClient.send(JsonRpcClient.java:118) ~[xrpl4j-client-2.3.0.jar:na]
    at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:731) ~[na:na]
    at feign.DefaultMethodHandler.invoke(DefaultMethodHandler.java:141) ~[feign-core-11.6.jar:na]
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100) ~[feign-core-11.6.jar:na]
    at jdk.proxy2/jdk.proxy2.$Proxy135.send(Unknown Source) ~[na:na]
    at org.xrpl.xrpl4j.client.JsonRpcClient.send(JsonRpcClient.java:93) ~[xrpl4j-client-2.3.0.jar:na]
    at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:731) ~[na:na]
    at feign.DefaultMethodHandler.invoke(DefaultMethodHandler.java:141) ~[feign-core-11.6.jar:na]
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100) ~[feign-core-11.6.jar:na]
    at jdk.proxy2/jdk.proxy2.$Proxy135.send(Unknown Source) ~[na:na]
    at org.xrpl.xrpl4j.client.XrplClient.ledger(XrplClient.java:431) ~[xrpl4j-client-2.3.0.jar:na]
    at co.myapp.listeners.MyListener.handle(MyListener.java:12) ~[classes/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:169) ~[spring-messaging-5.3.18.jar:5.3.18]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:119) ~[spring-messaging-5.3.18.jar:5.3.18]
    at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:75) ~[spring-rabbit-2.4.3.jar:2.4.3]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:261) ~[spring-rabbit-2.4.3.jar:2.4.3]
    ... 13 common frames omitted

This is happening on livenet https://s2.ripple.com:51234.

Following ledger numbers are affected but this seems to happen on every ledger.

  1. 72626514
  2. 72626938
  3. 72626516
  4. 72625986
  5. 72624262

The app code is processing current ledgers so it simply gets the last validated and processes every transaction in every ledger that is validated. This seems to pop up at random times where it keeps failing and then eventually starts processing again. It blocks consuming of incoming transactions.

sappenin commented 2 years ago

@manthanhd @mukulljangid - I didn't catch this ticket as part of my v2.4 release. Can one or both of you try this again with the v2.4 release and report back here?

Also, I can't tell if this is a ledger-history error, or something else? (i.e., does this happen on clio?)