Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java.lang.ClassCastException

 
Awet Haddis
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Background: I am testing a class that will allow a user to upload data. I am using the Apache Commons FileUpload library.




I believe the compiler is having a problem with this statement:



Is there a way to specify the path to a FileItem so I don't have to cast a file as a FileItem? Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awet Haddis wrote:Is there a way to specify the path to a FileItem so I don't have to cast a file as a FileItem? Thanks in advance.


Well, no you can't take just anything and cast it to a FileItem. If you want to simulate what the file upload would have produced, you're going to have to produce a mock version of FileItem and have it wrap your File, or something like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic