You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Steven Schenk (Jira)" <ji...@apache.org> on 2021/06/04 09:11:00 UTC

[jira] [Commented] (MCHECKSTYLE-401) NullPointerException in Violation class

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

Steven Schenk commented on MCHECKSTYLE-401:
-------------------------------------------

Should be fixed by this PR:

[https://github.com/apache/maven-checkstyle-plugin/pull/47]

Both {{file}} and {{line}} field are nullable in the constructor. Equals method now uses {{Objects.equals()}} for those fields to handle the nullability. Also added a test for the {{equals()}} method.

> NullPointerException in Violation class
> ---------------------------------------
>
>                 Key: MCHECKSTYLE-401
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-401
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>            Reporter: Elliotte Rusty Harold
>            Priority: Minor
>              Labels: up-for-grabs
>
> import org.junit.Assert;
> import org.junit.Test;
> public class ViolationTest
> {
> @Test
>  public void testEquals() {
>  Violation v1 = new Violation("", null, "", "", "", "", "");
>  Violation v2 = new Violation("", null, "", "", "", "", "");
>  Assert.assertEquals( v1, v2 );
>  }
>  
>  
> }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)