[ 
https://issues.apache.org/jira/browse/YARN-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14014106#comment-14014106
 ] 

Tsuyoshi OZAWA commented on YARN-2103:
--------------------------------------

[~decster], thank you for the update! I think some test cases are missing like 
calling functions before {{init()}} and calling {{deSerialize()}}. Do you mind 
adding these tests to your patch? It covers overall functions in 
SerializedExceptionPBImpl.

{code}
  @Test
  public void testDeserialize() throws Exception {
    SerializedExceptionProto defaultProto =
        SerializedExceptionProto.newBuilder().build();
    Exception ex =  new Exception("test exception");
    SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();

    try {
      pb.deSerialize();
      Assert.fail("deSerialze should throw YarnRuntimeException");
    } catch (YarnRuntimeException e) {
      Assert.assertEquals(ClassNotFoundException.class,
          e.getCause().getClass());
    }

    pb.init(ex);
    Assert.assertEquals(ex.toString(), pb.deSerialize().toString());
  }

  @Test
  public void testBeforeInit() throws Exception {
    SerializedExceptionProto defaultProto =
        SerializedExceptionProto.newBuilder().build();

    SerializedExceptionPBImpl pb1 = new SerializedExceptionPBImpl();
    Assert.assertNull(pb1.getCause());

    SerializedExceptionPBImpl pb2 = new SerializedExceptionPBImpl();
    Assert.assertEquals(defaultProto, pb2.getProto());

    SerializedExceptionPBImpl pb3 = new SerializedExceptionPBImpl();
    Assert.assertEquals(defaultProto.getTrace(), pb3.getRemoteTrace());
  }
{code}

> 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, YARN-2103.v2.patch
>
>
> Bug 1:
> {code}
>   SerializedExceptionProto proto = SerializedExceptionProto
>       .getDefaultInstance();
>   SerializedExceptionProto.Builder builder = null;
>   boolean viaProto = false;
> {code}
> Since viaProto is false, we should initiate build rather than proto
> Bug 2:
> the class does not provide hashcode() and equals() like other PBImpl records, 
> this class is used in other records, it may affect other records' behavior. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to