Package edu.umd.cs.findbugs.ba

Examples of edu.umd.cs.findbugs.ba.SourceFinder


            attributeList.addAttribute("sourcefile", sourceFile);
            attributeList.addAttribute("sourcepath", sourcePath);
            Project project = myProject.get();
            if (project != null) {
                try {
                    SourceFinder mySourceFinder = project.getSourceFinder();
                    String fullPath = new File(mySourceFinder.findSourceFile(this).getFullFileName()).getCanonicalPath();
                    String myRelativeSourceBase = relativeSourceBase.get();
                    if (fullPath.startsWith(myRelativeSourceBase) && fullPath.length() > myRelativeSourceBase.length()) {
                        attributeList.addAttribute("relSourcepath", fullPath.substring(myRelativeSourceBase.length() + 1));
                    }
                } catch (IOException e) {
View Full Code Here


    private boolean hasFallThruComment(int startPC, int endPC) {
        if (LOOK_IN_SOURCE_FOR_FALLTHRU_COMMENT) {
            BufferedReader r = null;
            try {
                SourceLineAnnotation srcLine = SourceLineAnnotation.fromVisitedInstructionRange(this, lastPC, getPC());
                SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder();
                SourceFile sourceFile = sourceFinder.findSourceFile(srcLine.getPackageName(), srcLine.getSourceFile());

                int startLine = srcLine.getStartLine();
                int numLines = srcLine.getEndLine() - startLine - 1;
                if (numLines <= 0) {
                    return false;
View Full Code Here

        }

        BugCollection origCollection;
        origCollection = new SortedBugCollection();
        origCollection.readXML(args[0]);
        SourceFinder sourceFinder = new SourceFinder(origCollection.getProject());

        for (BugInstance b : origCollection) {
            SourceLineAnnotation s = b.getPrimarySourceLineAnnotation();
            if (!s.isSourceFileKnown()) {
                continue;
            }
            if (!sourceFinder.hasSourceFile(s)) {
                continue;
            }
            SourceFile sourceFile = sourceFinder.findSourceFile(s);
            long when = sourceFile.getLastModified();
            if (when > 0) {
                Date firstSeen = new Date(when);
                b.getXmlProps().setFirstSeen(firstSeen);
                System.out.println("Set first seen to " + firstSeen);
View Full Code Here

    final HashSet<String> sourceNotFound = new HashSet<String>();

    private final SourceFinder sourceFinder;

    public SourceSearcher(Project project) {
        sourceFinder = new SourceFinder(project);
    }
View Full Code Here

    public CopyBuggySource(String[] args) throws Exception {
        origCollection = new SortedBugCollection();
        origCollection.readXML(args[0]);
        project = origCollection.getProject();

        sourceFinder = new SourceFinder(project);
        src = new File(args[1]);
        kind = SrcKind.get(src);

        switch (kind) {
        case DIR:
View Full Code Here

        return dup;
    }

    public SourceFinder getSourceFinder() {
        if (sourceFinder == null) {
            sourceFinder = new SourceFinder(this);
        }
        return sourceFinder;
    }
View Full Code Here

    public boolean addSourceDir(String dirName) {
        boolean isNew = false;
        for (String dir : makeAbsoluteCwdCandidates(dirName)) {
            isNew = addToListInternal(srcDirList, dir) || isNew;
        }
        sourceFinder = new SourceFinder(this);
        return isNew;
    }
View Full Code Here

     * @param num
     *            index of the source directory to remove
     */
    public void removeSourceDir(int num) {
        srcDirList.remove(num);
        sourceFinder = new SourceFinder(this);
        isModified = true;
    }
View Full Code Here

    private boolean catchBlockHasComment(SourceLineAnnotation srcLine) {
        if (!LOOK_IN_SOURCE_TO_FIND_COMMENTED_CATCH_BLOCKS) {
            return false;
        }

        SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder();
        try {
            SourceFile sourceFile = sourceFinder.findSourceFile(srcLine.getPackageName(), srcLine.getSourceFile());
            int startLine = srcLine.getStartLine();

            int scanStartLine = startLine - NUM_CONTEXT_LINES;
            if (scanStartLine < 1) {
                scanStartLine = 1;
View Full Code Here

        }
    }

    private String fileNameFor(final String packageName, final String sourceName) {
        String result;
        SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder();
        try {
            result = sourceFinder.findSourceFile(packageName, sourceName).getFullFileName();
        } catch (IOException e) {
            result = packageName.replace('.', File.separatorChar) + File.separatorChar + sourceName;
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.SourceFinder

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.