0

While throwing Servlet exception in Filter class doFilter() method, Exception Id is getting printed which is causing "Unhandled Exception" Veracode vulnerability. Below is my code.

public void doFilter(ServletRequest request,ServletResponse response, FilterChain chain) throws IO Exception, ServletException{
//some code
    if(//some condition){
          chain.doFilter(request, response);
    }else{
       throw new ServletException("Attack detected!");
    }

Servlet Exception is getting printed but it is printed along Exception Id which is causing veracode vulnerability.

Can you please help me solve this? Thanks in advance

  • I don't see any printing going on there. Please show ALL relevant details including logging, etc. – OldProgrammer Jan 24 '22 at 17:12
  • When the if condition is failing, I want it to throw a Servlet exception. And it is doing so. But not sure from where the exception id is getting printed – sneha dalve Jan 24 '22 at 17:19
  • And we can't help you if you don't show the relevant logging information, call stack, etc. – OldProgrammer Jan 24 '22 at 17:32
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Garet Jax Feb 02 '22 at 15:45

0 Answers0