Search in sources :

Example 86 with InvalidProtocolBufferException

use of com.google.protobuf.InvalidProtocolBufferException in project j2objc by google.

the class CompatibilityTest method testParseFromInvalidProtocolBufferException.

public void testParseFromInvalidProtocolBufferException() throws Exception {
    try {
        @SuppressWarnings("unused") TypicalData output = TypicalData.parseFrom(new byte[] { 0x08 });
        fail("Expected InvalidProtocolBufferException to be thrown.");
    } catch (InvalidProtocolBufferException e) {
    // Expected
    }
}
Also used : TypicalData(protos.TypicalData) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Example 87 with InvalidProtocolBufferException

use of com.google.protobuf.InvalidProtocolBufferException in project j2objc by google.

the class CompatibilityTest method testParseDelimitedFromInvalidProtocolBufferException.

public void testParseDelimitedFromInvalidProtocolBufferException() throws Exception {
    try {
        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 0x03, 0x01, 0x02 });
        @SuppressWarnings("unused") TypicalData output = TypicalData.parseDelimitedFrom(in);
        fail("Expected InvalidProtocolBufferException to be thrown.");
    } catch (InvalidProtocolBufferException e) {
    // Expected
    }
}
Also used : TypicalData(protos.TypicalData) ByteArrayInputStream(java.io.ByteArrayInputStream) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Example 88 with InvalidProtocolBufferException

use of com.google.protobuf.InvalidProtocolBufferException in project j2objc by google.

the class TrailingZerosTest method testFailsToReadMessageWithTooManyTrailingZeros.

public void testFailsToReadMessageWithTooManyTrailingZeros() throws Exception {
    TypicalData data = TypicalData.newBuilder().build();
    byte[] serializedData = data.toByteArray();
    byte[] paddedSerializedData = Arrays.copyOf(serializedData, serializedData.length + 8);
    try {
        TypicalData.parseFrom(paddedSerializedData);
        fail("should not have parsed a buffer with too many trailing zeros");
    } catch (InvalidProtocolBufferException e) {
    // expected
    }
}
Also used : TypicalData(protos.TypicalData) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Example 89 with InvalidProtocolBufferException

use of com.google.protobuf.InvalidProtocolBufferException in project j2objc by google.

the class CompatibilityTest method testMergeDelimitedFromInvalidProtocolBufferException.

public void testMergeDelimitedFromInvalidProtocolBufferException() throws Exception {
    try {
        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 0x03, 0x01, 0x02 });
        TypicalData.Builder builder = TypicalData.newBuilder();
        builder.mergeDelimitedFrom(in, ExtensionRegistry.getEmptyRegistry());
        builder.build();
        fail("Expected InvalidProtocolBufferException to be thrown.");
    } catch (InvalidProtocolBufferException e) {
    // Expected
    }
}
Also used : TypicalData(protos.TypicalData) ByteArrayInputStream(java.io.ByteArrayInputStream) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Example 90 with InvalidProtocolBufferException

use of com.google.protobuf.InvalidProtocolBufferException in project j2objc by google.

the class CompatibilityTest method testMergeFromInvalidProtocolBufferException.

public void testMergeFromInvalidProtocolBufferException() throws Exception {
    try {
        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 0x00 });
        @SuppressWarnings("unused") TypicalData output = TypicalData.newBuilder().mergeFrom(in, ExtensionRegistry.getEmptyRegistry()).build();
        fail("Expected InvalidProtocolBufferException to be thrown.");
    } catch (InvalidProtocolBufferException e) {
    // Expected
    }
}
Also used : TypicalData(protos.TypicalData) ByteArrayInputStream(java.io.ByteArrayInputStream) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)260 ServerRequest (com.pokegoapi.main.ServerRequest)46 ByteString (com.google.protobuf.ByteString)42 IOException (java.io.IOException)41 RequestFailedException (com.pokegoapi.exceptions.request.RequestFailedException)39 InvalidProtocolBufferException (org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.InvalidProtocolBufferException)22 HashMap (java.util.HashMap)21 ArrayList (java.util.ArrayList)19 List (java.util.List)18 Map (java.util.Map)17 Any (com.google.protobuf.Any)16 RunnerApi (org.apache.beam.model.pipeline.v1.RunnerApi)15 HashSet (java.util.HashSet)11 Key (org.apache.accumulo.core.data.Key)10 Value (org.apache.accumulo.core.data.Value)10 Status (org.apache.accumulo.server.replication.proto.Replication.Status)10 Text (org.apache.hadoop.io.Text)10 JsonToken (com.fasterxml.jackson.core.JsonToken)9 ByteString (org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.ByteString)9 ContractExeException (org.tron.core.exception.ContractExeException)9