• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to override a file in another path?

 
yuanmintao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the program:
File sourceFile1 = new File(ls_tempImage1);
File destFile1 = new File(destFileUrl1);
fileLength1 = sourceFile1.length();
FileInputStream fis1 =null;
FileOutputStream fos1 =null ;
try {
fis1 = new FileInputStream(sourceFile1);
fos1 = new FileOutputStream(destFile1.getAbsolutePath(),false);
}
catch(FileNotFoundException fnfe) {}
finally {
try {

for (i=1;i<=fileLength1;i++){
fos1.write(fis1.read());
}
fis1.close();
fos1.close();
} catch(IOException ioe) {
System.err.println("File Closing error: " + ioe);
}
}
and the problem is :
java.lang.NullPointerException
at eating_corp.EatingCorp.updateEatingCorp(EatingCorp.java:642)
at eating_corp.EatingCorpServlet.doPost(EatingCorpServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:82)
at com.caucho.server.http.Invocation.service(Invocation.java:259)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:146)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:238)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:484)
why?
i don't know,How to make it right?
please help me ,thanks !
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at "JavaRanch Naming Policy" . We require names to have at least two words (not just letters), separated by a space, and strongly recommend that you use your full real name. We want to get to know you as a Professional. Please choose a new name which meets the requirements and re-register.
Also this question is more appropriate to the I/O forum, so I will move it there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!