From dfcbd78a8a9ec23ee4d6f1f4284946f28ff1a8c4 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 27 Sep 2019 01:49:42 +0100 Subject: [PATCH] Remove object validate method. With agreement from @attrc and @imhlv2, I'm removing the useless validate method from the object. It defaulted to returning inaccurate information (validity undetermined, but validate returned True as if validation had happened) and is better handled by individual classes implementing is_valid (which seems the preferred nomenclature) and throwing exceptions if it's called on a class that doesn't have it. --- volatility/framework/exceptions.py | 9 --------- volatility/framework/interfaces/objects.py | 8 -------- 2 files changed, 17 deletions(-) diff --git a/volatility/framework/exceptions.py b/volatility/framework/exceptions.py index 8d11d19bd..1fa197601 100644 --- a/volatility/framework/exceptions.py +++ b/volatility/framework/exceptions.py @@ -67,15 +67,6 @@ class SwappedInvalidAddressException(PagedInvalidAddressException): self.swap_offset = swap_offset -class InvalidDataException(VolatilityException): - """Thrown when an object contains some data known to be invalid for that - structure.""" - - def __init__(self, invalid_object: object, *args) -> None: - super().__init__(invalid_object, *args) - self._invalid_object = invalid_object - - class SymbolSpaceError(VolatilityException): """Thrown when an error occurs dealing with Symbolspaces and SymbolTables.""" diff --git a/volatility/framework/interfaces/objects.py b/volatility/framework/interfaces/objects.py index 35a3a4f1a..194febde1 100644 --- a/volatility/framework/interfaces/objects.py +++ b/volatility/framework/interfaces/objects.py @@ -129,14 +129,6 @@ class ObjectInterface(metaclass = ABCMeta): """Writes the new value into the format at the offset the object currently resides at.""" - def validate(self) -> bool: - """A method that can be overridden to validate this object. It does - not return and its return value should not be used. - - Raises InvalidDataException on failure to validate the data - correctly. - """ - def get_symbol_table(self) -> 'interfaces.symbols.SymbolTableInterface': """Returns the symbol table for this particular object.