commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: [fileupload] Write to disk error
Date Tue, 07 Jun 2005 17:36:10 GMT
On 6/7/05, Luke <luke@lukeshannon.com> wrote:
> Hi;
> 
> I have the following code:
> 
> File uploadFull = new File(uploadFullDir + fileName);
> myLogger.debug(upLoadFiles.class.getName() + " uploadFull: " +
> uploadFull.toString());
> File uploadThumb = new File(thumbDir + fileName);
> myLogger.debug(upLoadFiles.class.getName() + " uploadThumb: " +
> uploadThumb.toString());
> file.write(uploadFull);
> file.write(uploadThumb);
> 
> The console is producing this error. I don't know why. It is happening on
> the line: file.write(uploadThumb). The directory structure exists. Why would
> there be a null pointer?

As the JavaDoc comments explain, write() is only guaranteed to work
once for any given file item.

--
Martin Cooper


> Any ideas?
> 
> Thanks,
> 
> Luke
> 
> 19484 [http-80-Processor25] DEBUG servlet.upLoad.upLoadFiles -
> servlet.upLoad.upLoadFiles Pic directory
> E:\testSite\pictures\atouchofclass\20050101\pics\
> 19484 [http-80-Processor25] DEBUG servlet.upLoad.upLoadFiles -
> servlet.upLoad.upLoadFiles Thumb directory
> E:\testSite\pictures\atouchofclass\20050101\thumbs\
> 19515 [http-80-Processor25] DEBUG servlet.upLoad.upLoadFiles -
> servlet.upLoad.upLoadFiles uploadFull:
> E:\testSite\pictures\atouchofclass\20050101\pics\me_dolphin.jpg
> 19515 [http-80-Processor25] DEBUG servlet.upLoad.upLoadFiles -
> servlet.upLoad.upLoadFiles uploadThumb:
> E:\testSite\pictures\atouchofclass\20050101\thumbs\me_dolphin.jpg
> java.lang.NullPointerException
> at
> org.apache.commons.fileupload.DefaultFileItem.write(DefaultFileItem.java:434
> )
> at servlet.upLoad.upLoadFiles.doPost(upLoadFiles.java:89)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:237)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:214)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> Valve.java:198)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:152)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> .java:540)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
> )
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
> )
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :109)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
> ction(Http11Protocol.java:705)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> a:683)
> at java.lang.Thread.run(Thread.java:536)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message