Search in sources :

Example 1 with AdditionalConfigData

use of net.sf.eclipsecs.core.config.ConfigurationReader.AdditionalConfigData in project eclipse-cs by checkstyle.

the class CheckerFactory method getAdditionalData.

/**
 * Determines the additional data for a given configuration file.
 *
 * @param config
 *          the check configuration
 * @param project
 *          the project to create the checker for
 * @return the checker for the given configuration file
 * @throws CheckstylePluginException
 *           the configuration could not be read
 */
public static ConfigurationReader.AdditionalConfigData getAdditionalData(ICheckConfiguration config, IProject project) throws CheckstylePluginException {
    String cacheKey = getCacheKey(config, project);
    AdditionalConfigData additionalData = sAdditionalDataMap.get(cacheKey);
    // no cache hit - create the additional data
    if (additionalData == null) {
        CheckstyleConfigurationFile configFileData = config.getCheckstyleConfiguration();
        InputSource in = null;
        try {
            in = configFileData.getCheckConfigFileInputSource();
            additionalData = ConfigurationReader.getAdditionalConfigData(in);
        } finally {
            Closeables.closeQuietly(in.getByteStream());
        }
        sAdditionalDataMap.put(cacheKey, additionalData);
    }
    return additionalData;
}
Also used : AdditionalConfigData(net.sf.eclipsecs.core.config.ConfigurationReader.AdditionalConfigData) InputSource(org.xml.sax.InputSource) CheckstyleConfigurationFile(net.sf.eclipsecs.core.config.CheckstyleConfigurationFile)

Aggregations

CheckstyleConfigurationFile (net.sf.eclipsecs.core.config.CheckstyleConfigurationFile)1 AdditionalConfigData (net.sf.eclipsecs.core.config.ConfigurationReader.AdditionalConfigData)1 InputSource (org.xml.sax.InputSource)1