/** * Internally saves and handles locking error * * @param error to handle */ public void handleLockingError(LockError error) { if (lockErrors.containsKey(error.getNode())) { for (LockError err : lockErrors.get(error.getNode())) { if (err.getLockId().equals(error.getLockId()) && err.isUnlock() == error.isUnlock()) { if (error.isOnlyPossible()) { // keep the old stack trace and change possibility err.setOnlyPossible(true); } return; } } } else { lockErrors.put(error.getNode(), new HashSet<LockError>()); } // insert new error Set<LockError> set = lockErrors.get(error.getNode()); set.add(error); }
/** * Generate CheckerError for specified LockError * * @param err LockError * @return CheckerError */ private CheckerError getCheckerError(LockError err) { List<CheckerErrorTrace> errTraces = new ArrayList<CheckerErrorTrace>(); List<CFGNode> path = new ArrayList<CFGNode>(); path.add(err.getNode()); addTrace(errTraces, path); String operation = (err.isUnlock()) ? "unlock" : "lock"; String description; if (err.isOnlyPossible()) { description = "Possible double " + operation + " on lock \"" + VarTransformations.prettyPrint(err.getLockId()) + "\" when function \"" + dictionary.get(startNode).getFunctionName() + "\" was entered in state \"" + startState + "\"."; } else { description = "Double " + operation + " on lock \"" + VarTransformations.prettyPrint(err.getLockId()) + "\" when function \"" + dictionary.get(startNode).getFunctionName() + "\" was entered in state \"" + startState + "\"."; } CheckerError error = new CheckerError( description, description, (err.isOnlyPossible()) ? 10000 : 20000, "LockChecker", errTraces); return error; }