This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java.lang.ClassCastException

 
Awet Haddis
Greenhorn
Posts: 11
  • 0
  • 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
Pie
Posts: 20185
26
MySQL Database
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic