Examples of Obligation


Examples of edu.umd.cs.findbugs.ba.obl.Obligation

         * @return the adjusted leak count (positive if leaked obligation,
         *         negative if attempt to release an un-acquired obligation)
         */
        private int getAdjustedLeakCount(State state, int obligationId) {

            final Obligation obligation = database.getFactory().getObligationById(obligationId);
            Path path = state.getPath();
            PostProcessingPathVisitor visitor = new PostProcessingPathVisitor(obligation, state);
            path.acceptVisitor(cfg, visitor);

            if (visitor.couldNotAnalyze()) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

                if (DEBUG_FP && !(producedType instanceof ObjectType)) {
                    System.out.println("Produced type " + producedType + " not an ObjectType");
                }

                if (producedType instanceof ObjectType) {
                    Obligation produced = database.getFactory().getObligationByType((ObjectType) producedType);

                    if (DEBUG_FP && produced == null) {
                        System.out.println("Produced type  " + producedType + " not an obligation type");
                    }

                    if (produced != null) {
                        XMethod calledMethod = XFactory.createXMethod(inv, cpg);
                        Obligation[] params = database.getFactory().getParameterObligationTypes(calledMethod);

                        for (int i = 0; i < params.length; i++) {
                            Obligation consumed = params[i];

                            if (DEBUG_FP && consumed == null) {
                                System.out.println("Param " + i + " not an obligation type");
                            }

                            if (DEBUG_FP && consumed != null && consumed.equals(produced)) {
                                System.out.println("Consumed type is the same as produced type");
                            }

                            if (consumed != null && !consumed.equals(produced)) {
                                // See if an instance of the consumed obligation
                                // type
                                // exists here.
                                if (transferState.getObligationSet().getCount(consumed.getId()) > 0) {
                                    transferList.add(new PossibleObligationTransfer(consumed, produced));
                                    if (DEBUG_FP) {
                                        System.out.println("===> Possible transfer of " + consumed + " to " + produced + " at "
                                                + handle);
                                    }
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

            if (u != null) {
                AuxilaryObligationPropertyDatabase db = new AuxilaryObligationPropertyDatabase();
                db.read(u.openStream());
                for (Map.Entry<MethodDescriptor, String> e : db.entrySet()) {
                    String[] v = e.getValue().split(",");
                    Obligation obligation = database.getFactory().getObligationByName(v[2]);
                    if (obligation == null) {
                        obligation = database.getFactory().addObligation(v[2]);
                    }
                    database.addEntry(new MatchMethodEntry(e.getKey(), ObligationPolicyDatabaseActionType.valueOf(v[0]),
                            ObligationPolicyDatabaseEntryType.valueOf(v[1]), obligation));
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

    public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {

        XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, classDescriptor);

        // Is this class an obligation type?
        Obligation thisClassObligation = database.getFactory().getObligationByType(xclass.getClassDescriptor());

        // Scan methods for uses of obligation-related annotations
        for (XMethod xmethod : xclass.getXMethods()) {
            // Is this method marked with @CreatesObligation?
            if (thisClassObligation != null) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

            SplitCamelCaseIdentifier splitter = new SplitCamelCaseIdentifier(xmethod.getName());
            methodHasCloseInName = splitter.split().contains("close");
        }

        for (int i = 0; i < xmethod.getNumParams(); i++) {
            Obligation obligationType = paramObligationTypes[i];
            if (obligationType != null) {
                if (xmethod.getParameterAnnotation(i, willCloseWhenClosed) != null) {
                    //
                    // Calling this method deletes a parameter obligation
                    // and
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

        addFileStreamEntries("InputStream");
        addFileStreamEntries("OutputStream");
        addFileStreamEntries("Reader");
        addFileStreamEntries("Writer");

        Obligation javaIoInputStreamObligation = database.getFactory().getObligationByName("java.io.InputStream");
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil.getObjectTypeInstance("java.lang.Class")),
                new ExactStringMatcher("getResourceAsStream"),
                new ExactStringMatcher("(Ljava/lang/String;)Ljava/io/InputStream;"), false,
                ObligationPolicyDatabaseActionType.ADD, ObligationPolicyDatabaseEntryType.STRONG, javaIoInputStreamObligation));
        Obligation javaIoOutputStreamObligation = database.getFactory().getObligationByName("java.io.OutputStream");
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil
                .getObjectTypeInstance("java.util.logging.StreamHandler")), new ExactStringMatcher("setOutputStream"),
                new ExactStringMatcher("(Ljava/io/OutputStream;)V"), false, ObligationPolicyDatabaseActionType.DEL,
                ObligationPolicyDatabaseEntryType.STRONG, javaIoOutputStreamObligation));

        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil
                .getObjectTypeInstance("java.io.FileOutputStream")), new ExactStringMatcher("getChannel"),
                new ExactStringMatcher("()Ljava/nio/channels/FileChannel;"), false, ObligationPolicyDatabaseActionType.DEL,
                ObligationPolicyDatabaseEntryType.STRONG, javaIoOutputStreamObligation));
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil
                .getObjectTypeInstance("java.io.FileInputStream")), new ExactStringMatcher("getChannel"),
                new ExactStringMatcher("()Ljava/nio/channels/FileChannel;"), false, ObligationPolicyDatabaseActionType.DEL,
                ObligationPolicyDatabaseEntryType.STRONG, javaIoInputStreamObligation));


        // Database obligation types
        Obligation connection = database.getFactory().addObligation("java.sql.Connection");
        Obligation statement = database.getFactory().addObligation("java.sql.Statement");
        Obligation resultSet = database.getFactory().addObligation("java.sql.ResultSet");

        // Add factory method entries for database obligation types
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil.getObjectTypeInstance("java.sql.DriverManager")),
                new ExactStringMatcher("getConnection"), new RegexStringMatcher("^.*\\)Ljava/sql/Connection;$"), false,
                ObligationPolicyDatabaseActionType.ADD, ObligationPolicyDatabaseEntryType.STRONG, connection));
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

    /**
     * General method for adding entries for File
     * InputStream/OutputStream/Reader/Writer classes.
     */
    private void addFileStreamEntries(String kind) {
        Obligation obligation = database.getFactory().addObligation("java.io." + kind);
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil.getObjectTypeInstance("java.io.File" + kind)),
                new ExactStringMatcher("<init>"), new RegexStringMatcher(".*"), false, ObligationPolicyDatabaseActionType.ADD,
                ObligationPolicyDatabaseEntryType.STRONG, obligation));
        database.addEntry(new MatchMethodEntry(new SubtypeTypeMatcher(BCELUtil.getObjectTypeInstance("java.io." + kind)),
                new ExactStringMatcher("close"), new ExactStringMatcher("()V"), false, ObligationPolicyDatabaseActionType.DEL,
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

            }
            return;
        }

        // See what type of obligation is being created.
        Obligation createdObligation = null;
        if (xmethod.getName().equals("<init>")) {
            // Constructor - obligation type is the type of object being created
            // (or some supertype)
            createdObligation = database.getFactory().getObligationByType(xmethod.getClassDescriptor());
        } else {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.obl.Obligation

        }

        if (DEBUG_ANNOTATIONS) {
            System.out.println("After scanning for resource types:");
            for (Iterator<Obligation> i = database.getFactory().obligationIterator(); i.hasNext();) {
                Obligation obligation = i.next();
                System.out.println("  " + obligation);
            }
        }
    }
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.Obligation

           
            Iterator it = obligations.iterator();
            indenter.in();

            while (it.hasNext()) {
                Obligation obligation = (Obligation)(it.next());
                obligation.encode(output, indenter);
            }

            indenter.out();
            out.println(indentNext + "</Obligations>");
        }
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.