이 규칙은 JspException.getRootCause() 메소드를 사용하여 변경할 수 있습니다.
다음 JspException.getRootCause() 메서드는 JSP 2.1 에서 더 이상 사용되지 않으며 JSP 4.0 에서 제거되었습니다. JSP 4.0 기준으로 개발자는 표준을 사용해야 합니다 Throwable.getCause() 메서드를 대신 사용하여 Java API에서 보다 일관된 방식으로 동일한 기능을 제공할 수 있습니다.
다음 예는 플래그를 지정할 수 있는 잘못된 사용법을 보여줍니다:
import jakarta.servlet.jsp.JspException;
public class RemoveJspGetRootCauseMethod {
public void testGetRootCauseUsage(JspException e) {
Throwable rootCause = e.getRootCause(); // This will be flagged
}
}
다음 예는 올바른 사용법을 보여줍니다:
import jakarta.servlet.jsp.JspException;
public class ValidGetCauseMethod {
public void test(JspException e) {
Throwable cause = e.getCause(); // This will not flag
}
}
자세한 정보는 다음 자원을 참조하십시오.