1

I have a file upload page that takes a file and parses it.

Order of Events

  1. user uploads file
  2. uploaded file gets copied
  3. copied file gets it's encoding checked, with CPDetector
  4. determined encoding from the copied file is used to parse the original uploaded file
    • FileNotFoundException on Solaris Test Server during BufferedReader creation.
  5. copied file is deleted
  6. uploaded file is parsed/verified
  7. parsed data is saved to a database
  8. uploaded file is deleted (I can't remember if I'm doing this or Tomcat is.)

The Whole process works on my Windows 7 workstation. As noted above it does not work on my Solaris Test Server. Something(I Suspect Tomcat) is deleting the uploaded file before I can finish parsing it.

I've watched the directory during the process and an uploaded file does indeed get created, but it lasts less than a second before being deleted. Also It's supposed to go into /opt/tomcat/ but seems be getting created in the /var/opt/csw/tomcat6/temp/ directory instead.

Thanks for any help

Raystorm
  • 6,180
  • 4
  • 35
  • 62

1 Answers1

0

I realize it's probably bad form to answer my own question like this but I wanted to leave this here in-case it helps someone else.

The Problem turned out to be How I was accessing the files.

I had hard-coded file paths, for windows, and Database loaded ones for the test server. I switched those to using System.getProperty("catalina.home")+"/temp/" + filename I'm also copying the temp file a second time so I end up with:

Order of Events (changes are in bold)

  1. user uploads file
  2. uploaded file gets copied
  3. copied file gets it's encoding checked, with CPDetector
  4. uploaded file gets copied again to ensure a copy survives to be parsed
  5. determined encoding from the copied file is used to parse the original uploaded file
  6. copy used for encoding detection is deleted
  7. copy for parse is parsed/verified
  8. parsed data is saved to a database
  9. parsed file is deleted.
  10. uploaded file is deleted (I'm not sure if I'm doing this or Tomcat is.)
Raystorm
  • 6,180
  • 4
  • 35
  • 62