public final class LoadConnectionsException 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 correctly, but is found to be invalid, then this exception type will not be used. In this case, the SmartInspect.loadConnections method will use the InvalidConnectionsException exception instead.
This class is not thread-safe.
Example:
import com.gurock.smartinspect.*;
class Listener extends SmartInspectAdapter {
public void onError(ErrorEvent e) {
System.out.println(e.getException());
if (e.getException() instanceof LoadConnectionsException) {
LoadConnectionsException le = (LoadConnectionsException) e.getException();
// A LoadConnectionsException provides additional information
// about the occurred error besides the normal exception
// message. It contains the name of the file which caused the
// exception while trying to read the connections string from
// it.
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 loadConnections method.
SiAuto.si.loadConnections("Inexistent.sic");
}
}
| Constructor and Description |
|---|
LoadConnectionsException(String fileName,
String e)
Creates and initializes a LoadConnectionsException instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFileName()
Returns the name of the file which caused this exception while
trying to load the connections string from it.
|
void |
setFileName(String fileName)
Sets the name of the file which caused this exception
while trying to load the connections string 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.