public final class LoadConfigurationException extends SmartInspectException
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");
}
}
| Constructor and Description |
|---|
LoadConfigurationException(String fileName,
String e)
Creates and initializes a LoadConfigurationException instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFileName()
Returns the name of the file which caused this exception while
trying to load the SmartInspect properties from it.
|
void |
setFileName(String fileName)
Sets the name of the file which caused this exception while
trying to load the SmartInspect properties from it.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic String getFileName()
public void setFileName(String fileName)
fileName - The name of the file which caused this exceptionCopyright © 2023. All rights reserved.