if (stack.getStackDepth() < stackDepth) return; OpcodeStack.Item it = stack.getStackItem(stackDepth); Object value = it.getConstant(); if (value == null || !(value instanceof String)) return; String regex = (String) value; try { Pattern.compile(regex); } catch (PatternSyntaxException e) { bugReporter.reportBug(new BugInstance(this, "RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION", NORMAL_PRIORITY) .addClassAndMethod(this) .addSourceLine(this) ); }
sawRegExPattern(stackDepth, 0);
    private void sawRegExPattern(int stackDepth) {        if (stack.getStackDepth() < stackDepth) return;        OpcodeStack.Item it = stack.getStackItem(stackDepth);        Object value = it.getConstant();        if (value == null || !(value instanceof String)) return;        String regex = (String) value;        try {            Pattern.compile(regex);        } catch (PatternSyntaxException e) {		  bugReporter.reportBug(new BugInstance(this, "RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION", 				NORMAL_PRIORITY)                                .addClassAndMethod(this)                                .addSourceLine(this)				);        }    }