This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalStateException after canceling file downloading.

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am providing a file download option to the user in my web-application. Suppose user selects cancel the downloads, I am getting IllegalStateException. I am using tomcat and spring MVC. Kindly let me know how to handle this exception.

here is my code which downloads the file:

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you handled it. If you wanted to do something else, you could also do it in the 'catch' block.
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want that the exception thrown should display on the tomcat console. But it is showing.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want that the exception thrown should display on the tomcat console. But it is showing.


That's because your logger may have configured to do so.
 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The IllegalStateException could be because you are trying to close (close(output); ) the resource(resource.close();).

I believe the response is committed and you are trying to close.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Vijitha Kumara: if you don't want it logged, then don't log it.
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all of you, my mistake I was trying to open the response output stream again in some other method
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic