From ed938a9214b3db30085cd5eafcd1a7c14184485f Mon Sep 17 00:00:00 2001 From: Jiuqiang Tang Date: Fri, 21 Oct 2022 11:27:53 -0700 Subject: [PATCH] Replace the usage of InvalidProtocolBufferException with IOException. PiperOrigin-RevId: 482844446 --- .../mediapipe/tasks/text/textclassifier/TextClassifier.java | 3 +-- .../tasks/vision/imageclassifier/ImageClassifier.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/text/textclassifier/TextClassifier.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/text/textclassifier/TextClassifier.java index 0ebffe7cf..76117d2e4 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/text/textclassifier/TextClassifier.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/text/textclassifier/TextClassifier.java @@ -31,7 +31,6 @@ import com.google.mediapipe.tasks.core.TaskOptions; import com.google.mediapipe.tasks.core.TaskRunner; import com.google.mediapipe.tasks.core.proto.BaseOptionsProto; import com.google.mediapipe.tasks.text.textclassifier.proto.TextClassifierGraphOptionsProto; -import com.google.protobuf.InvalidProtocolBufferException; import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -154,7 +153,7 @@ public final class TextClassifier implements AutoCloseable { packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX), ClassificationsProto.ClassificationResult.getDefaultInstance()), packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp()); - } catch (InvalidProtocolBufferException e) { + } catch (IOException e) { throw new MediaPipeException( MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage()); } diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java index 68cae151f..e8e263b71 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java @@ -39,7 +39,6 @@ import com.google.mediapipe.tasks.core.proto.BaseOptionsProto; import com.google.mediapipe.tasks.vision.core.BaseVisionTaskApi; import com.google.mediapipe.tasks.vision.core.RunningMode; import com.google.mediapipe.tasks.vision.imageclassifier.proto.ImageClassifierGraphOptionsProto; -import com.google.protobuf.InvalidProtocolBufferException; import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; @@ -176,7 +175,7 @@ public final class ImageClassifier extends BaseVisionTaskApi { packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX), ClassificationsProto.ClassificationResult.getDefaultInstance()), packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp()); - } catch (InvalidProtocolBufferException e) { + } catch (IOException e) { throw new MediaPipeException( MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage()); }