You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2018/03/13 13:47:33 UTC

[incubator-pulsar] branch master updated: Fix CID 262329 (#1258)

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 4cc20df  Fix CID 262329 (#1258)
4cc20df is described below

commit 4cc20df55e6e3cddbd7e8947b14d81c573b3ac29
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Mar 13 22:47:30 2018 +0900

    Fix CID 262329 (#1258)
    
    * Fix CID 262329
    
    * Fix a test that didn't expect the exception
---
 .../pulsar/common/util/protobuf/ByteBufCodedInputStream.java       | 2 +-
 .../pulsar/common/util/protobuf/ByteBufCodedInputStreamTest.java   | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStream.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStream.java
index 600c607..bf838d8 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStream.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStream.java
@@ -216,7 +216,7 @@ public class ByteBufCodedInputStream {
      */
     public void checkLastTagWas(final int value) throws InvalidProtocolBufferException {
         if (lastTag != value) {
-            new InvalidProtocolBufferException("Protocol message end-group tag did not match expected tag.");
+            throw new InvalidProtocolBufferException("Protocol message end-group tag did not match expected tag.");
         }
     }
 
diff --git a/pulsar-common/src/test/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStreamTest.java b/pulsar-common/src/test/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStreamTest.java
index 5c775bf..ff1cbb7 100644
--- a/pulsar-common/src/test/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStreamTest.java
+++ b/pulsar-common/src/test/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStreamTest.java
@@ -46,9 +46,14 @@ public class ByteBufCodedInputStreamTest {
         assertFalse(inputStream.skipField(WireFormat.WIRETYPE_END_GROUP));
         inputStream = ByteBufCodedInputStream.get(Unpooled.wrappedBuffer("1000".getBytes()));
         assertTrue(inputStream.skipField(WireFormat.WIRETYPE_FIXED32));
-        assertTrue(inputStream.skipField(WireFormat.WIRETYPE_START_GROUP));
 
         try {
+            inputStream.skipField(WireFormat.WIRETYPE_START_GROUP);
+            fail("Should not happend");
+        } catch (Exception e) {
+            // pass
+        }
+        try {
             assertTrue(inputStream.skipField(-1));
             fail("Should not happend");
         } catch (Exception e) {

-- 
To stop receiving notification emails like this one, please contact
maskit@apache.org.