Java Exceptions Catalog - Part 4: Security, Database & Naming
Comprehensive guide to database errors (java.sql), security and cryptography exceptions (java.security & javax.crypto), and JNDI directory service faults (javax.naming).
1. Relational Database Exceptions (java.sql Package)
java.sql.SQLException
Root exception providing information on database access errors, connection issues, or SQL query failures.
getErrorCode() and SQL state codes via getSQLState() for driver-specific diagnosis.java.sql.SQLIntegrityConstraintViolationException
An SQL command violates a database constraint (e.g., duplicate primary key, unique index violation, or foreign key mismatch).
java.sql.SQLTimeoutException
The query execution time exceeded the specified timeout limit set on a Statement or PreparedStatement.
java.sql.SQLSyntaxErrorException
The SQL string sent to the database engine contains invalid syntax or unknown table/column identifiers.
java.sql.BatchUpdateException
An error occurred during a batch update operation (retrievable update counts via getUpdateCounts()).
java.sql.SQLDataException
Data evaluation error during SQL execution (e.g., numeric value out of range or string truncation on insert).
java.sql.SQLFeatureNotSupportedException
The underlying JDBC driver or database engine does not support a specific requested feature.
java.sql.SQLNonTransientConnectionException
A persistent connection failure occurred (e.g., invalid connection credentials or closed socket) that will not succeed upon retry without fixing the root cause.
java.sql.SQLTransientException
A temporary database operation failure (e.g., deadlock or transaction rollback) that may succeed if retried.
2. Security & Cryptography (java.security & javax.crypto Packages)
java.security.NoSuchAlgorithmException
A requested cryptographic algorithm (e.g., `AES`, `SHA-256`, `RSA`) is not available in the current environment or security provider.
java.security.InvalidKeyException
Invalid key specified during initialization (e.g., wrong key size, uninitialized key, or key type mismatch for algorithm).
javax.crypto.BadPaddingException
Decryption padding check failed. Commonly indicates an incorrect secret key was used for decryption or ciphertext was corrupted.
javax.crypto.IllegalBlockSizeException
The length of data provided to a block cipher does not match the cipher's block size requirement.
javax.crypto.NoSuchPaddingException
A requested cipher padding mechanism is not supported in the execution environment.
java.security.KeyStoreException
Generic exception covering underlying failures while manipulating a Java `KeyStore` instance.
java.security.UnrecoverableKeyException
A key cannot be recovered from a KeyStore, usually due to an incorrect key password.
java.security.SignatureException
Failures encountered during cryptographic digital signature generation or verification operations.
java.security.cert.CertificateException
Base class for errors during parsing, validation, or verification of X.509 security certificates.
java.security.InvalidAlgorithmParameterException
Invalid or inappropriate initialization parameters (e.g., invalid Initialization Vector size) passed to a cipher.
3. Directory & Naming Services (javax.naming Package)
javax.naming.NamingException
Base exception class for errors thrown by JNDI context lookups and LDAP directory operations.
javax.naming.NameNotFoundException
Indicates that the specified binding or JNDI name cannot be found in the directory context.
javax.naming.AuthenticationException
Thrown when credential authentication fails while opening a directory service context (e.g., LDAP connection).
javax.naming.CommunicationException
Unable to communicate with the directory server or remote JNDI provider.
javax.naming.ServiceUnavailableException
The target naming or directory service provider is unreachable or temporarily unavailable.
javax.naming.InvalidNameException
The specified name string violates the naming syntax of the directory service provider.
No comments:
Post a Comment