Skip to content

Commit

Permalink
Set the original cause of the IOException for the tryLock call
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwatson committed Oct 30, 2024
1 parent 01461f8 commit 853336c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*******************************************************************************/
package org.eclipse.osgi.internal.location;

import java.io.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
import org.eclipse.osgi.internal.messages.Msg;
Expand Down Expand Up @@ -50,7 +53,7 @@ public synchronized boolean lock() throws IOException {
System.out.println(NLS.bind(Msg.location_cannotLock, lockFile));
// produce a more specific message for clients
String specificMessage = NLS.bind(Msg.location_cannotLockNIO, new Object[] {lockFile, ioe.getMessage(), "\"-D" + LocationHelper.PROP_OSGI_LOCKING + "=none\""}); //$NON-NLS-1$ //$NON-NLS-2$
throw new IOException(specificMessage);
throw new IOException(specificMessage, ioe);
} catch (OverlappingFileLockException e) {
// handle it as null result
fileLock = null;
Expand Down

0 comments on commit 853336c

Please sign in to comment.