Package crypto.constraints
Class ExceptionConstraint
- java.lang.Object
-
- crypto.constraints.EvaluableConstraint
-
- crypto.constraints.ExceptionConstraint
-
public class ExceptionConstraint extends EvaluableConstraint
-
-
Field Summary
-
Fields inherited from class crypto.constraints.EvaluableConstraint
LOGGER
-
-
Constructor Summary
Constructors Constructor Description ExceptionConstraint(CrySLExceptionConstraint cons, ConstraintSolver context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevaluate()Evaluates this contraint, by checking if the excepiton if caught for every invokation of the method.voidevaluate(boomerang.scene.Statement stmt)Checks if a) the method that is called is the same as the method of this constraint and b) if the specified exception is caught.static Optional<soot.Trap>getTrap(soot.Body body, soot.Unit unit, boomerang.scene.WrappedClass exception)Returns the handler, that catches the exception thrown by callee in the method.static Collection<soot.Unit>getUnits(soot.Body body)Returns all units in the method body, excluding exception handlers.static booleanisCaughtAs(boomerang.scene.WrappedClass catchClause, boomerang.scene.WrappedClass exception)Returns wheter a catch clause with the given catchClause, would catch the given exception.booleanisSameMethod(boomerang.scene.DeclaredMethod method)static booleantrapsUnit(soot.Body body, soot.Trap trap, soot.Unit trapped)Returns whether the `trapped` unit is trapped in the method body.-
Methods inherited from class crypto.constraints.EvaluableConstraint
couldNotExtractValues, extractArray, extractSootArray, extractValueAsString, getErrors, getInstance, hasErrors
-
-
-
-
Constructor Detail
-
ExceptionConstraint
public ExceptionConstraint(CrySLExceptionConstraint cons, ConstraintSolver context)
-
-
Method Detail
-
evaluate
public void evaluate()
Evaluates this contraint, by checking if the excepiton if caught for every invokation of the method.- Specified by:
evaluatein classEvaluableConstraint
-
evaluate
public void evaluate(boomerang.scene.Statement stmt)
Checks if a) the method that is called is the same as the method of this constraint and b) if the specified exception is caught.- Parameters:
stmt- the called statement
-
trapsUnit
public static boolean trapsUnit(soot.Body body, soot.Trap trap, soot.Unit trapped)Returns whether the `trapped` unit is trapped in the method body.- Parameters:
body- the method's bodytrap- the traptrapped- the trapped unit- Returns:
- Returns whether the `trapped` unit is trapped in the method body.
-
getTrap
public static Optional<soot.Trap> getTrap(soot.Body body, soot.Unit unit, boomerang.scene.WrappedClass exception)
Returns the handler, that catches the exception thrown by callee in the method.- Parameters:
body- The called Method, throwing the exception.unit- Unit where callee is called.exception- The called Method, throwing the exception.- Returns:
- Returns the handler, that catches the exception thrown by callee in the method.
-
getUnits
public static Collection<soot.Unit> getUnits(soot.Body body)
Returns all units in the method body, excluding exception handlers.- Parameters:
body- the method's body- Returns:
- units all collected units
-
isCaughtAs
public static boolean isCaughtAs(boomerang.scene.WrappedClass catchClause, boomerang.scene.WrappedClass exception)Returns wheter a catch clause with the given catchClause, would catch the given exception.- Parameters:
catchClause- The type of the catch-clause.exception- Exception to be caught.- Returns:
- Wheter a catch clause with the given catchClause, would catch the given exception.
-
isSameMethod
public boolean isSameMethod(boomerang.scene.DeclaredMethod method)
- Parameters:
method- The method to compare againts.- Returns:
- Wheter the methods represented in this constraint match the given method.
-
-