protected void findTaglib(String html, Pattern thePattern, JspMetadata meta) { Matcher matcher = thePattern.matcher(html); while (matcher.find()) { String matched = matcher.group(1); if (StringUtils.isNotBlank(matched)) { if (lineContainsNamespaceBlacklist(matched)) { Line lr = new Line(); lr.setDescription("Blacklist Namespace: " + matched); lr.setLineNumber(NewLineUtil.countNewLine(html, matcher.start())); lr.setPattern(matched); for (ResultProcessor hint : hints) { hint.process(lr); } meta.getDecorations().add(lr); } meta.getTaglibDependencies().add(matched); } } }
protected void findImports(String html, Pattern thePattern, JspMetadata meta) { Matcher matcher = thePattern.matcher(html); while (matcher.find()) { String matched = matcher.group(1); if (StringUtils.isNotBlank(matched)) { String[] imports = StringUtils.split(matched, ","); if (imports != null) { for (String imp : imports) { imp = StringUtils.trim(imp); if (lineContainsClassBlacklist(imp)) { Line lr = new Line(); lr.setDescription("Blacklist: " + imp); lr.setLineNumber(NewLineUtil.countNewLine(html, matcher.start())); lr.setPattern(imp); for (ResultProcessor hint : hints) { hint.process(lr); } meta.getDecorations().add(lr); } meta.getClassDependencies().add(imp); } } } } }
/** * Detects deprecated jsp quote syntax e.g * <tags:tag attr1="<%="hello world"%>" attr2="<%=\"valid\"%>" attr3="<%= print.me("hello world") %>" /> * attr1 and attr3 are invalid syntax * * @param html * The content of the jsp * @param thePattern * The regular expression * @param meta * Meta data for the results */ protected void findDeprecatedJspQuotes(String html, Pattern thePattern, JspMetadata meta) { Matcher matcher = thePattern.matcher(html); while (matcher.find()) { String matched = matcher.group(1); if (StringUtils.isNotBlank(matched)) { Line lr = new Line(); lr.setDescription("Deprecated jsp syntax: " + matched); lr.setLineNumber(NewLineUtil.countNewLine(html, matcher.start())); lr.setPattern(matched); for (ResultProcessor hint : hints) { hint.process(lr); } meta.getDecorations().add(lr); } } }