Binglin Chang commented on YARN-2103:

Hi [~ozawa], thanks for reviewing the patch and the comments. I use the 
original title because the bug isn't just about inconsistent viaProto, but also 
lack of equals and hashcode method(which will affect other records who uses 
SerializedException), I guess I should point out all bugs in the jira. 

about code format, most PBImpl classes use those common code:
  private void maybeInitBuilder() {
    if (viaProto || builder == null) {
      builder = GetApplicationsRequestProto.newBuilder(proto);
    viaProto = false;

  public int hashCode() {
    return getProto().hashCode();

  public boolean equals(Object other) {
    if (other == null)
      return false;
    if (other.getClass().isAssignableFrom(this.getClass())) {
      return this.getProto().equals(this.getClass().cast(other).getProto());
    return false;


you can see GetApplicationsRequestPBImpl/GetApplicationsResponsePBImpl,  I just 
follow those patterns, maybe we can change them all in another JIRA, changing 
them may not fit into in this JIRA. 

bq.  How about adding concrete tests as a first step of generic tests on 
After generic test are added, those old tests are probably redundant and can be 
removed. Guess we can discuss this in the future. I can provide a separate test 

> Inconsistency between viaProto flag and initial value of 
> SerializedExceptionProto.Builder
> -----------------------------------------------------------------------------------------
>                 Key: YARN-2103
>                 URL: https://issues.apache.org/jira/browse/YARN-2103
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Binglin Chang
>            Assignee: Binglin Chang
>         Attachments: YARN-2103.v1.patch
> {code}
>   SerializedExceptionProto proto = SerializedExceptionProto
>       .getDefaultInstance();
>   SerializedExceptionProto.Builder builder = null;
>   boolean viaProto = false;
> {code}
> Since viaProto is false, we should initiate build rather than proto

This message was sent by Atlassian JIRA

Reply via email to