Coverage Report - org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultCheckstyleExecutor
67%
133/196
53%
68/126
12
 
 1  
 package org.apache.maven.plugin.checkstyle;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.ByteArrayInputStream;
 23  
 import java.io.File;
 24  
 import java.io.FileInputStream;
 25  
 import java.io.IOException;
 26  
 import java.net.MalformedURLException;
 27  
 import java.net.URL;
 28  
 import java.net.URLClassLoader;
 29  
 import java.util.ArrayList;
 30  
 import java.util.Arrays;
 31  
 import java.util.List;
 32  
 import java.util.Properties;
 33  
 
 34  
 import org.apache.commons.io.IOUtils;
 35  
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 36  
 import org.apache.maven.project.MavenProject;
 37  
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 38  
 import org.codehaus.plexus.resource.ResourceManager;
 39  
 import org.codehaus.plexus.resource.loader.FileResourceCreationException;
 40  
 import org.codehaus.plexus.resource.loader.FileResourceLoader;
 41  
 import org.codehaus.plexus.resource.loader.ResourceNotFoundException;
 42  
 import org.codehaus.plexus.util.FileUtils;
 43  
 import org.codehaus.plexus.util.StringUtils;
 44  
 
 45  
 import com.puppycrawl.tools.checkstyle.Checker;
 46  
 import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
 47  
 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
 48  
 import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
 49  
 import com.puppycrawl.tools.checkstyle.PropertiesExpander;
 50  
 import com.puppycrawl.tools.checkstyle.api.AuditListener;
 51  
 import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
 52  
 import com.puppycrawl.tools.checkstyle.api.Configuration;
 53  
 import com.puppycrawl.tools.checkstyle.api.FilterSet;
 54  
 import com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader;
 55  
 
 56  
 /**
 57  
  * @author <a href="mailto:olamy@apache.org">olamy</a>
 58  
  * @plexus.component role="org.apache.maven.plugin.checkstyle.CheckstyleExecutor" role-hint="default"
 59  
  *                   instantiation-strategy="per-lookup"
 60  
  * @since 2.5
 61  
  * @version $Id$
 62  
  */
 63  15
 public class DefaultCheckstyleExecutor
 64  
     extends AbstractLogEnabled
 65  
     implements CheckstyleExecutor
 66  
 {
 67  
 
 68  
     /**
 69  
      * @plexus.requirement role="org.codehaus.plexus.resource.ResourceManager" role-hint="default"
 70  
      */
 71  
     private ResourceManager locator;
 72  
 
 73  1
     private static final File[] EMPTY_FILE_ARRAY = new File[0];
 74  
 
 75  
     public CheckstyleResults executeCheckstyle( CheckstyleExecutorRequest request )
 76  
         throws CheckstyleExecutorException, CheckstyleException
 77  
     {
 78  
         // checkstyle will always use the context classloader in order
 79  
         // to load resources (dtds),
 80  
         // so we have to fix it
 81  
         // olamy this hack is not anymore needed in maven 3.x
 82  18
         ClassLoader checkstyleClassLoader = PackageNamesLoader.class.getClassLoader();
 83  18
         Thread.currentThread().setContextClassLoader( checkstyleClassLoader );
 84  
 
 85  18
         if ( getLogger().isDebugEnabled() )
 86  
         {
 87  0
             getLogger().debug( "executeCheckstyle start headerLocation : " + request.getHeaderLocation() );
 88  
         }
 89  18
         MavenProject project = request.getProject();
 90  18
         locator.setOutputDirectory( new File( project.getBuild().getDirectory() ) );
 91  
         File[] files;
 92  
         try
 93  
         {
 94  18
             files = getFilesToProcess( request );
 95  
         }
 96  0
         catch ( IOException e )
 97  
         {
 98  0
             throw new CheckstyleExecutorException( "Error getting files to process", e );
 99  18
         }
 100  
 
 101  18
         FilterSet filterSet = getSuppressions( request );
 102  
 
 103  18
         Checker checker = new Checker();
 104  
 
 105  
         // setup classloader, needed to avoid "Unable to get class information
 106  
         // for ..." errors
 107  18
         List<String> classPathStrings = new ArrayList<String>();
 108  18
         List<String> outputDirectories = new ArrayList<String>();
 109  18
         File sourceDirectory = request.getSourceDirectory();
 110  18
         File testSourceDirectory = request.getTestSourceDirectory();
 111  18
         prepareCheckstylePaths( request, project, classPathStrings, outputDirectories, sourceDirectory,
 112  
                                 testSourceDirectory );
 113  17
         if ( request.isAggregate() )
 114  
         {
 115  2
             for ( MavenProject childProject : request.getReactorProjects() )
 116  
             {
 117  2
                 prepareCheckstylePaths( request, childProject, classPathStrings, outputDirectories,
 118  
                                         new File( childProject.getBuild().getSourceDirectory() ),
 119  
                                         new File( childProject.getBuild().getTestSourceDirectory() ) );
 120  
             }
 121  
         }
 122  
 
 123  17
         List<URL> urls = new ArrayList<URL>( classPathStrings.size() );
 124  
 
 125  17
         for ( String path : classPathStrings )
 126  
         {
 127  
             try
 128  
             {
 129  17
                 urls.add( new File( path ).toURL() );
 130  
             }
 131  0
             catch ( MalformedURLException e )
 132  
             {
 133  0
                 throw new CheckstyleExecutorException( e.getMessage(), e );
 134  17
             }
 135  
         }
 136  
 
 137  17
         for ( String outputDirectoryString : outputDirectories )
 138  
         {
 139  
             try
 140  
             {
 141  19
                 if ( outputDirectoryString != null )
 142  
                 {
 143  0
                     File outputDirectoryFile = new File( outputDirectoryString );
 144  0
                     if ( outputDirectoryFile.exists() )
 145  
                     {
 146  0
                         URL outputDirectoryUrl = outputDirectoryFile.toURL();
 147  0
                         request.getLog().debug(
 148  
                                                 "Adding the outputDirectory " + outputDirectoryUrl.toString()
 149  
                                                     + " to the Checkstyle class path" );
 150  0
                         urls.add( outputDirectoryUrl );
 151  
                     }
 152  
                 }
 153  
             }
 154  0
             catch ( MalformedURLException e )
 155  
             {
 156  0
                 throw new CheckstyleExecutorException( e.getMessage(), e );
 157  19
             }
 158  
         }
 159  
 
 160  17
         URLClassLoader projectClassLoader = new URLClassLoader( (URL[]) urls.toArray( new URL[urls.size()] ), null );
 161  17
         checker.setClassloader( projectClassLoader );
 162  
 
 163  17
         checker.setModuleClassLoader( Thread.currentThread().getContextClassLoader() );
 164  
 
 165  17
         if ( filterSet != null )
 166  
         {
 167  0
             checker.addFilter( filterSet );
 168  
         }
 169  17
         Configuration configuration = getConfiguration( request );
 170  17
         checker.configure( configuration );
 171  
 
 172  17
         AuditListener listener = request.getListener();
 173  
 
 174  17
         if ( listener != null )
 175  
         {
 176  17
             checker.addListener( listener );
 177  
         }
 178  
 
 179  17
         if ( request.isConsoleOutput() )
 180  
         {
 181  4
             checker.addListener( request.getConsoleListener() );
 182  
         }
 183  
 
 184  17
         CheckstyleReportListener sinkListener = new CheckstyleReportListener( configuration );
 185  17
         addSourceDirectory( sinkListener, sourceDirectory, testSourceDirectory, request );
 186  17
         if ( request.isAggregate() )
 187  
         {
 188  2
             for ( MavenProject childProject : request.getReactorProjects() )
 189  
             {
 190  2
                 addSourceDirectory( sinkListener, new File( childProject.getBuild().getSourceDirectory() ),
 191  
                                     new File( childProject.getBuild().getSourceDirectory() ), request );
 192  
             }
 193  
         }
 194  
 
 195  17
         checker.addListener( sinkListener );
 196  
 
 197  17
         List<File> filesList = Arrays.asList( files );
 198  17
         int nbErrors = checker.process( filesList );
 199  
 
 200  17
         checker.destroy();
 201  
 
 202  17
         if ( request.getStringOutputStream() != null )
 203  
         {
 204  15
             request.getLog().info( request.getStringOutputStream().toString() );
 205  
         }
 206  
 
 207  17
         if ( request.isFailsOnError() && nbErrors > 0 )
 208  
         {
 209  
             // TODO: should be a failure, not an error. Report is not meant to
 210  
             // throw an exception here (so site would
 211  
             // work regardless of config), but should record this information
 212  1
             throw new CheckstyleExecutorException( "There are " + nbErrors + " checkstyle errors." );
 213  
         }
 214  16
         else if ( nbErrors > 0 )
 215  
         {
 216  16
             request.getLog().info( "There are " + nbErrors + " checkstyle errors." );
 217  
         }
 218  
 
 219  16
         return sinkListener.getResults();
 220  
     }
 221  
 
 222  
     protected void addSourceDirectory( CheckstyleReportListener sinkListener, File sourceDirectory,
 223  
                                        File testSourceDirectory, CheckstyleExecutorRequest request )
 224  
     {
 225  19
         if ( sourceDirectory != null )
 226  
         {
 227  17
             sinkListener.addSourceDirectory( sourceDirectory );
 228  
         }
 229  19
         if ( request.isIncludeTestSourceDirectory() && ( testSourceDirectory != null )
 230  
             && ( testSourceDirectory.exists() ) && ( testSourceDirectory.isDirectory() ) )
 231  
         {
 232  0
             sinkListener.addSourceDirectory( testSourceDirectory );
 233  
         }
 234  19
     }
 235  
 
 236  
     public Configuration getConfiguration( CheckstyleExecutorRequest request )
 237  
         throws CheckstyleExecutorException
 238  
     {
 239  
         try
 240  
         {
 241  
             // checkstyle will always use the context classloader in order
 242  
             // to load resources (dtds),
 243  
             // so we have to fix it
 244  17
             ClassLoader checkstyleClassLoader = PackageNamesLoader.class.getClassLoader();
 245  17
             Thread.currentThread().setContextClassLoader( checkstyleClassLoader );
 246  17
             String configFile = getConfigFile( request );
 247  17
             Properties overridingProperties = getOverridingProperties( request );
 248  17
             Configuration config = ConfigurationLoader
 249  
                 .loadConfiguration( configFile, new PropertiesExpander( overridingProperties ) );
 250  17
             String effectiveEncoding = StringUtils.isNotEmpty( request.getEncoding() ) ? request.getEncoding() : System
 251  
                 .getProperty( "file.encoding", "UTF-8" );
 252  17
             if ( StringUtils.isEmpty( request.getEncoding() ) )
 253  
             {
 254  0
                 request.getLog().warn(
 255  
                                        "File encoding has not been set, using platform encoding " + effectiveEncoding
 256  
                                            + ", i.e. build is platform dependent!" );
 257  
             }
 258  
 
 259  17
             if ( "Checker".equals( config.getName() )
 260  
                     || "com.puppycrawl.tools.checkstyle.Checker".equals( config.getName() ) )
 261  
             {
 262  17
                 if ( config instanceof DefaultConfiguration )
 263  
                 {
 264  17
                     ( (DefaultConfiguration) config ).addAttribute( "charset", effectiveEncoding );
 265  
                 }
 266  
                 else
 267  
                 {
 268  0
                     request.getLog().warn( "Failed to configure file encoding on module " + config );
 269  
                 }
 270  
             }
 271  17
             Configuration[] modules = config.getChildren();
 272  130
             for ( int i = 0; i < modules.length; i++ )
 273  
             {
 274  113
                 Configuration module = modules[i];
 275  113
                 if ( "TreeWalker".equals( module.getName() )
 276  
                     || "com.puppycrawl.tools.checkstyle.TreeWalker".equals( module.getName() ) )
 277  
                 {
 278  17
                     if ( module instanceof DefaultConfiguration )
 279  
                     {
 280  
                         //MCHECKSTYLE-132 DefaultConfiguration addAttribute has changed in checkstyle 5.3
 281  
                         try
 282  
                         {
 283  17
                             if ( ( (DefaultConfiguration) module ).getAttribute( "cacheFile" ) == null )
 284  
                             {
 285  0
                                 ( (DefaultConfiguration) module ).addAttribute( "cacheFile", request.getCacheFile() );
 286  
                             }
 287  
                         }
 288  0
                         catch ( CheckstyleException ex )
 289  
                         {
 290  
                             //MCHECKSTYLE-159 - checkstyle 5.4 throws an exception instead of return null if "cacheFile"
 291  
                             // doesn't exist
 292  0
                             ( (DefaultConfiguration) module ).addAttribute( "cacheFile", request.getCacheFile() );
 293  17
                         }
 294  
                     }
 295  
                     else
 296  
                     {
 297  0
                         request.getLog().warn( "Failed to configure cache file on module " + module );
 298  
                     }
 299  
                 }
 300  
             }
 301  17
             return config;
 302  
         }
 303  0
         catch ( CheckstyleException e )
 304  
         {
 305  0
             throw new CheckstyleExecutorException( "Failed during checkstyle configuration", e );
 306  
         }
 307  
     }
 308  
 
 309  
     private void prepareCheckstylePaths( CheckstyleExecutorRequest request, MavenProject project,
 310  
                                          List<String> classPathStrings, List<String> outputDirectories,
 311  
                                          File sourceDirectory, File testSourceDirectory )
 312  
         throws CheckstyleExecutorException
 313  
     {
 314  
         try
 315  
         {
 316  20
             outputDirectories.add( project.getBuild().getOutputDirectory() );
 317  
 
 318  20
             if ( request.isIncludeTestSourceDirectory() && ( sourceDirectory != null )
 319  
                 && ( testSourceDirectory.exists() ) && ( testSourceDirectory.isDirectory() ) )
 320  
             {
 321  0
                 classPathStrings.addAll( project.getTestClasspathElements() );
 322  0
                 outputDirectories.add( project.getBuild().getTestOutputDirectory() );
 323  
             }
 324  
             else
 325  
             {
 326  20
                 classPathStrings.addAll( project.getCompileClasspathElements() );
 327  
             }
 328  
         }
 329  1
         catch ( DependencyResolutionRequiredException e )
 330  
         {
 331  1
             throw new CheckstyleExecutorException( e.getMessage(), e );
 332  19
         }
 333  19
     }
 334  
 
 335  
     private Properties getOverridingProperties( CheckstyleExecutorRequest request )
 336  
         throws CheckstyleExecutorException
 337  
     {
 338  17
         Properties p = new Properties();
 339  
 
 340  
         try
 341  
         {
 342  17
             if ( request.getPropertiesLocation() != null )
 343  
             {
 344  0
                 if ( getLogger().isDebugEnabled() )
 345  
                 {
 346  0
                     getLogger().debug( "request.getPropertiesLocation() " + request.getPropertiesLocation() );
 347  
                 }
 348  
 
 349  0
                 File propertiesFile = locator.getResourceAsFile( request.getPropertiesLocation(),
 350  
                                                                  "checkstyle-checker.properties" );
 351  
 
 352  0
                 FileInputStream properties = new FileInputStream( propertiesFile );
 353  
                 try
 354  
                 {
 355  0
                     if ( propertiesFile != null )
 356  
                     {
 357  0
                         p.load( properties );
 358  
                     }
 359  
                 }
 360  
                 finally
 361  
                 {
 362  0
                     IOUtils.closeQuietly( properties );
 363  0
                 }
 364  
             }
 365  
 
 366  17
             if ( StringUtils.isNotEmpty( request.getPropertyExpansion() ) )
 367  
             {
 368  0
                 String propertyExpansion = request.getPropertyExpansion();
 369  
                 // Convert \ to \\, so that p.load will convert it back properly
 370  0
                 propertyExpansion = StringUtils.replace( propertyExpansion, "\\", "\\\\" );
 371  0
                 p.load( new ByteArrayInputStream( propertyExpansion.getBytes() ) );
 372  
             }
 373  
 
 374  
             // Workaround for MCHECKSTYLE-48
 375  
             // Make sure that "config/maven-header.txt" is the default value
 376  
             // for headerLocation, if configLocation="config/maven_checks.xml"
 377  17
             String headerLocation = request.getHeaderLocation();
 378  17
             if ( "config/maven_checks.xml".equals( request.getConfigLocation() ) )
 379  
             {
 380  
 
 381  2
                 if ( "LICENSE.txt".equals( request.getHeaderLocation() ) )
 382  
                 {
 383  0
                     headerLocation = "config/maven-header.txt";
 384  
                 }
 385  
             }
 386  17
             if ( getLogger().isDebugEnabled() )
 387  
             {
 388  0
                 getLogger().debug( "headerLocation " + headerLocation );
 389  
             }
 390  
 
 391  17
             if ( StringUtils.isNotEmpty( headerLocation ) )
 392  
             {
 393  
                 try
 394  
                 {
 395  17
                     File headerFile = locator.getResourceAsFile( headerLocation, "checkstyle-header.txt" );
 396  
 
 397  17
                     if ( headerFile != null )
 398  
                     {
 399  17
                         p.setProperty( "checkstyle.header.file", headerFile.getAbsolutePath() );
 400  
                     }
 401  
                 }
 402  0
                 catch ( FileResourceCreationException e )
 403  
                 {
 404  0
                     throw new CheckstyleExecutorException( "Unable to process header location: " + headerLocation, e );
 405  
                 }
 406  0
                 catch ( ResourceNotFoundException e )
 407  
                 {
 408  0
                     throw new CheckstyleExecutorException( "Unable to process header location: " + headerLocation, e );
 409  17
                 }
 410  
             }
 411  
 
 412  17
             if ( request.getCacheFile() != null )
 413  
             {
 414  17
                 p.setProperty( "checkstyle.cache.file", request.getCacheFile() );
 415  
             }
 416  
         }
 417  0
         catch ( IOException e )
 418  
         {
 419  0
             throw new CheckstyleExecutorException( "Failed to get overriding properties", e );
 420  
         }
 421  0
         catch ( FileResourceCreationException e )
 422  
         {
 423  0
             throw new CheckstyleExecutorException( "Failed to get overriding properties", e );
 424  
         }
 425  0
         catch ( ResourceNotFoundException e )
 426  
         {
 427  0
             throw new CheckstyleExecutorException( "Failed to get overriding properties", e );
 428  17
         }
 429  17
         if ( request.getSuppressionsFileExpression() != null )
 430  
         {
 431  0
             String suppresionFile = request.getSuppressionsLocation();
 432  
 
 433  0
             if ( suppresionFile != null )
 434  
             {
 435  0
                 p.setProperty( request.getSuppressionsFileExpression(), suppresionFile );
 436  
             }
 437  
         }
 438  
 
 439  17
         return p;
 440  
     }
 441  
 
 442  
     private File[] getFilesToProcess( CheckstyleExecutorRequest request )
 443  
         throws IOException
 444  
     {
 445  18
         StringBuffer excludesStr = new StringBuffer();
 446  
 
 447  18
         if ( StringUtils.isNotEmpty( request.getExcludes() ) )
 448  
         {
 449  0
             excludesStr.append( request.getExcludes() );
 450  
         }
 451  
 
 452  18
         String[] defaultExcludes = FileUtils.getDefaultExcludes();
 453  684
         for ( int i = 0; i < defaultExcludes.length; i++ )
 454  
         {
 455  666
             if ( excludesStr.length() > 0 )
 456  
             {
 457  648
                 excludesStr.append( "," );
 458  
             }
 459  
 
 460  666
             excludesStr.append( defaultExcludes[i] );
 461  
         }
 462  
 
 463  18
         File sourceDirectory = request.getSourceDirectory();
 464  
 
 465  18
         List<File> files = new ArrayList<File>();
 466  18
         addFilesToProcess( request, excludesStr, sourceDirectory, files );
 467  18
         if ( request.isAggregate() )
 468  
         {
 469  2
             for ( MavenProject project : request.getReactorProjects() )
 470  
             {
 471  2
                 addFilesToProcess( request, excludesStr, new File( project.getBuild().getSourceDirectory() ), files );
 472  
             }
 473  
         }
 474  
 
 475  18
         return (File[]) files.toArray( EMPTY_FILE_ARRAY );
 476  
     }
 477  
 
 478  
     private void addFilesToProcess( CheckstyleExecutorRequest request, StringBuffer excludesStr, File sourceDirectory,
 479  
                                     List<File> files )
 480  
         throws IOException
 481  
     {
 482  20
         if ( sourceDirectory == null || !sourceDirectory.exists() )
 483  
         {
 484  2
             return;
 485  
         }
 486  18
         files.addAll(
 487  
             FileUtils.getFiles( sourceDirectory, request.getIncludes(), excludesStr.toString() ) );
 488  18
         File testSourceDirectory = request.getTestSourceDirectory();
 489  18
         if ( request.isIncludeTestSourceDirectory() && ( testSourceDirectory != null )
 490  
             && ( testSourceDirectory.exists() ) && ( testSourceDirectory.isDirectory() ) )
 491  
         {
 492  0
             files.addAll( FileUtils.getFiles( testSourceDirectory, request.getIncludes(),
 493  
                                               excludesStr.toString() ) );
 494  
         }
 495  18
     }
 496  
 
 497  
     private FilterSet getSuppressions( CheckstyleExecutorRequest request )
 498  
         throws CheckstyleExecutorException
 499  
     {
 500  
         try
 501  
         {
 502  18
             File suppressionsFile = locator.resolveLocation( request.getSuppressionsLocation(),
 503  
                                                              "checkstyle-suppressions.xml" );
 504  
 
 505  18
             if ( suppressionsFile == null )
 506  
             {
 507  18
                 return null;
 508  
             }
 509  
 
 510  0
             return SuppressionsLoader.loadSuppressions( suppressionsFile.getAbsolutePath() );
 511  
         }
 512  0
         catch ( CheckstyleException ce )
 513  
         {
 514  0
             throw new CheckstyleExecutorException( "failed to load suppressions location: "
 515  
                 + request.getSuppressionsLocation(), ce );
 516  
         }
 517  0
         catch ( IOException e )
 518  
         {
 519  0
             throw new CheckstyleExecutorException( "Failed to process supressions location: "
 520  
                 + request.getSuppressionsLocation(), e );
 521  
         }
 522  
     }
 523  
 
 524  
     private String getConfigFile( CheckstyleExecutorRequest request )
 525  
         throws CheckstyleExecutorException
 526  
     {
 527  
         try
 528  
         {
 529  17
             if ( getLogger().isDebugEnabled() )
 530  
             {
 531  0
                 getLogger().debug( "request.getConfigLocation() " + request.getConfigLocation() );
 532  
             }
 533  
 
 534  17
             MavenProject parent = request.getProject();
 535  34
             while ( parent != null && parent.getFile() != null )
 536  
             {
 537  
                 // MCHECKSTYLE-131 ( olamy ) I don't like this hack.
 538  
                 // (dkulp) Me either.   It really pollutes the location stuff
 539  
                 // by allowing searches of stuff outside the current module.
 540  17
                 File dir = parent.getFile().getParentFile();
 541  17
                 locator.addSearchPath( FileResourceLoader.ID, dir.getAbsolutePath() );
 542  17
                 parent = parent.getParent();
 543  17
             }
 544  17
             locator.addSearchPath( "url", "" );
 545  
 
 546  17
             File configFile = locator.getResourceAsFile( request.getConfigLocation(), "checkstyle-checker.xml" );
 547  17
             if ( configFile == null )
 548  
             {
 549  0
                 throw new CheckstyleExecutorException( "Unable to process config location: "
 550  
                     + request.getConfigLocation() );
 551  
             }
 552  17
             return configFile.getAbsolutePath();
 553  
         }
 554  0
         catch ( org.codehaus.plexus.resource.loader.ResourceNotFoundException e )
 555  
         {
 556  0
             throw new CheckstyleExecutorException( "Unable to find configuration file at location "
 557  
                 + request.getConfigLocation(), e );
 558  
         }
 559  0
         catch ( FileResourceCreationException e )
 560  
         {
 561  0
             throw new CheckstyleExecutorException( "Unable to process configuration file location "
 562  
                 + request.getConfigLocation(), e );
 563  
         }
 564  
 
 565  
     }
 566  
 }