Package com.gurock.smartinspect
Class LoadConfigurationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.gurock.smartinspect.SmartInspectException
-
- com.gurock.smartinspect.LoadConfigurationException
-
- All Implemented Interfaces:
Serializable
public final class LoadConfigurationException extends SmartInspectException
Used to report errors concerning the SmartInspect.loadConfiguration method. This exception is used to report errors concerning the SmartInspect.loadConfiguration method. This method is able to load the SmartInspect properties from a file. Therefore, errors can occur when trying to load properties from an inexistent file or when the file can not be opened for reading, for example.If such an error occurs, an instance of this class will be passed to the Error event in the SmartInspect class. Please note, that, if a connections string can be read while loading the configuration file, but is found to be invalid then this exception type will not be used. In this case, the SmartInspect.loadConfiguration method will use the InvalidConnectionsException exception instead.
This class is not guaranteed to be threadsafe.
import com.gurock.smartinspect.*; class Listener extends SmartInspectAdapter { public void onError(ErrorEvent e) { System.out.println(e.getException()); if (e.getException() instanceof LoadConfigurationException) { LoadConfigurationException le = (LoadConfigurationException) e.getException(); System.out.println(le.getFileName()); } } } public class ErrorHandling { public static void main(String[] args) { // Register our event handler for the error event. SiAuto.si.addListener(new Listener()); // Force an error event by passing a name of file which does not exist to the loadConfiguration method. SiAuto.si.loadConfiguration("Inexistent.sic"); } }- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LoadConfigurationException(String fileName, String e)Creates and initializes a LoadConfigurationException instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetFileName()Returns the name of the file which caused this exception while trying to load the SmartInspect properties from it.voidsetFileName(String fileName)Sets the name of the file which caused this exception while trying to load the SmartInspect properties from it.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
getFileName
public String getFileName()
Returns the name of the file which caused this exception while trying to load the SmartInspect properties from it.- Returns:
- The name of the file which caused the exception.
-
setFileName
public void setFileName(String fileName)
Sets the name of the file which caused this exception while trying to load the SmartInspect properties from it.- Parameters:
fileName- The name of the file which caused this exception
-
-