Examples of SaxSetup


Examples of hudson.plugins.analysis.util.SaxSetup

        this.workspacePath = workspacePath;
    }

    @Override
    public Collection<FileAnnotation> parse(final File file, final String moduleName) throws InvocationTargetException {
        SaxSetup sax = new SaxSetup();
        FileInputStream inputStream = null;
        try {
            for (AbstractDryParser parser : parsers) {
                inputStream = new FileInputStream(file);
                if (parser.accepts(inputStream)) {
                    IOUtils.closeQuietly(inputStream);
                    inputStream = new FileInputStream(file);
                    Collection<DuplicateCode> result = parser.parse(inputStream, moduleName);
                    createLinkNames(result);
                    Set<FileAnnotation> warnings = Sets.newHashSet();
                    warnings.addAll(result);
                    ContextHashCode hashCode = new ContextHashCode();
                    for (FileAnnotation duplication : warnings) {
                        String fullPath = getFullPath(duplication);
                        long value = hashCode.create(fullPath,
                                duplication.getPrimaryLineNumber(), defaultEncoding);
                        duplication.setContextHashCode(value * 31 + (((DuplicateCode)duplication).getNumberOfLines()));
                    }

                    return warnings;
                }
            }
            throw new IOException("No parser found for duplicated code results file " + file.getAbsolutePath());
        }
        catch (IOException exception) {
            throw new InvocationTargetException(exception);
        }
        finally {
            sax.cleanup();
            IOUtils.closeQuietly(inputStream);
        }
    }
View Full Code Here

Examples of hudson.plugins.analysis.util.SaxSetup

            return getPriorityByPriority(warning);
        }
    }

    private SortedBugCollection readXml(final InputStream file) throws IOException, DocumentException {
        SaxSetup sax = new SaxSetup();
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(FindBugsParser.class.getClassLoader());
            SortedBugCollection collection = new SortedBugCollection();
            collection.readXML(file);
            return collection;
        }
        finally {
            Thread.currentThread().setContextClassLoader(contextClassLoader);
            sax.cleanup();
        }
    }
View Full Code Here

Examples of hudson.plugins.analysis.util.SaxSetup

        private static FindBugsMessages INSTANCE = FindBugsMessages.initializeSingleton();
    }

    private static FindBugsMessages initializeSingleton() {
        FindBugsMessages res = new FindBugsMessages();
        SaxSetup sax = new SaxSetup();
        try {
            res.initialize();
        }
        catch (Exception exception) {
            Logger.getLogger(FindBugsMessages.class.getName()).log(Level.WARNING,
                    "FindBugsMessages initializeSingleton failed", exception);
        }
        finally {
            sax.cleanup();
        }
        return res;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.