[richfaces-issues] [JBoss JIRA] (RF-13444) r:fileUpload throws IOException "Request prolog cannot be read"

Matti Bickel (JIRA) issues at jboss.org
Thu Jan 16 04:18:33 EST 2014


    [ https://issues.jboss.org/browse/RF-13444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936208#comment-12936208 ] 

Matti Bickel edited comment on RF-13444 at 1/16/14 4:17 AM:
------------------------------------------------------------

I've spent an afternoon debugging this, using Wildfly-8.0.0.CR1 (undertow-core-1.0.0.Beta30, JSF 2.2.4) with RF-4.3.4 and summarized what I learned at http://stackoverflow.com/a/21157340/785663 

Short version: the MultipartRequest25 that RichFaces-4.3 (and looking at the code, RichFaces-5, too) uses tries to parse the request body again if a parameter could not be found (returned null). Since the servlet container already mangled the body, you get an EOF from the stream and the code converts this into the IOException seen here.

A possible remedy probably involves creating a MultipartRequest30 that is written with Servlet-3.0 containers in mind?
                
      was (Author: mbickel):
    I've spent an afternoon debugging this, using Wildfly-8.0.0.CR1 (undertow-core-1.0.0.Beta30, JSF 2.2.4) with RF-4.3.4 and summarized what I learned at
http://stackoverflow.com/a/21157340/785663 

Short version: the MultipartRequest25 that RF-4.3 (and looking at the code, RF-5, too) uses tries to parse the request body again if a parameter could not be found (returned null). Since the servlet container already mangled the body, you get an EOF from the stream and the code converts this into the IOException seen here.

A possible remedy probably involves creating a MultipartRequest30 that is written with Servlet-3.0 containers in mind?
                  
> r:fileUpload throws IOException "Request prolog cannot be read"
> ---------------------------------------------------------------
>
>                 Key: RF-13444
>                 URL: https://issues.jboss.org/browse/RF-13444
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 5.0.0.Alpha2
>            Reporter: Juergen Zimmermann
>              Labels: jsf22
>             Fix For: 5.0.0.Alpha3
>
>
> I tried f:fileUpload with the latest WildFly snapshot. When uploading a jpeg file I get this stacktrace. Maybe, RF-13061 is back in town...
> {code}
> SEVERE [org.richfaces.log.Application] (default task-6) Exception parsing multipart request: Request prolog cannot be read: org.richfaces.exception.FileUploadException: Exception parsing multipart request: Request prolog cannot be read
> 	at org.richfaces.request.MultipartRequestParser.parse(MultipartRequestParser.java:156) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	at org.richfaces.request.MultipartRequest25.parseIfNecessary(MultipartRequest25.java:77) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	at org.richfaces.request.MultipartRequest25.getParameter(MultipartRequest25.java:114) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	at com.sun.faces.context.RequestParameterMap.get(RequestParameterMap.java:75) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at com.sun.faces.context.RequestParameterMap.get(RequestParameterMap.java:56) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at java.util.Collections$UnmodifiableMap.get(Collections.java:1339) [rt.jar:1.7.0_45]
> 	at com.sun.faces.application.view.MultiViewHandler.calculateRenderKitId(MultiViewHandler.java:220) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:157) [jboss-jsf-api_2.2_spec-2.2.4.jar:2.2.4]
> 	at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:157) [jboss-jsf-api_2.2_spec-2.2.4.jar:2.2.4]
> 	at javax.faces.application.ViewHandlerWrapper.calculateRenderKitId(ViewHandlerWrapper.java:157) [jboss-jsf-api_2.2_spec-2.2.4.jar:2.2.4]
> 	at com.sun.faces.context.FacesContextImpl.isPostback(FacesContextImpl.java:212) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at javax.faces.context.FacesContextWrapper.isPostback(FacesContextWrapper.java:461) [jboss-jsf-api_2.2_spec-2.2.4.jar:2.2.4]
> 	at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:193) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.4-jbossorg-1.jar:]
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) [jboss-jsf-api_2.2_spec-2.2.4.jar:2.2.4]
> 	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70)
> 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:239) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:226) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:72) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:145) [undertow-servlet-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta28.jar:1.0.0.Beta28]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
> 	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
> Caused by: java.io.IOException: Request prolog cannot be read
> 	at org.richfaces.request.MultipartRequestParser.readProlog(MultipartRequestParser.java:270) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	at org.richfaces.request.MultipartRequestParser.initialize(MultipartRequestParser.java:172) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	at org.richfaces.request.MultipartRequestParser.parse(MultipartRequestParser.java:148) [richfaces-5.0.0.Alpha2.jar:5.0.0.Alpha2]
> 	... 43 more
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list