Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 570665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:25:34+00:00 2026-05-13T13:25:34+00:00

I’m working with a 3rd party JPEG/EXIF manipulation library ( Mediautil ) that is

  • 0

I’m working with a 3rd party JPEG/EXIF manipulation library (Mediautil) that is causing me some headaches. I want to change an image’s EXIF data. To do this, I need to write the updated version to a temporary file, delete the original and then rename the temp file to the original name.

My problem is that the File.delete() call fails and returns false, presumably because the library still has it opened in some way – but I have done everything I can find in the API to make it close all streams. Even worse: the problem seems to be timing-dependant, and the Unit tests where it occurs sometimes fail and sometimes not – but the code is not multithreaded.

Bizarrely, there is one library call that removes the problem – but it also removes the EXIF thumbnail, which I don’t actually want. And looking at the code, I absolutely can’t see where it closes any streams that might otherwise stay open.

Any ideas how to attack this problem?

Edit:
This is on Windows XP, Java 6. And another thing: I have found out that if I call System.gc() before calling File.delete(), it works – presumably because that triggers some finalizer. So it definitely seems to be an unclosed stream.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:25:35+00:00Added an answer on May 13, 2026 at 1:25 pm

    I would go for some help with the debugger here. A quick dig through the java.io stuff shows that the only likely finalize() candidate is in FileOutputStream. So slap a breakpoint in there, run your program, and try and get System.gc() to trigger FileOutputStream.finalize() to release your stream. That should give you an answer as to whether or not that’s your problem.

    Once you can reproduce that, then you need to start matching instantiation of FileOutputStream instances with their finalization. A good debugger will give you internal JVM object identifiers for each object, so if you can track the OIDs as they get created, and track them as they get finalized, then hopefully you’ll be able to associate the key call to finalize with a specific call new new FileOutputStream.

    Might be a long slog, though, depending how complex your application is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.