Package com.puppycrawl.tools.checkstyle.api

Examples of com.puppycrawl.tools.checkstyle.api.CheckstyleException


        FileInputStream fis = null;
        try {
            fis = new FileInputStream(aFilename);
        }
        catch (FileNotFoundException e) {
            throw new CheckstyleException("unable to find " + aFilename, e);
        }
        final InputSource source = new InputSource(fis);
        return load(source, aFilename);
    }
View Full Code Here


            final ImportControlLoader loader = new ImportControlLoader();
            loader.parseInputSource(aSource);
            return loader.getRoot();
        }
        catch (ParserConfigurationException e) {
            throw new CheckstyleException("unable to parse " + aSourceName, e);
        }
        catch (SAXException e) {
            throw new CheckstyleException("unable to parse " + aSourceName
                    + " - " + e.getMessage(), e);
        }
        catch (IOException e) {
            throw new CheckstyleException("unable to read " + aSourceName, e);
        }
    }
View Full Code Here

     * @see com.puppycrawl.tools.checkstyle.api.AutomaticBean#finishLocalSetup
     */
    protected final void finishLocalSetup() throws CheckstyleException
    {
        if (mHeaderLines == null) {
            throw new CheckstyleException(
                    "property 'headerFile' is missing or invalid in module "
                    + getConfiguration().getName());
        }
    }
View Full Code Here

                        config = ConfigurationLoader.loadConfiguration(
                                new InputSource(configurationInputStream), resolver, true);
                        if (config == null) {
                            // from the CS code this state appears to occur when there's no <module> element found
                            // in the input stream
                            throw new CheckstyleException("Couldn't find root module in " + location.getLocation());
                        }

                        replaceFilePaths(config);
                        tabWidth = findTabWidthFrom(config);
                        checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
View Full Code Here

            }
        }

        // Did the process of reading the configuration fail?
        if (worker.getResult() instanceof CheckstyleException) {
            final CheckstyleException checkstyleException = (CheckstyleException) worker.getResult();
            if (checkstyleException.getMessage().contains("Unable to instantiate DoubleCheckedLocking")) {
                return blacklistAndShowMessage(location, module, "checkstyle.double-checked-locking",
                        "Not compatible with CheckStyle 5.6+. Remove DoubleCheckedLocking.");
            }
            return blacklistAndShowMessage(location, module, "checkstyle.checker-failed", "Load failed due to {0}",
                    checkstyleException.getMessage());

        } else if (worker.getResult() instanceof IOException) {
            LOG.info("CheckStyle configuration could not be loaded: " + location.getLocation(),
                    (IOException) worker.getResult());
            return blacklistAndShowMessage(location, module, "checkstyle.file-not-found", "Not found: {0}", location.getLocation());

        } else if (worker.getResult() instanceof Throwable) {
            location.blacklist();
            throw new CheckstyleException("Could not load configuration", (Throwable) worker.getResult());
        }

        return (CachedChecker) worker.getResult();
    }
View Full Code Here

TOP

Related Classes of com.puppycrawl.tools.checkstyle.api.CheckstyleException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.