Package com.puppycrawl.tools.checkstyle.api

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


            final InputSource source = new InputSource(uri.toString());
            return loadConfiguration(source, aOverridePropsResolver,
                    aOmitIgnoredModules);
        }
        catch (final FileNotFoundException e) {
            throw new CheckstyleException("unable to find " + aConfig, e);
        }
        catch (final CheckstyleException e) {
                //wrap again to add file name info
            throw new CheckstyleException("unable to read " + aConfig + " - "
                    + e.getMessage(), e);
        }
    }
View Full Code Here


                                        aOmitIgnoredModules);
            loader.parseInputSource(aConfigSource);
            return loader.getConfiguration();
        }
        catch (final ParserConfigurationException e) {
            throw new CheckstyleException(
                "unable to parse configuration stream", e);
        }
        catch (final SAXParseException e) {
            throw new CheckstyleException("unable to parse configuration stream"
                    + " - " + e.getMessage() + ":" + e.getLineNumber()
                    + ":" + e.getColumnNumber(), e);
        }
        catch (final SAXException e) {
            throw new CheckstyleException("unable to parse configuration stream"
                    + " - " + e.getMessage(), e);
        }
        catch (final IOException e) {
            throw new CheckstyleException("unable to read from stream", e);
        }
    }
View Full Code Here

                fragment = aProps.resolve(propertyName);
                if (fragment == null) {
                    if (aDefaultValue != null) {
                        return aDefaultValue;
                    }
                    throw new CheckstyleException(
                        "Property ${" + propertyName + "} has not been set");
                }
            }
            sb.append(fragment);
        }
View Full Code Here

            }
            else {
                //property found, extract its name or bail on a typo
                final int endName = aValue.indexOf('}', pos);
                if (endName < 0) {
                    throw new CheckstyleException("Syntax error in property: "
                                                    + aValue);
                }
                final String propertyName = aValue.substring(pos + 2, endName);
                aFragments.add(null);
                aPropertyRefs.add(propertyName);
View Full Code Here

        InputStream is = null;
        try {
            is = aUri.toURL().openStream();
        }
        catch (final MalformedURLException e) {
            throw new CheckstyleException("syntax error in url " + aUri, e);
        }
        catch (final IOException e) {
            throw new CheckstyleException("unable to find " + aUri, e);
        }
        final InputSource source = new InputSource(is);
        return load(source, aUri);
    }
View Full Code Here

            final ImportControlLoader loader = new ImportControlLoader();
            loader.parseInputSource(aSource);
            return loader.getRoot();
        }
        catch (final ParserConfigurationException e) {
            throw new CheckstyleException("unable to parse " + aUri, e);
        }
        catch (final SAXException e) {
            throw new CheckstyleException("unable to parse " + aUri
                    + " - " + e.getMessage(), e);
        }
        catch (final IOException e) {
            throw new CheckstyleException("unable to read " + aUri, 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 (IllegalArgumentException ex) {
                    throw new CheckstyleException("illegal token \""
                        + token + "\" in check " + aCheck, ex);
                }
            }
        }
        else {
View Full Code Here

        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 loadModuleFactory(source, aFilename);
    }
View Full Code Here

            final PackageNamesLoader nameLoader = new PackageNamesLoader();
            nameLoader.parseInputSource(aSource);
            return nameLoader.getModuleFactory();
        }
        catch (FileNotFoundException e) {
            throw new CheckstyleException("unable to find " + aSourceName, e);
        }
        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

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.