Package dk.brics.jwig.analysis.graph

Examples of dk.brics.jwig.analysis.graph.State


    private Set<State> findStatesWithManyIngoingEdges(StateMachine stateMachine) {
        Map<State, Integer> inCount = new HashMap<State, Integer>();
        final Set<State> allStates = stateMachine.getAllStates();
        for (State state : allStates) {
            for (Transition transition : state.getTransitions()) {
                final State target = transition.getTarget();
                if (target != null) {
                    if (!inCount.containsKey(target))
                        inCount.put(target, 0);
                    Integer count = inCount.get(target);
                    inCount.put(target, count + 1);
View Full Code Here


            jwigClasses.add(resolver.getSootClass(WebSite.class));
            jwigClasses.add(resolver.getSootClass(WebApp.class));

            for (State state : states) {
                for (Transition transition : state.getTransitions()) {
                    final State target = transition.getTarget();
                    if (target != null) {
                        if (jwigClasses.contains(target.getMethod()
                                .getDeclaringClass())) {
                            state.removeSuccessor(transition);
                        }
                    }
                }
View Full Code Here

    private String visualizeTransitions(Map<State, String> names) {
        StringBuilder sb = new StringBuilder();
        for (Entry<State, String> entry : names.entrySet()) {
            if (entry != null && (entry.getKey() != null)) {
                for (Transition suc : entry.getKey().getTransitions()) {
                    State target = suc.getTarget();
                    if (!statesWithManyIngoingEdges.contains(target)) {
                        String trans = "";
                        String style = "solid";
                        String color = "black";
                        if (suc instanceof LambdaTransition) {
View Full Code Here

            for (State s : clone.getAllStates()) {
                if (s != null) {
                    for (Transition t : s.getTransitions()) {
                        if (t instanceof LambdaTransition
                                || t instanceof FilterTransition) {
                            State target = t.getTarget();
                            if (target != null && !target.equals(s)) {
                                for (Transition tt : target.getTransitions()) {
                                    s.addSuccessor(tt.clone());
                                }
                            }
                            s.removeSuccessor(t);
                            more = true;
View Full Code Here

            worklist.add(initialState);
            map.addPage(SiteMapper.makePage(initialState.getMethod()));
            seen.add(initialState);
        }
        while (!worklist.isEmpty()) {
            State state = worklist.remove();
            SootMethod current = state.getMethod();
            final String currentName = SiteMapper.makePageName(current);
            for (Transition transition : state.getTransitions()) {
                final State target = transition.getTarget();
                if (target != null) {
                    final SootMethod next = target.getMethod();
                    if (!seen.contains(target)) {
                        seen.add(target);
                        worklist.add(target);
                        map.addPage(SiteMapper.makePage(next));
                    }
View Full Code Here

                        // TODO in the cast-case, the reaching definitions of
                        // the variable could be analyzed - if the actual return
                        // type is 'interesting' (like the WebApp arg is found
                        // for makeURL)

                        State state = stateMachine.getState(method);
                        state.addSuccessor(new AnyTransition());
                        Feedbacks.add(new AnyTransitionUsed(method, st));
                    } else if (right instanceof JNewExpr) {
                        queue.addAll(handleNewExpression(stateMachine, method,
                                st));
                    }
View Full Code Here

                    calledMethod.getDeclaringClass().getType())
                    && !isMakeURL && !isNext;
            if (isSafe)
                continue;
            // two cases: makeURL(...) or an interesting type is returned:
            State calleeState = stateMachine.getState(method);
            if (resolver.isInterestingType(exprType) && !isMakeURL && //
                    !isNext /* next() calls need not be analyzed */) {
                State calledState = stateMachine.getState(calledMethod);
                // eventually construct the state of the invoked
                // method
                if (calledState == null) {
                    // webmethods has been added already, thus only invocations
                    // of regular methods gives rise to unknown states
View Full Code Here

                // current JWIG implementation does not support
                // multiple runmethods
                Feedbacks.add(new SubmitHandlerWithMultipleRunmethods(method,
                        st));
            } else {
                State state = stateMachine.getState(method);
                for (SootMethod runMethod : runMethods) {
                    State handler = stateMachine.getState(runMethod);
                    if (handler == null) {
                        // TODO forbid field access completely in handlers

                        handler = stateMachine.createHandlerState(runMethod);
                        queue.add(runMethod);
View Full Code Here

        Parameters filterParameters = resolver
                .getParameters(filter.getMethod());
        Set<Transition> predecessors = predecessorResolver
                .getPredecessors(filter);
        for (Transition transition : predecessors) {
            State origin = transition.getOrigin();
            final SootMethod webMethod = origin.getMethod();
            final Parameters webMethodParameters = resolver
                    .getParameters(webMethod);
            checkFilterParameters(webMethod, webMethodParameters,
                    filterParameters);
        }
View Full Code Here

                    .getJavaMethod(initialState.getMethod()));

            // get WebMethod state
            Method method = filterGroup.getWebMethod();
            SootMethod webMethod = resolver.getSootMethod(method);
            State webMethodState = stateMachine.getState(webMethod);
            webMethodState.setDefaultPriority(filterGroup.isDefaultPriority());
            webMethodState.setPriority(filterGroup.getPriority());

            for (Filter filter : filterGroup.getFilters()) {
                // get the Filter state
                final SootMethod filterMethod = resolver.getSootMethod(filter
                        .getMethod());
                State filterState = stateMachine.getState(filterMethod);
                filterState.setPriority(filter.getPriority());
                filterState.setDefaultPriority(filter.isDefaultPriority());

                // link the WebMethod of the FilterGroup to the Filter
                FilterTransition filterTransition = new FilterTransition();
                webMethodState.addSuccessor(filterTransition);
                filterTransition.setTarget(filterState);
View Full Code Here

TOP

Related Classes of dk.brics.jwig.analysis.graph.State

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.