mirror of
https://github.com/jlengrand/native-utils.git
synced 2026-03-10 08:31:22 +00:00
Improve exception handling for os.write.
* Replace catch wildcard Exception with Throwable when handling errors on write of temporary library file. * Fixed typo on "prefix" in comment. * Removed unused java.net.URI import.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
package cz.adamh.utils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.nio.file.FileSystemNotFoundException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.ProviderNotFoundException;
|
||||
@@ -67,7 +66,7 @@ public class NativeUtils {
|
||||
String[] parts = path.split("/");
|
||||
String filename = (parts.length > 1) ? parts[parts.length - 1] : null;
|
||||
|
||||
// Split filename to prexif and suffix (extension)
|
||||
// Split filename to prefix and suffix (extension)
|
||||
String prefix = "";
|
||||
String suffix = null;
|
||||
if (filename != null) {
|
||||
@@ -119,7 +118,7 @@ public class NativeUtils {
|
||||
while ((readBytes = is.read(buffer)) != -1) {
|
||||
os.write(buffer, 0, readBytes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
temp.delete();
|
||||
throw e;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user