[ 
https://issues.apache.org/jira/browse/TRINIDAD-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997167#comment-12997167
 ] 

Scott O'Bryan commented on TRINIDAD-1890:
-----------------------------------------

Are you using the default's for the file upload or do you have special 
storage/limit settings..

I was going to look at possibly switching this to using Apache Commons 
implementations, but the new servlet spec will supposedly have multi-part form 
handling built in so I decided to wait.  Probably best to fix what we have for 
Legacy support.

> NullPointerException when using file upload with trinidad
> ---------------------------------------------------------
>
>                 Key: TRINIDAD-1890
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1890
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>         Environment: Linux x64
> Java 1.6
>            Reporter: Thomas Müller
>            Assignee: Matthias Weßendorf
>
> Hi,
> I tried to use the file upload in trinidad. When I want to submit a file, I 
> get ther following exception:
> java.lang.NullPointerException
>       
> org.apache.myfaces.trinidadinternal.config.upload.UploadRequestWrapper.setCharacterEncoding(UploadRequestWrapper.java:83)
>       
> com.sun.faces.context.ExternalContextImpl.setRequestCharacterEncoding(ExternalContextImpl.java:165)
>       
> org.apache.myfaces.trinidad.context.ExternalContextDecorator.setRequestCharacterEncoding(ExternalContextDecorator.java:266)
>       
> org.apache.myfaces.trinidad.context.ExternalContextDecorator.setRequestCharacterEncoding(ExternalContextDecorator.java:266)
>       javax.faces.application.ViewHandler.initView(ViewHandler.java:270)
>       
> com.sun.faces.application.ViewHandlerImpl.initView(ViewHandlerImpl.java:119)
>       
> javax.faces.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:175)
>       
> com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
>       com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
>       javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
> Can you help me if this is a bug or something is wrong in my enviroment 
> properties?
> web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
>   <display-name>pferdemarkt.tv</display-name>
>   <welcome-file-list>
>     <welcome-file>index.html</welcome-file>
>     <welcome-file>index.htm</welcome-file>
>     <welcome-file>index.jsp</welcome-file>
>     <welcome-file>default.html</welcome-file>
>     <welcome-file>default.htm</welcome-file>
>     <welcome-file>default.jsp</welcome-file>
>   </welcome-file-list>
>   <jsp-config>
>     <jsp-property-group>
>       <url-pattern>*.jsp</url-pattern>
>       <url-pattern>*.jspf</url-pattern>
>       <page-encoding>UTF-8</page-encoding>
>       <scripting-invalid>true</scripting-invalid>
>       <is-xml>true</is-xml>
>     </jsp-property-group>
>   </jsp-config>
>   <context-param>
>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>     <param-value>client</param-value>
>   </context-param>
>   <context-param>
>     <param-name>com.sun.faces.enableLazyBeanValidation</param-name>
>     <param-value>false</param-value>
>   </context-param>
>   <context-param>
>     <param-name>com.sun.faces.validateXml</param-name>
>     <param-value>false</param-value>
>   </context-param>
>   <context-param>
>     <param-name>com.sun.faces.verifyObjects</param-name>
>     <param-value>false</param-value>
>   </context-param>
>   
> <context-param>
>     <!-- Maximum memory per request (in bytes) -->
>     <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
>     <!-- Use 500K -->
>     <param-value>512000</param-value>
>   </context-param>
>   <context-param>
>     <!-- Maximum disk space per request (in bytes) -->
>     <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
>     <!-- Use 5,000K -->
>     <param-value>5120000</param-value>
>   </context-param>
>   <context-param>
>     <!-- directory to store temporary files -->
>     <param-name>org.apache.myfaces.trinidad.UPLOAD_TEMP_DIR</param-name>
>     <!-- Use a TrinidadUploads subdirectory of /tmp -->
>     <param-value>/tmp/</param-value>
>   </context-param>
>   
>   <!-- Faces Servlet -->
>   <servlet>
>     <servlet-name>Faces Servlet</servlet-name>
>     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.html</url-pattern>
>   </servlet-mapping>
>   
> <filter>
>     <filter-name>trinidad</filter-name>
>     
> <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
>   </filter>
>   <filter-mapping>
>     <filter-name>trinidad</filter-name>
>     <!-- This assumes that the FacesServlet has been registered -->
>     <!-- under the name "faces" -->
>     <servlet-name>faces</servlet-name>
>   </filter-mapping>
> <servlet>
>   <servlet-name>resources</servlet-name>
>   
> <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
>  </servlet>
> <!-- This cannot be configured currently -->
> <servlet-mapping>
>     <servlet-name>resources</servlet-name>
>     <url-pattern>/adf/*</url-pattern>
> </servlet-mapping>
>   
> </web-app>
> faces-config.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <faces-config
>     xmlns="http://java.sun.com/xml/ns/javaee";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
> http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";
>     version="1.2">
>     
>     <application>
>         <locale-config>
>             <default-locale>de</default-locale>
>             <supported-locale>de</supported-locale>
>         </locale-config>
> <default-render-kit-id>
>       org.apache.myfaces.trinidad.core
>     </default-render-kit-id>
>         
>     </application>
>    <managed-bean>
>       <managed-bean-name>infoBean</managed-bean-name>
>       <managed-bean-class>test.backing.InfoBean</managed-bean-class>
>       <managed-bean-scope>request</managed-bean-scope>
>    </managed-bean>
> </faces-config>
> index.jsp:
> <?xml version="1.0" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page";
>       xmlns:h="http://java.sun.com/jsf/html";
>       xmlns:f="http://java.sun.com/jsf/core";
>       xmlns:tr="http://myfaces.apache.org/trinidad";
>       xmlns:trh="http://myfaces.apache.org/trinidad/html";
>       xmlns:c="http://java.sun.com/jsp/jstl/core"; version="2.0">
>       <jsp:directive.page contentType="text/html" />
>       <jsp:output doctype-root-element="html"
>               doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
>               
> doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; />
>       <f:view>
>               <html xmlns="http://www.w3.org/1999/xhtml";>
>               <head>
>               <title>Testpage</title>
>               </head>
>               <body>
>               idx:
>               <h:outputText value="#{infoBean.idx}" />
>               <hr />
>               <tr:form usesUpload="true">
>                       <tr:inputFile label="Upload:" value="#{infoBean.file}" 
> />
>                       <tr:commandButton text="Begin" 
> action="#{infoBean.doUpload}" />
>               </tr:form>
>               </body>
>               </html>
>       </f:view>
> </jsp:root>
> Best Regards
> Thomas

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to