Program: 143430
Project: 143430
Buggy source:
@Override public void doFilter(ServletRequest servletRequest,ServletResponse servletResponse,FilterChain filterChain) throws IOException, ServletException {
  try {
    if (Utils.getAsBoolean(System.getProperty("String_Node_Str","String_Node_Str"))) {
      FormElementHelper.INSTANCE.reload();
    }
    HttpServletRequest request=(HttpServletRequest)servletRequest;
    String uri=request.getRequestURI();
    if (uri != null && (uri.endsWith("String_Node_Str") || uri.endsWith("String_Node_Str"))) {
      String solutionName=getSolutionNameFromURI(uri);
      if (solutionName != null) {
        String clientUUID=request.getParameter("String_Node_Str");
        INGClientWebsocketSession wsSession=null;
        if (clientUUID != null) {
          wsSession=(INGClientWebsocketSession)WebsocketSessionManager.getSession(WebsocketSessionFactory.CLIENT_ENDPOINT,clientUUID);
        }
        FlattenedSolution fs=null;
        boolean closeFS=false;
        if (wsSession != null) {
          fs=wsSession.getClient().getFlattenedSolution();
        }
        if (fs == null) {
          try {
            closeFS=true;
            IApplicationServer as=ApplicationServerRegistry.getService(IApplicationServer.class);
            fs=new FlattenedSolution((SolutionMetaData)ApplicationServerRegistry.get().getLocalRepository().getRootObjectMetaData(solutionName,IRepository.SOLUTIONS),new AbstractActiveSolutionHandler(as){
              @Override public IRepository getRepository(){
                return ApplicationServerRegistry.get().getLocalRepository();
              }
            }
);
          }
 catch (          Exception e) {
            Debug.error("String_Node_Str" + solutionName + "String_Node_Str"+ clientUUID,e);
          }
        }
        if (fs != null) {
          try {
            String formName=getFormNameFromURI(uri);
            if (formName != null) {
              Form f=fs.getForm(formName);
              if (f == null && wsSession != null)               f=wsSession.getClient().getFormManager().getPossibleForm(formName);
              Form form=(f != null ? fs.getFlattenedForm(f) : null);
              if (form != null) {
                if (HTTPUtils.checkAndSetUnmodified(((HttpServletRequest)servletRequest),((HttpServletResponse)servletResponse),fs.getLastModifiedTime()))                 return;
                HTTPUtils.setNoCacheHeaders((HttpServletResponse)servletResponse);
                boolean html=uri.endsWith("String_Node_Str");
                PrintWriter w=servletResponse.getWriter();
                if (html && form.isResponsiveLayout()) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str");
                  FormLayoutStructureGenerator.generateLayout(form,wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),w,Utils.getAsBoolean(request.getParameter("String_Node_Str")),Utils.getAsBoolean(request.getParameter("String_Node_Str")));
                }
 else                 if (uri.endsWith("String_Node_Str")) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str");
                  boolean insideResponsiveLayout=false;
                  if (wsSession != null) {
                    IWebFormController parentForm=null;
                    String parent=request.getParameter("String_Node_Str");
                    if (parent != null) {
                      parentForm=(IWebFormController)((BasicFormManager)wsSession.getClient().getFormManager()).getCachedFormController(parent);
                    }
 else {
                      IFormController fc=((BasicFormManager)wsSession.getClient().getFormManager()).getCachedFormController(formName);
                      if (fc instanceof WebFormController) {
                        parentForm=((WebFormController)fc).getParentFormController();
                      }
                    }
                    while (parentForm != null) {
                      if (parentForm.getForm().isResponsiveLayout()) {
                        insideResponsiveLayout=true;
                        break;
                      }
                      parentForm=((WebFormController)parentForm).getParentFormController();
                    }
                  }
                  FormLayoutGenerator.generateRecordViewForm(w,form,wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),insideResponsiveLayout,Utils.getAsBoolean(request.getParameter("String_Node_Str")),Utils.getAsBoolean(request.getParameter("String_Node_Str")));
                }
 else                 if (uri.endsWith("String_Node_Str")) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str" + (html ? "String_Node_Str" : "String_Node_Str"));
                  new FormTemplateGenerator(wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),false,Utils.getAsBoolean(request.getParameter("String_Node_Str"))).generate(form,formName,"String_Node_Str",w);
                }
                w.flush();
                return;
              }
            }
 else {
              Map<String,String> variableSubstitution=new HashMap<String,String>();
              variableSubstitution.put("String_Node_Str",String.valueOf(fs.getSolution().getTextOrientation()));
              super.doFilter(servletRequest,servletResponse,filterChain,Arrays.asList("String_Node_Str"),getFormScriptReferences(fs),variableSubstitution);
              return;
            }
          }
  finally {
            if (closeFS)             fs.close(null);
          }
        }
      }
    }
    Debug.log("String_Node_Str" + uri);
    super.doFilter(servletRequest,servletResponse,filterChain,null,null,null);
  }
 catch (  RuntimeException|Error e) {
    Debug.error(e);
    throw e;
  }
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest servletRequest,ServletResponse servletResponse,FilterChain filterChain) throws IOException, ServletException {
  try {
    if (Utils.getAsBoolean(System.getProperty("String_Node_Str","String_Node_Str"))) {
      FormElementHelper.INSTANCE.reload();
    }
    HttpServletRequest request=(HttpServletRequest)servletRequest;
    String uri=request.getRequestURI();
    if (uri != null && (uri.endsWith("String_Node_Str") || uri.endsWith("String_Node_Str"))) {
      String solutionName=getSolutionNameFromURI(uri);
      if (solutionName != null) {
        String clientUUID=request.getParameter("String_Node_Str");
        INGClientWebsocketSession wsSession=null;
        if (clientUUID != null) {
          wsSession=(INGClientWebsocketSession)WebsocketSessionManager.getSession(WebsocketSessionFactory.CLIENT_ENDPOINT,clientUUID);
        }
        FlattenedSolution fs=null;
        boolean closeFS=false;
        if (wsSession != null) {
          fs=wsSession.getClient().getFlattenedSolution();
        }
        if (fs == null) {
          try {
            closeFS=true;
            IApplicationServer as=ApplicationServerRegistry.getService(IApplicationServer.class);
            fs=new FlattenedSolution((SolutionMetaData)ApplicationServerRegistry.get().getLocalRepository().getRootObjectMetaData(solutionName,IRepository.SOLUTIONS),new AbstractActiveSolutionHandler(as){
              @Override public IRepository getRepository(){
                return ApplicationServerRegistry.get().getLocalRepository();
              }
            }
);
          }
 catch (          Exception e) {
            Debug.error("String_Node_Str" + solutionName + "String_Node_Str"+ clientUUID,e);
          }
        }
        if (fs != null) {
          try {
            String formName=getFormNameFromURI(uri);
            if (formName != null) {
              Form f=fs.getForm(formName);
              if (f == null && wsSession != null)               f=wsSession.getClient().getFormManager().getPossibleForm(formName);
              Form form=(f != null ? fs.getFlattenedForm(f) : null);
              if (form != null) {
                if (HTTPUtils.checkAndSetUnmodified(((HttpServletRequest)servletRequest),((HttpServletResponse)servletResponse),fs.getLastModifiedTime()))                 return;
                HTTPUtils.setNoCacheHeaders((HttpServletResponse)servletResponse);
                boolean html=uri.endsWith("String_Node_Str");
                PrintWriter w=servletResponse.getWriter();
                if (html && form.isResponsiveLayout()) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str");
                  FormLayoutStructureGenerator.generateLayout(form,formName,wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),w,Utils.getAsBoolean(request.getParameter("String_Node_Str")),Utils.getAsBoolean(request.getParameter("String_Node_Str")));
                }
 else                 if (uri.endsWith("String_Node_Str")) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str");
                  boolean insideResponsiveLayout=false;
                  if (wsSession != null) {
                    IWebFormController parentForm=null;
                    String parent=request.getParameter("String_Node_Str");
                    if (parent != null) {
                      parentForm=(IWebFormController)((BasicFormManager)wsSession.getClient().getFormManager()).getCachedFormController(parent);
                    }
 else {
                      IFormController fc=((BasicFormManager)wsSession.getClient().getFormManager()).getCachedFormController(formName);
                      if (fc instanceof WebFormController) {
                        parentForm=((WebFormController)fc).getParentFormController();
                      }
                    }
                    while (parentForm != null) {
                      if (parentForm.getForm().isResponsiveLayout()) {
                        insideResponsiveLayout=true;
                        break;
                      }
                      parentForm=((WebFormController)parentForm).getParentFormController();
                    }
                  }
                  FormLayoutGenerator.generateRecordViewForm(w,form,formName,wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),insideResponsiveLayout,Utils.getAsBoolean(request.getParameter("String_Node_Str")),Utils.getAsBoolean(request.getParameter("String_Node_Str")));
                }
 else                 if (uri.endsWith("String_Node_Str")) {
                  ((HttpServletResponse)servletResponse).setContentType("String_Node_Str" + (html ? "String_Node_Str" : "String_Node_Str"));
                  new FormTemplateGenerator(wsSession != null ? new ServoyDataConverterContext(wsSession.getClient()) : new ServoyDataConverterContext(fs),false,Utils.getAsBoolean(request.getParameter("String_Node_Str"))).generate(form,formName,"String_Node_Str",w);
                }
                w.flush();
                return;
              }
            }
 else {
              Map<String,String> variableSubstitution=new HashMap<String,String>();
              variableSubstitution.put("String_Node_Str",String.valueOf(fs.getSolution().getTextOrientation()));
              super.doFilter(servletRequest,servletResponse,filterChain,Arrays.asList("String_Node_Str"),getFormScriptReferences(fs),variableSubstitution);
              return;
            }
          }
  finally {
            if (closeFS)             fs.close(null);
          }
        }
      }
    }
    Debug.log("String_Node_Str" + uri);
    super.doFilter(servletRequest,servletResponse,filterChain,null,null,null);
  }
 catch (  RuntimeException|Error e) {
    Debug.error(e);
    throw e;
  }
}