From cf2206bcaba81544ccefe045aa806d62152725ff Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 16:51:41 +0800 Subject: [PATCH] fix: User-controlled data in numeric cast [#1987] --- .../api/traversers/AdamicAdarAPI.java | 2 +- .../api/traversers/ResourceAllocationAPI.java | 2 +- .../api/traversers/SameNeighborsAPI.java | 2 +- .../algorithm/PredictionTraverser.java | 6 +- .../algorithm/SameNeighborTraverser.java | 4 +- .../backend/store/raft/rpc/RaftRequests.java | 862 +++++++----------- 6 files changed, 351 insertions(+), 527 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java index f8bcd5d60a..2f3dc115e7 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java @@ -67,7 +67,7 @@ public String get(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get adamic adar between '{}' and '{}' with " + "direction {}, edge label {}, max degree '{}' and limit '{}'", graph, current, other, direction, edgeLabel, maxDegree, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java index 5c4b1e8b2f..ed729ad1c5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java @@ -67,7 +67,7 @@ public String create(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get resource allocation between '{}' and '{}' " + "with direction {}, edge label {}, max degree '{}' and " + "limit '{}'", graph, current, other, direction, edgeLabel, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java index 6d87ec1d07..dbe49be53f 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java @@ -67,7 +67,7 @@ public String get(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get same neighbors between '{}' and '{}' with " + "direction {}, edge label {}, max degree '{}' and limit '{}'", graph, vertex, other, direction, edgeLabel, maxDegree, limit); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java index da6e924a8f..86191453de 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java @@ -35,7 +35,7 @@ public PredictionTraverser(HugeGraph graph) { } public double adamicAdar(Id source, Id target, Directions dir, - String label, long degree, long limit) { + String label, long degree, int limit) { Set neighbors = checkAndGetCommonNeighbors(source, target, dir, label, degree, limit); EdgeStep step = label == null ? new EdgeStep(graph(), dir) : @@ -52,7 +52,7 @@ public double adamicAdar(Id source, Id target, Directions dir, } public double resourceAllocation(Id source, Id target, Directions dir, - String label, long degree, long limit) { + String label, long degree, int limit) { Set neighbors = checkAndGetCommonNeighbors(source, target, dir, label, degree, limit); EdgeStep step = label == null ? new EdgeStep(graph(), dir) : @@ -70,7 +70,7 @@ public double resourceAllocation(Id source, Id target, Directions dir, private Set checkAndGetCommonNeighbors(Id source, Id target, Directions dir, String label, - long degree, long limit) { + long degree, int limit) { E.checkNotNull(source, "source id"); E.checkNotNull(target, "the target id"); this.checkVertexExist(source, "source"); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java index 6cb14b6db8..cafcd9059f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java @@ -36,7 +36,7 @@ public SameNeighborTraverser(HugeGraph graph) { } public Set sameNeighbors(Id vertex, Id other, Directions direction, - String label, long degree, long limit) { + String label, long degree, int limit) { E.checkNotNull(vertex, "vertex id"); E.checkNotNull(other, "the other vertex id"); this.checkVertexExist(vertex, "vertex"); @@ -54,7 +54,7 @@ public Set sameNeighbors(Id vertex, Id other, Directions direction, Set sameNeighbors = (Set) CollectionUtil.intersect( sourceNeighbors, targetNeighbors); if (limit != NO_LIMIT) { - int end = Math.min(sameNeighbors.size(), (int) limit); + int end = Math.min(sameNeighbors.size(), limit); sameNeighbors = CollectionUtil.subSet(sameNeighbors, 0, end); } return sameNeighbors; diff --git a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 2b1da29ffd..5c527cf86a 100644 --- a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -1,22 +1,3 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: raft.proto @@ -391,75 +372,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = rawValue; - } - break; - } - case 16: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - action_ = rawValue; - } - break; - } - case 26: { - bitField0_ |= 0x00000004; - data_ = input.readBytes(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandRequest_descriptor; @@ -566,7 +478,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, data_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -587,7 +499,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, data_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -615,7 +527,7 @@ public boolean equals(final java.lang.Object obj) { if (!getData() .equals(other.getData())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -638,7 +550,7 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -755,18 +667,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -875,7 +782,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasData()) { setData(other.getData()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -899,17 +806,59 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(1, tmpRaw); + } else { + type_ = tmpRaw; + bitField0_ |= 0x00000001; + } + break; + } // case 8 + case 16: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(2, tmpRaw); + } else { + action_ = tmpRaw; + bitField0_ |= 0x00000002; + } + break; + } // case 16 + case 26: { + data_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1074,7 +1023,18 @@ public StoreCommandRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1154,57 +1114,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandResponse_descriptor; @@ -1310,7 +1219,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -1326,7 +1235,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -1351,7 +1260,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1371,7 +1280,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -1488,18 +1397,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -1601,7 +1505,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -1619,17 +1523,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1789,7 +1716,18 @@ public StoreCommandResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1869,57 +1807,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private CommonResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_CommonResponse_descriptor; @@ -2025,7 +1912,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2041,7 +1928,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2066,7 +1953,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2086,7 +1973,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2203,18 +2090,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2316,7 +2198,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2334,17 +2216,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -2504,7 +2409,18 @@ public CommonResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new CommonResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -2555,45 +2471,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersRequest_descriptor; @@ -2621,7 +2498,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2630,7 +2507,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2645,7 +2522,7 @@ public boolean equals(final java.lang.Object obj) { } com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2656,7 +2533,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2773,18 +2650,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2863,7 +2735,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other) { if (other == com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2878,17 +2750,30 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @java.lang.Override @@ -2924,7 +2809,18 @@ public ListPeersRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3016,71 +2912,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000002; - } - endpoints_.add(bs); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = endpoints_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersResponse_descriptor; @@ -3184,7 +3015,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < endpoints_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, endpoints_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3205,7 +3036,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getEndpointsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -3227,7 +3058,7 @@ public boolean equals(final java.lang.Object obj) { } if (!getEndpointsList() .equals(other.getEndpointsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -3246,7 +3077,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINTS_FIELD_NUMBER; hash = (53 * hash) + getEndpointsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -3491,7 +3322,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -3512,17 +3343,43 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + ensureEndpointsIsMutable(); + endpoints_.add(bs); + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -3788,7 +3645,18 @@ public ListPeersResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3857,52 +3725,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - endpoint_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderRequest_descriptor; @@ -3986,7 +3808,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3998,7 +3820,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4018,7 +3840,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEndpoint() .equals(other.getEndpoint())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4033,7 +3855,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4150,18 +3972,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -4254,7 +4071,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests endpoint_ = other.endpoint_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4272,17 +4089,35 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + endpoint_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -4403,7 +4238,18 @@ public SetLeaderRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -4469,59 +4315,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderResponse_descriptor; @@ -4587,7 +4380,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getCommon()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -4600,7 +4393,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getCommon()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4620,7 +4413,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCommon() .equals(other.getCommon())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4635,7 +4428,7 @@ public int hashCode() { hash = (37 * hash) + COMMON_FIELD_NUMBER; hash = (53 * hash) + getCommon().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4863,7 +4656,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasCommon()) { mergeCommon(other.getCommon()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4884,17 +4677,37 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -5051,7 +4864,18 @@ public SetLeaderResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } };