From 490bae335a3665a7061da0ccdafaf833cbaaba76 Mon Sep 17 00:00:00 2001 From: Oleg Smelov Date: Wed, 12 Jun 2024 14:30:07 +0400 Subject: [PATCH] MessageUtils.toJson --- src/main/java/com/exactpro/th2/estore/ProtoUtil.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/exactpro/th2/estore/ProtoUtil.java b/src/main/java/com/exactpro/th2/estore/ProtoUtil.java index 6c3c67a..96fce96 100644 --- a/src/main/java/com/exactpro/th2/estore/ProtoUtil.java +++ b/src/main/java/com/exactpro/th2/estore/ProtoUtil.java @@ -23,11 +23,10 @@ import com.exactpro.th2.common.grpc.EventIDOrBuilder; import com.exactpro.th2.common.grpc.EventStatus; import com.exactpro.th2.common.grpc.MessageIDOrBuilder; +import com.exactpro.th2.common.message.MessageUtils; import com.exactpro.th2.common.util.StorageUtils; import com.google.common.base.Strings; -import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Timestamp; -import com.google.protobuf.util.JsonFormat; import java.util.Collection; import java.util.Comparator; @@ -50,14 +49,7 @@ public static StoredMessageId toStoredMessageId(MessageIDOrBuilder messageId) { public static StoredTestEventId toCradleEventID(EventIDOrBuilder protoEventID) { String id = protoEventID.getId(); if (Strings.isNullOrEmpty(id)) { - String eventString; - try { - eventString = JsonFormat.printer().print(protoEventID); - } catch (InvalidProtocolBufferException e) { - eventString = protoEventID.toString(); - } - - throw new IllegalArgumentException("No unique identifier specified for event: " + eventString); + throw new IllegalArgumentException("No unique identifier specified for event: " + MessageUtils.toJson(protoEventID)); } return new StoredTestEventId(