[ 
http://jira.codehaus.org/browse/MPCHECKSTYLE-20?page=comments#action_64318 ] 

Dennis Lundberg commented on MPCHECKSTYLE-20:
---------------------------------------------

This is a class loader issue with Checkstyle. I'm facing the same problems in 
the JetStyle plugin for IntelliJ IDEA. The Checkstyle checker need to be told 
which (context) class loader to use and that class loader needs to include all 
the dependencies for the project.

Here's a snippet of code from the JetStyle plugin that might shed some light on 
things:
{code}
        try {
            Configuration checkstyleConfiguration =
                    ConfigurationLoader.loadConfiguration(configFile, 
configuration);

            // Create the checker
            checker = new Checker();
            checker.configure(checkstyleConfiguration);
            // Put it into context
            DefaultContext context = new DefaultContext();
//            @todo Figure out how to get a nice classloader from the IDEA 
project
//            final ClassLoader loader = project.getComponent(??);
//            context.add("classloader", loader);
            checker.contextualize(context);
        }
        catch (CheckstyleException ce) {
            throw new AbortException("Checkstyle error (" + ce.toString() + ")",
                    AbortException.ERROR);
        }
{code}

The code that is commented out needs to get its hands on a class loader from 
the pom somehow.


> Unable to get class information for custom exceptions
> -----------------------------------------------------
>
>          Key: MPCHECKSTYLE-20
>          URL: http://jira.codehaus.org/browse/MPCHECKSTYLE-20
>      Project: maven-checkstyle-plugin
>         Type: Bug

>     Versions: 2.3
>  Environment: maven-1.0-rc2
>     Reporter: Ryan Sonnek

>
>
> checkstyle reports an error "Unable to get class information" for custom 
> exceptions within the same project.  it is able to load exceptions that are 
> listed as dependencies for the project, but not for other exceptions.  one 
> workaround is to only use throws Exception in the signiture, but that's 
> really a hack.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to