Buggy code:
public class BridgeContextImpl extends BridgeContextCompatImpl { public static final String ATTR_RESPONSE_NAMESPACE = "com.liferay.faces.bridge.responseNamespace" ; private static final String NON_NUMERIC_NAMESPACE_PREFIX = "A" ; private static final Logger logger = LoggerFactory . getLogger ( BridgeContextImpl . class ) ; private Map < String , Object > attributeMap = new HashMap < String , Object > ( ) ; private BridgeConfig bridgeConfig ; private Boolean bridgeRequestScopePreserved ; private BridgeRequestScope bridgeRequestScope ; private BridgeURLFactory bridgeURLFactory ; private ContextMapFactory contextMapFactory ; private String defaultRenderKitId ; private Map < String , String > defaultViewIdMap ; private FacesView facesView ; private IncongruityContext incongruityContext ; private List < String > preFacesRequestAttrNames ; private PortletConfig portletConfig ; private PortletContainer portletContainer ; private PortletContext portletContext ; private PortletRequest portletRequest ; private PortletPhase portletPhase ; private PortletResponse portletResponse ; private Boolean preserveActionParams ; private Map < String , String [ ] > preservedActionParams ; private boolean processingAfterViewContent ; private boolean renderRedirect ; private boolean renderRedirectAfterDispatch ; private BridgeRedirectURL renderRedirectURL ; private Boolean renderRedirectEnabled ; private Map < String , String > requestHeaderMap ; private Map < String , String [ ] > requestHeaderValuesMap ; private Map < String , String > requestParameterMap ; private Map < String , String [ ] > requestParameterValuesMap ; private BridgeContextImpl . StringWrapper requestPathInfo ; private String requestServletPath ; private String responseNamespace ; private Writer responseOutputWriter ; private String savedViewState ; private String viewIdAndQueryString ; public BridgeContextImpl ( BridgeConfig bridgeConfig , BridgeRequestScope bridgeRequestScope , PortletConfig portletConfig , PortletContext portletContext , PortletRequest portletRequest , PortletResponse portletResponse , Bridge . PortletPhase portletPhase , PortletContainer portletContainer , IncongruityContext incongruityContext ) { } @ Override public void dispatch ( String path ) throws IOException { } @ Override public BridgeActionURL encodeActionURL ( String url ) { } @ Override public BridgePartialActionURL encodePartialActionURL ( String url ) { } @ Override public BridgeRedirectURL encodeRedirectURL ( String baseUrl , Map < String , List < String > > parameters ) { } @ Override public BridgeResourceURL encodeResourceURL ( String url ) { } @ Override public void redirect ( String url ) throws IOException { if ( url != null ) { BridgeContextImpl . logger . debug ( "redirect<seq2seq4repair_space>url=[{0}]" , url ) ; String currentFacesViewId = FacesContext . getCurrentInstance ( ) . getViewRoot ( ) . getViewId ( ) ; BridgeRedirectURL bridgeRedirectURL = bridgeURLFactory . getBridgeRedirectURL ( url , null , currentFacesViewId , this ) ; if ( ( ( ( portletPhase ) == ( PortletPhase . ACTION_PHASE ) ) || ( ( portletPhase ) == ( PortletPhase . EVENT_PHASE ) ) ) || ( ( portletPhase ) == ( PortletPhase . RENDER_PHASE ) ) ) { if ( ( ( portletPhase ) == ( PortletPhase . ACTION_PHASE ) ) && ( ( ( url . startsWith ( POUND ) ) || ( bridgeRedirectURL . isExternal ( ) ) ) || ( BooleanHelper . isTrueToken ( bridgeRedirectURL . getParameter ( DIRECT_LINK ) ) ) ) ) { bridgeRequestScope . setRedirectOccurred ( true ) ; portletContainer . redirect ( bridgeRedirectURL . toString ( ) ) ; } else { FacesContext facesContext = FacesContext . getCurrentInstance ( ) ; String newViewId = bridgeRedirectURL . getContextRelativePath ( ) ; if ( ( portletPhase ) == ( PortletPhase . ACTION_PHASE ) ) { partialViewContextRenderAll ( facesContext ) ; facesContext . responseComplete ( ) ; getBridgeRequestScope ( ) . setRedirectOccurred ( true ) ; <START_BUG> bridgeRedirectURL . setParameter ( VIEW_ID , newViewId ) ; <END_BUG> PortletURL redirectURL = portletContainer . createRedirectURL ( bridgeRedirectURL . toString ( ) , null ) ; portletContainer . redirect ( redirectURL . toString ( ) ) ; } else if ( ( portletPhase ) == ( PortletPhase . EVENT_PHASE ) ) { String oldViewId = facesContext . getViewRoot ( ) . getViewId ( ) ; if ( ! ( oldViewId . equals ( newViewId ) ) ) { ViewHandler viewHandler = facesContext . getApplication ( ) . getViewHandler ( ) ; UIViewRoot newViewRoot = viewHandler . createView ( facesContext , newViewId ) ; facesContext . setViewRoot ( newViewRoot ) ; } partialViewContextRenderAll ( facesContext ) ; facesContext . responseComplete ( ) ; getBridgeRequestScope ( ) . setRedirectOccurred ( true ) ; try { StateAwareResponse stateAwareResponse = ( ( StateAwareResponse ) ( portletResponse ) ) ; bridgeRedirectURL . applyToResponse ( stateAwareResponse ) ; } catch ( PortletModeException e ) { BridgeContextImpl . logger . error ( e . getMessage ( ) ) ; } catch ( WindowStateException e ) { BridgeContextImpl . logger . error ( e . getMessage ( ) ) ; } } else if ( ( portletPhase ) == ( PortletPhase . RENDER_PHASE ) ) { if ( bridgeRedirectURL . isFacesViewTarget ( ) ) { renderRedirect = true ; renderRedirectURL = bridgeRedirectURL ; } else { String viewIdRenderParameterName = bridgeConfig . getViewIdRenderParameterName ( ) ; String viewIdRenderParameterValue = bridgeRedirectURL . getParameter ( viewIdRenderParameterName ) ; if ( viewIdRenderParameterValue != null ) { renderRedirect = true ; viewIdRenderParameterValue = URLDecoder . decode ( viewIdRenderParameterValue , UTF8 ) ; bridgeRedirectURL = bridgeURLFactory . getBridgeRedirectURL ( viewIdRenderParameterValue , null , currentFacesViewId , this ) ; renderRedirectURL = bridgeRedirectURL ; } else { throw new IllegalStateException ( "6.1.3.1:<seq2seq4repair_space>Unable<seq2seq4repair_space>to<seq2seq4repair_space>redirect<seq2seq4repair_space>to<seq2seq4repair_space>a<seq2seq4repair_space>non-Faces<seq2seq4repair_space>view<seq2seq4repair_space>during<seq2seq4repair_space>the<seq2seq4repair_space>RENDER_PHASE." ) ; } } } } } else { portletContainer . redirect ( bridgeRedirectURL . toString ( ) ) ; } } else { BridgeContextImpl . logger . error ( "redirect<seq2seq4repair_space>url=null" ) ; } } @ Override public void release ( ) { } @ Override public Map < String , Object > getAttributes ( ) { } @ Override public BridgeConfig getBridgeConfig ( ) { } @ Override public BridgeRequestScope getBridgeRequestScope ( ) { } public void setBridgeRequestScopePreserved ( boolean bridgeRequestScopePreserved ) { } @ Override public boolean isBridgeRequestScopePreserved ( ) { } @ Override public String getDefaultRenderKitId ( ) { } @ Override @ SuppressWarnings ( "unchecked" ) public Map < String , String > getDefaultViewIdMap ( ) { } protected FacesView getFacesView ( ) throws BridgeDefaultViewNotSpecifiedException , BridgeInvalidViewPathException { } @ Override public String getFacesViewId ( ) throws BridgeDefaultViewNotSpecifiedException , BridgeInvalidViewPathException { }

Fix:
bridgeRedirectURL . setParameter ( FACES_VIEW_ID_PARAMETER , newViewId ) ;