Skip to content

Package: NotConnectableException

NotConnectableException

nameinstructionbranchcomplexitylinemethod
NotConnectableException(OracleDatabaseManager, SQLException)
M: 0 C: 38
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%

Coverage

1: package de.fhdw.wtf.persistence.exception;
2:
3: import java.sql.SQLException;
4:
5: import de.fhdw.wtf.persistence.facade.OracleDatabaseManager;
6:
7: /**
8: * A class to represent Exceptions, which occur when the connection towards the database could not be established.
9: *
10: */
11: public class NotConnectableException extends PersistenceException {
12:         
13:         /**
14:          * a part of the message of the exception.
15:          */
16:         private static final String CONNECTION_FAILED_INFIX_PASSWORD = " password:";
17:         /**
18:          * a part of the message of the exception.
19:          */
20:         private static final String CONNECTION_FAILED_USERNAME = " username:";
21:         /**
22:          * a part of the message of the exception.
23:          */
24:         private static final String CONNECTION_FAILED_INFIX_PORT = " port:";
25:         /**
26:          * a part of the message of the exception.
27:          */
28:         private static final String CONNECTION_FAILED_INFIX_ORACLE_SID = " SID:";
29:         /**
30:          * a part of the message of the exception.
31:          */
32:         private static final String CONNECTION_FAILED_INFIX_SHEMA = " schema-name:";
33:         /**
34:          * a part of the message of the exception.
35:          */
36:         private static final String CONNECTION_FAILED_PREFIX_ORACLE =
37:                         "Could not connect to Oracle Database with the Parameters: hostname:";
38:         /**
39:          *
40:          */
41:         private static final long serialVersionUID = 1L;
42:         
43:         /**
44:          * Constructor for a NotConnectableException for Oracle Databases.
45:          *
46:          * @param db
47:          * Fehler der Datenbank.
48:          * @param nested
49:          * Verschachtelte SQLException.
50:          */
51:         public NotConnectableException(final OracleDatabaseManager db, final SQLException nested) {
52:                 super(CONNECTION_FAILED_PREFIX_ORACLE + db.getHostname() + CONNECTION_FAILED_INFIX_SHEMA + db.getSchemaName()
53:                                 + CONNECTION_FAILED_INFIX_ORACLE_SID + db.getOracleSID() + CONNECTION_FAILED_INFIX_PORT + db.getPort()
54:                                 + CONNECTION_FAILED_USERNAME + db.getUserName() + CONNECTION_FAILED_INFIX_PASSWORD
55:                                 + db.getUserPassword(), nested);
56:         }
57:         
58: }