Author: hboutemy
Date: Sat Jan 10 23:23:02 2015
New Revision: 1650828

URL: http://svn.apache.org/r1650828
Log:
[MCHECKSTYLE-256] print directory relative to basedir instead of filename only 
(or full path in XML source)

Modified:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=1650828&r1=1650827&r2=1650828&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
 Sat Jan 10 23:23:02 2015
@@ -609,6 +609,7 @@ public class CheckstyleViolationCheckMoj
         RuleUtil.Matcher[] ignores =
             ( violationIgnore == null ) ? null : RuleUtil.parseMatchers( 
violationIgnore.split( "," ) );
 
+        int basedir = new File( "" ).getAbsolutePath().length() + 1;
         String file = "";
         for ( int eventType = xpp.getEventType(); eventType != 
XmlPullParser.END_DOCUMENT; eventType = xpp.next() )
         {
@@ -619,7 +620,8 @@ public class CheckstyleViolationCheckMoj
             else if ( "file".equals( xpp.getName() ) )
             {
                 file = xpp.getAttributeValue( "", "name" );
-                file = file.substring( file.lastIndexOf( File.separatorChar ) 
+ 1 );
+                //file = file.substring( file.lastIndexOf( File.separatorChar 
) + 1 );
+                file = file.substring( basedir );
             }
             else if ( "error".equals( xpp.getName() ) )
             {


Reply via email to