Replace the usage of InvalidProtocolBufferException with IOException.
PiperOrigin-RevId: 482844446
This commit is contained in:
parent
55ba23ce9a
commit
ed938a9214
|
@ -31,7 +31,6 @@ import com.google.mediapipe.tasks.core.TaskOptions;
|
||||||
import com.google.mediapipe.tasks.core.TaskRunner;
|
import com.google.mediapipe.tasks.core.TaskRunner;
|
||||||
import com.google.mediapipe.tasks.core.proto.BaseOptionsProto;
|
import com.google.mediapipe.tasks.core.proto.BaseOptionsProto;
|
||||||
import com.google.mediapipe.tasks.text.textclassifier.proto.TextClassifierGraphOptionsProto;
|
import com.google.mediapipe.tasks.text.textclassifier.proto.TextClassifierGraphOptionsProto;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -154,7 +153,7 @@ public final class TextClassifier implements AutoCloseable {
|
||||||
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX),
|
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX),
|
||||||
ClassificationsProto.ClassificationResult.getDefaultInstance()),
|
ClassificationsProto.ClassificationResult.getDefaultInstance()),
|
||||||
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp());
|
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp());
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (IOException e) {
|
||||||
throw new MediaPipeException(
|
throw new MediaPipeException(
|
||||||
MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage());
|
MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.BaseVisionTaskApi;
|
||||||
import com.google.mediapipe.tasks.vision.core.RunningMode;
|
import com.google.mediapipe.tasks.vision.core.RunningMode;
|
||||||
import com.google.mediapipe.tasks.vision.imageclassifier.proto.ImageClassifierGraphOptionsProto;
|
import com.google.mediapipe.tasks.vision.imageclassifier.proto.ImageClassifierGraphOptionsProto;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -176,7 +175,7 @@ public final class ImageClassifier extends BaseVisionTaskApi {
|
||||||
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX),
|
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX),
|
||||||
ClassificationsProto.ClassificationResult.getDefaultInstance()),
|
ClassificationsProto.ClassificationResult.getDefaultInstance()),
|
||||||
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp());
|
packets.get(CLASSIFICATION_RESULT_OUT_STREAM_INDEX).getTimestamp());
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (IOException e) {
|
||||||
throw new MediaPipeException(
|
throw new MediaPipeException(
|
||||||
MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage());
|
MediaPipeException.StatusCode.INTERNAL.ordinal(), e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user