fixed UpdateChatFlow

This commit is contained in:
mattbradburyr3 2023-01-29 16:02:14 +00:00
parent d56db30724
commit 716f15fe83
2 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ public class CreateNewChatFlow implements RPCStartableFlow {
return flowEngine.subFlow(new FinalizeChatSubFlow(signedTransaction, otherMember.getName())); return flowEngine.subFlow(new FinalizeChatSubFlow(signedTransaction, otherMember.getName()));
} }
catch (Exception e) { catch (Exception e) {
log.warn("Failed to process utxo flow for request body '$requestBody' because:'${e.message}'"); log.warn("Failed to process utxo flow for request body " + requestBody + " because: " + e.getMessage());
throw new CordaRuntimeException(e.getMessage()); throw new CordaRuntimeException(e.getMessage());
} }
} }

View File

@ -75,7 +75,7 @@ public class UpdateChatFlow implements RPCStartableFlow {
List<StateAndRef<ChatState>> chatStates = ledgerService.findUnconsumedStatesByType(ChatState.class); List<StateAndRef<ChatState>> chatStates = ledgerService.findUnconsumedStatesByType(ChatState.class);
List<StateAndRef<ChatState>> chatStatesWithId = chatStates.stream() List<StateAndRef<ChatState>> chatStatesWithId = chatStates.stream()
.filter(sar -> sar.getState().getContractState().getId() == flowArgs.getId()).collect(toList()); .filter(sar -> sar.getState().getContractState().getId().equals(flowArgs.getId())).collect(toList());
if (chatStatesWithId.size() != 1) throw new CordaRuntimeException("Multiple or zero Chat states with id " + flowArgs.id + " found"); if (chatStatesWithId.size() != 1) throw new CordaRuntimeException("Multiple or zero Chat states with id " + flowArgs.id + " found");
StateAndRef<ChatState> stateAndRef = chatStatesWithId.get(0); StateAndRef<ChatState> stateAndRef = chatStatesWithId.get(0);
@ -84,7 +84,7 @@ public class UpdateChatFlow implements RPCStartableFlow {
ChatState state = stateAndRef.getState().getContractState(); ChatState state = stateAndRef.getState().getContractState();
List<MemberInfo> members = state.getParticipants().stream().map( List<MemberInfo> members = state.getParticipants().stream().map(
it -> requireNonNull(memberLookup.lookup(it), "Member not found from Key") it -> requireNonNull(memberLookup.lookup(it), "Member not found from public Key "+ it + ".")
).collect(toList()); ).collect(toList());
// Now we want to check that there is only one member other than ourselves in the chat. // Now we want to check that there is only one member other than ourselves in the chat.
@ -108,7 +108,7 @@ public class UpdateChatFlow implements RPCStartableFlow {
return flowEngine.subFlow(new FinalizeChatSubFlow(signedTransaction, otherMember.getName())); return flowEngine.subFlow(new FinalizeChatSubFlow(signedTransaction, otherMember.getName()));
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to process utxo flow for request body '$requestBody' because:'${e.message}'"); log.warn("Failed to process utxo flow for request body " + requestBody + " because: " + e.getMessage());
throw e; throw e;
} }
} }