mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Merge remote-tracking branch 'origin/GP-1816-dragonmacher-osgi-building-update--SQUASHED'
This commit is contained in:
commit
a9c928bb14
20 changed files with 629 additions and 583 deletions
|
@ -19,6 +19,10 @@ import java.io.PrintWriter;
|
|||
|
||||
public class NullPrintWriter extends PrintWriter {
|
||||
|
||||
public static PrintWriter dummyIfNull(PrintWriter pw) {
|
||||
return pw == null ? new NullPrintWriter() : pw;
|
||||
}
|
||||
|
||||
public NullPrintWriter() {
|
||||
super(new NullWriter());
|
||||
}
|
||||
|
|
|
@ -20,11 +20,9 @@ import java.net.InetAddress;
|
|||
import java.net.UnknownHostException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.SystemUtilities;
|
||||
|
||||
public class FileLocker {
|
||||
|
||||
|
@ -91,28 +89,16 @@ public class FileLocker {
|
|||
|
||||
Properties properties = new Properties();
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(lockFile);
|
||||
try (InputStream is = new FileInputStream(lockFile)) {
|
||||
properties.load(is);
|
||||
return properties;
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
// should never happen
|
||||
// should not happen
|
||||
}
|
||||
catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// we tried!
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -178,25 +164,13 @@ public class FileLocker {
|
|||
|
||||
private boolean storeProperties(Properties properties) {
|
||||
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(lockFile);
|
||||
try (OutputStream os = new FileOutputStream(lockFile)) {
|
||||
properties.store(os, "Ghidra Lock File");
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
if (os != null) {
|
||||
try {
|
||||
os.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// don't care; we tried
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLockOwner() {
|
||||
|
@ -212,7 +186,7 @@ public class FileLocker {
|
|||
for (String key : PROPERTY_KEYS) {
|
||||
String originalProperty = createdLockProperties.getProperty(key);
|
||||
String currentProperty = currentLockProperties.getProperty(key);
|
||||
if (!SystemUtilities.isEqual(originalProperty, currentProperty)) {
|
||||
if (!Objects.equals(originalProperty, currentProperty)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue