Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.Project


        }
        ProjectStats stats = into.getProjectStats();
        ProjectStats stats2 = from.getProjectStats();
        stats.addStats(stats2);

        Project project = into.getProject();
        Project project2 = from.getProject();
        project.add(project2);

        for(AnalysisError error : from.getErrors()) {
            into.addError(error);
        }
View Full Code Here


        } else {
            origCollection.readXML(args[argCount++]);
        }
        boolean verbose = argCount < args.length;
        SortedBugCollection resultCollection = origCollection.createEmptyCollectionWithMetadata();
        Project project = resultCollection.getProject();
        int passed = 0;
        int dropped = 0;
        resultCollection.setWithMessages(commandLine.withMessages);
        if (commandLine.hashChangedSpecified) {
            origCollection.computeBugHashes();
View Full Code Here

        return mainFrameTree.getBugTreeModel();
    }

    public synchronized @Nonnull Project getProject() {
        if (curProject == null) {
            curProject = new Project();
        }
        return curProject;
    }
View Full Code Here

        if (argCount < args.length) {
            origCollection.readXML(args[argCount++]);
        } else {
            origCollection.readXML(System.in);
        }
        Project project = origCollection.getProject();

        if (commandLine.revisionName != null) {
            origCollection.setReleaseName(commandLine.revisionName);
        }
        if (commandLine.projectName != null) {
            origCollection.getProject().setProjectName(commandLine.projectName);
        }
        if (commandLine.revisionTimestamp != 0) {
            origCollection.setTimestamp(commandLine.revisionTimestamp);
        }
        origCollection.setWithMessages(commandLine.withMessages);

        if (commandLine.purgeDesignations) {
            for (BugInstance b : origCollection) {
                b.setUserDesignation(null);
            }
        }
        if (commandLine.exclusionFilterFile != null) {
            project.setSuppressionFilter(Filter.parseFilter(commandLine.exclusionFilterFile));
        }
        if (commandLine.resetProject) {
            project.getSourceDirList().clear();
            project.getFileList().clear();
            project.getAuxClasspathEntryList().clear();
        }
        boolean reinitializeCloud = false;
        if (commandLine.cloudId != null) {
            project.setCloudId(commandLine.cloudId);
            reinitializeCloud = true;
        }
        for (Map.Entry<String, String> e : commandLine.cloudProperties.entrySet()) {
            project.getCloudProperties().setProperty(e.getKey(), e.getValue());
            reinitializeCloud = true;
        }

        if (commandLine.resetSource) {
            project.getSourceDirList().clear();
        }
        for (String source : commandLine.sourcePaths) {
            project.addSourceDir(source);
        }
        if (commandLine.purgeStats) {
            origCollection.getProjectStats().getPackageStats().clear();
        }
        if (commandLine.purgeClassStats) {
            for (PackageStats ps : origCollection.getProjectStats().getPackageStats()) {
                ps.getClassStats().clear();
            }
        }
        if (commandLine.purgeMissingClasses) {
            origCollection.clearMissingClasses();
        }
        if (commandLine.lastVersion != null) {
            long last = edu.umd.cs.findbugs.workflow.Filter.FilterCommandLine.getVersionNum(origCollection,
                    commandLine.lastVersion, true);
            if (last < origCollection.getSequenceNumber()) {
                String name = origCollection.getAppVersionFromSequenceNumber(last).getReleaseName();
                long timestamp = origCollection.getAppVersionFromSequenceNumber(last).getTimestamp();
                origCollection.setReleaseName(name);
                origCollection.setTimestamp(timestamp);
                origCollection.trimAppVersions(last);
            }

        }

        Map<String, Set<String>> missingFiles = new HashMap<String, Set<String>>();
        if (!commandLine.searchSourcePaths.isEmpty()) {
            sourceSearcher = new SourceSearcher(project);
            for (BugInstance bug : origCollection.getCollection()) {
                SourceLineAnnotation src = bug.getPrimarySourceLineAnnotation();
                if (!sourceSearcher.sourceNotFound.contains(src.getClassName()) && !sourceSearcher.findSource(src)) {
                    Set<String> paths = missingFiles.get(src.getSourceFile());
                    if (paths == null) {
                        paths = new HashSet<String>();
                        missingFiles.put(src.getSourceFile(), paths);
                    }
                    String fullPath = fullPath(src);
                    // System.out.println("Missing " + fullPath);
                    paths.add(fullPath);
                }
            }
            Set<String> foundPaths = new HashSet<String>();
            for (String f : commandLine.searchSourcePaths) {
                for (File javaFile : RecursiveSearchForJavaFiles.search(new File(f))) {
                    Set<String> matchingMissingClasses = missingFiles.get(javaFile.getName());
                    if (matchingMissingClasses == null) {
                        // System.out.println("Nothing for " + javaFile);
                    } else {
                        for (String sourcePath : matchingMissingClasses) {
                            String path = javaFile.getAbsolutePath();
                            if (path.endsWith(sourcePath)) {
                                String dir = path.substring(0, path.length() - sourcePath.length());
                                foundPaths.add(dir);

                            }
                        }
                    }

                }
            }

            Set<String> toRemove = new HashSet<String>();
            for (String p1 : foundPaths) {
                for (String p2 : foundPaths) {
                    if (!p1.equals(p2) && p1.startsWith(p2)) {
                        toRemove.add(p1);
                        break;
                    }
                }
            }
            foundPaths.removeAll(toRemove);

            for (String dir : foundPaths) {
                project.addSourceDir(dir);
                if (argCount < args.length) {
                    System.out.println("Found " + dir);
                }
            }
View Full Code Here

    public void openBugCollection(SortedBugCollection bugs) {
        acquireDisplayWait();
        try {
            mainFrameLoadSaveHelper.prepareForFileLoad(null, null);

            Project project = bugs.getProject();
            project.setGuiCallback(guiCallback);
            BugLoader.addDeadBugMatcher(bugs);
            setProjectAndBugCollectionInSwingThread(project, bugs);
        } finally {
            releaseDisplayWait();
        }
View Full Code Here

                System.out.println("Setting bug collection; contains " + bugCollection.getCollection().size() + " bugs");
            }

        }
        if (bugCollection != null && bugCollection.getProject() != project) {
            Project p2 = bugCollection.getProject();
            throw new IllegalArgumentException(String.format("project %x and bug collection %x don't match",
                    System.identityHashCode(project), System.identityHashCode(p2)));
        }
        acquireDisplayWait();
        try {
View Full Code Here

        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }

    //    @SuppressWarnings({ "SimplifiableIfStatement" })
    boolean shouldDisplayIssue(BugInstance b) {
        Project project = getProject();
        Filter suppressionFilter = project.getSuppressionFilter();
        if (null == getBugCollection() || suppressionFilter.match(b)) {
            return false;
        }
        return viewFilter.show(b);
    }
View Full Code Here

                new Runnable() {
                    @Override
                    public void run() {
                        try {
                            updateDesignationDisplay();
                            Project project = getProject();
                            BugCollection bc = BugLoader.redoAnalysisKeepComments(project);
                            updateProjectAndBugCollection(bc);
                            setProjectAndBugCollectionInSwingThread(project, bc);
                        } finally {
                            releaseDisplayWait();
View Full Code Here

    /**
     * Changes the title based on curProject and saveFile.
     */
    public void updateTitle() {
        Project project = getProject();
        String name = project.getProjectName();
        if ((name == null || name.trim().equals("")) && saveFile != null) {
            name = saveFile.getAbsolutePath();
        }
        if (name == null) {
            name = "";//Project.UNNAMED_PROJECT;
View Full Code Here

        this.setTitle(newTitle);
    }

    //    @SuppressWarnings({ "SimplifiableIfStatement" })
    private boolean shouldDisplayIssueIgnoringPackagePrefixes(BugInstance b) {
        Project project = getProject();
        Filter suppressionFilter = project.getSuppressionFilter();
        if (null == getBugCollection() || suppressionFilter.match(b)) {
            return false;
        }
        return viewFilter.showIgnoringPackagePrefixes(b);
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.Project

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.