@@ -155,9 +155,10 @@ public interface GFileSystem extends Closeable, ExtensionPoint { *
* @param file {@link GFile} to get info message for.
* @param monitor {@link TaskMonitor} to watch and update progress.
- * @return multi-line formatted string with info about the file.
- * @throws IOException if IO problem.
+ * @return multi-line formatted string with info about the file, or null.
*/
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException;
+ default public String getInfo(GFile file, TaskMonitor monitor) {
+ return null;
+ }
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/GFileSystemBase.java b/Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/GFileSystemBase.java
index 1abcee1882..21ab576ccb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/GFileSystemBase.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/GFileSystemBase.java
@@ -129,9 +129,6 @@ public abstract class GFileSystemBase implements GFileSystem {
@Override
abstract public List
@@ -169,12 +169,9 @@ public class TarFileSystem implements GFileSystem {
}
@Override
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException {
+ public String getInfo(GFile file, TaskMonitor monitor) {
TarMetadata tmd = fsih.getMetadata(file);
- if (tmd == null) {
- throw new IOException("Unknown file " + file);
- }
- return FSUtilities.infoMapToString(getInfoMap(tmd.tarArchiveEntry));
+ return (tmd != null) ? FSUtilities.infoMapToString(getInfoMap(tmd.tarArchiveEntry)) : null;
}
@Override
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
index fd9d0bb5ba..c1f377bdba 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
@@ -45,12 +45,9 @@ public class UniversalBinaryFileSystem extends GFileSystemBase {
}
@Override
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException {
+ public String getInfo(GFile file, TaskMonitor monitor) {
int index = list.indexOf(file);
- if (index == -1) {
- return null;
- }
- return header.getArchitectures().get(index).toString();
+ return (index != -1) ? header.getArchitectures().get(index).toString() : null;
}
@Override
@@ -79,7 +76,8 @@ public class UniversalBinaryFileSystem extends GFileSystemBase {
Processor processor =
CpuTypes.getProcessor(architecture.getCpuType(), architecture.getCpuSubType());
int bitSize = CpuTypes.getProcessorBitSize(architecture.getCpuType());
- String name = processor + "-" + bitSize + "-cpu0x" + Integer.toHexString(architecture.getCpuSubType());
+ String name = processor + "-" + bitSize + "-cpu0x" +
+ Integer.toHexString(architecture.getCpuSubType());
GFileImpl file =
GFileImpl.fromFilename(this, root, name, false, architecture.getSize(), null);
list.add(file);
@@ -100,7 +98,8 @@ public class UniversalBinaryFileSystem extends GFileSystemBase {
FatArch architecture = architectures.get(index);
- return new BoundedInputStream(provider.getInputStream(architecture.getOffset()), architecture.getSize());
+ return new BoundedInputStream(provider.getInputStream(architecture.getOffset()),
+ architecture.getSize());
}
@Override
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/yaffs2/YAFFS2FileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/yaffs2/YAFFS2FileSystem.java
index 3b5d341868..bd186cd028 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/yaffs2/YAFFS2FileSystem.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/yaffs2/YAFFS2FileSystem.java
@@ -98,7 +98,7 @@ public class YAFFS2FileSystem extends GFileSystemBase {
}
@Override
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException {
+ public String getInfo(GFile file, TaskMonitor monitor) {
return "YAFFS2, Yet Another Flash File System V2, commonly used for Android System and UserData images.";
}
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/zip/ZipFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/zip/ZipFileSystem.java
index d86d396bb8..dc2b135adf 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/zip/ZipFileSystem.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/zip/ZipFileSystem.java
@@ -117,9 +117,9 @@ public class ZipFileSystem implements GFileSystem {
}
@Override
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException {
+ public String getInfo(GFile file, TaskMonitor monitor) {
ZipEntry zipEntry = fsIndexHelper.getMetadata(file);
- return FSUtilities.infoMapToString(getInfoMap(zipEntry));
+ return (zipEntry != null) ? FSUtilities.infoMapToString(getInfoMap(zipEntry)) : null;
}
@Override
diff --git a/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonFileSystem.java b/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonFileSystem.java
index 3d88ead2d1..d6119ea9b8 100644
--- a/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonFileSystem.java
+++ b/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonFileSystem.java
@@ -30,10 +30,8 @@ import ghidra.util.task.TaskMonitor;
/**
* TODO: Provide class-level documentation that describes what this file system does.
*/
-@FileSystemInfo(
- type = "fstypegoeshere", // ([a-z0-9]+ only)
- description = "File system description goes here",
- factory = SkeletonFileSystem.MyFileSystemFactory.class)
+@FileSystemInfo(type = "fstypegoeshere", // ([a-z0-9]+ only)
+ description = "File system description goes here", factory = SkeletonFileSystem.MyFileSystemFactory.class)
public class SkeletonFileSystem implements GFileSystem {
private final FSRLRoot fsFSRL;
@@ -130,7 +128,7 @@ public class SkeletonFileSystem implements GFileSystem {
}
@Override
- public String getInfo(GFile file, TaskMonitor monitor) throws IOException {
+ public String getInfo(GFile file, TaskMonitor monitor) {
MyMetadata metadata = fsih.getMetadata(file);
return (metadata == null) ? null : FSUtilities.infoMapToString(getInfoMap(metadata));
}