From issues-return-128539-archive-asf-public=cust-asf.ponee.io@maven.apache.org Sat Feb 24 23:20:53 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id ECF08180656 for ; Sat, 24 Feb 2018 23:20:52 +0100 (CET) Received: (qmail 8072 invoked by uid 500); 24 Feb 2018 22:20:51 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 8061 invoked by uid 99); 24 Feb 2018 22:20:51 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Feb 2018 22:20:51 +0000 From: GitBox To: issues@maven.apache.org Subject: [GitHub] asfgit closed pull request #1: MCHECKSTYLE-344 Fix category resolution when reporting violation Message-ID: <151951085135.16959.5907806036824478310.gitbox@gitbox.apache.org> Date: Sat, 24 Feb 2018 22:20:51 -0000 asfgit closed pull request #1: MCHECKSTYLE-344 Fix category resolution when reporting violation URL: https://github.com/apache/maven-checkstyle-plugin/pull/1 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java b/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java index 79e943e..ff53a3e 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java @@ -92,7 +92,7 @@ public static String getCategory( String eventSrcName ) } int end = eventSrcName.lastIndexOf( '.' ); - eventSrcName = eventSrcName.substring( 0, end ); + eventSrcName = end == -1 ? eventSrcName : eventSrcName.substring( 0, end ); if ( CHECKSTYLE_PACKAGE.equals( eventSrcName ) ) { diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java b/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java index 4b827c4..457be55 100644 --- a/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java +++ b/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java @@ -1,6 +1,6 @@ package org.apache.maven.plugins.checkstyle; -import org.apache.maven.plugins.checkstyle.RuleUtil; +import junit.framework.TestCase; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -21,8 +21,6 @@ * under the License. */ -import junit.framework.TestCase; - public class RuleUtilTest extends TestCase { @@ -40,6 +38,7 @@ public void testGetCategory() assertEquals( "misc", RuleUtil.getCategory( CHECKSTYLE_PACKAGE + ".FinalParametersCheck" ) ); assertEquals( "test", RuleUtil.getCategory( CHECKSTYLE_PACKAGE + ".test.FinalParametersCheck" ) ); assertEquals( "extension", RuleUtil.getCategory( "test.FinalParametersCheck" ) ); + assertEquals( "extension", RuleUtil.getCategory( "copyright" ) ); assertNull( RuleUtil.getCategory( (String) null ) ); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services