Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Becomes Locked so App Cannot Make Changes to it

 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the following the file becomes Locked and the App cannot manipulate it.
How can I release the file after the properties are retreived?

 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always close all your resources*. Use a finally block for this; don't be afraid to nest try statements:
* like InputStreams, OutputStreams, Readers, Writers, SQL connections, SQL statements, SQL result sets, etc.

You may see the following, but I think it's a lot nastier:
 
Steve Dyke
Ranch Hand
Posts: 1616
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Always close all your resources*. Use a finally block for this; don't be afraid to nest try statements:


Thanks, this is exactly what I needed.
 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic