Package com.puppycrawl.tools.checkstyle.api

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


            }
            final InputSource source = new InputSource(uri.toString());
            return loadSuppressions(source, aFilename);
        }
        catch (final FileNotFoundException e) {
            throw new CheckstyleException("unable to find " + aFilename, e);
        }
    }
View Full Code Here


                new SuppressionsLoader();
            suppressionsLoader.parseInputSource(aSource);
            return suppressionsLoader.getFilterChain();
        }
        catch (final FileNotFoundException e) {
            throw new CheckstyleException("unable to find " + aSourceName, e);
        }
        catch (final ParserConfigurationException e) {
            throw new CheckstyleException("unable to parse " + aSourceName, e);
        }
        catch (final SAXException e) {
            throw new CheckstyleException("unable to parse "
                    + aSourceName + " - " + e.getMessage(), e);
        }
        catch (final IOException e) {
            throw new CheckstyleException("unable to read " + aSourceName, e);
        }
        catch (final NumberFormatException e) {
            throw new CheckstyleException("number format exception "
                + aSourceName + " - " + e.getMessage(), e);
        }
    }
View Full Code Here

    {
        // TODO: improve the error handing
        final String name = aChildConf.getName();
        final Object module = mModuleFactory.createModule(name);
        if (!(module instanceof Check)) {
            throw new CheckstyleException(
                "TreeWalker is not allowed as a parent of " + name);
        }
        final Check c = (Check) module;
        c.contextualize(mChildContext);
        c.configure(aChildConf);
View Full Code Here

                        registerCheck(token, aCheck);
                    }
                    // TODO: else log warning
                }
                catch (final IllegalArgumentException ex) {
                    throw new CheckstyleException("illegal token \""
                        + token + "\" in check " + aCheck, ex);
                }
            }
        }
        else {
View Full Code Here

    {
        try {
            mLogFactory = LogFactory.getFactory();
        }
        catch (LogConfigurationException e) {
            throw new CheckstyleException("log configuration exception", e);
        }
        mInitialized = true;
    }
View Full Code Here

        if (value == null) {
            value = aDefaultValue;
        }

        if (value == null) {
            throw new CheckstyleException(
                "Missing required parameter: " + propertyName);
        }

        return value;
    }
View Full Code Here

        Enumeration<URL> packageFiles = null;
        try {
            packageFiles = aClassLoader.getResources(CHECKSTYLE_PACKAGES);
        }
        catch (IOException e) {
            throw new CheckstyleException(
                    "unable to get package file resources", e);
        }

        //create the loader outside the loop to prevent PackageObjectFactory
        //being created anew for each file
        final PackageNamesLoader namesLoader = newPackageNamesLoader();

        while ((null != packageFiles) && packageFiles.hasMoreElements()) {
            final URL aPackageFile = packageFiles.nextElement();
            InputStream stream = null;

            try {
                stream = new BufferedInputStream(aPackageFile.openStream());
                final InputSource source = new InputSource(stream);
                loadPackageNamesSource(source, "default package names",
                    namesLoader);
            }
            catch (IOException e) {
                throw new CheckstyleException(
                        "unable to open " + aPackageFile, e);
            }
            finally {
                Utils.closeQuietly(stream);
            }
View Full Code Here

    {
        try {
            return new PackageNamesLoader();
        }
        catch (final ParserConfigurationException e) {
            throw new CheckstyleException(
                    "unable to create PackageNamesLoader ", e);
        }
        catch (final SAXException e) {
            throw new CheckstyleException(
                    "unable to create PackageNamesLoader - "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

    {
        try {
            aNameLoader.parseInputSource(aSource);
        }
        catch (final SAXException e) {
            throw new CheckstyleException("unable to parse "
                    + aSourceName + " - " + e.getMessage(), e);
        }
        catch (final IOException e) {
            throw new CheckstyleException("unable to read " + aSourceName, e);
        }
    }
View Full Code Here

    /** {@inheritDoc} */
    public String getAttribute(String aName) throws CheckstyleException
    {
        if (!mAttributeMap.containsKey(aName)) {
            // TODO: i18n
            throw new CheckstyleException(
                    "missing key '" + aName + "' in " + getName());
        }
        return mAttributeMap.get(aName);
    }
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.