Skip to content

Feature ETP-1917: replace OBException with local DBSMException in DBSMOBUtil#12

Open
RomanMagnoli wants to merge 1 commit into
developfrom
feature/ETP-1917-Y26
Open

Feature ETP-1917: replace OBException with local DBSMException in DBSMOBUtil#12
RomanMagnoli wants to merge 1 commit into
developfrom
feature/ETP-1917-Y26

Conversation

@RomanMagnoli

Copy link
Copy Markdown
Contributor

This pull request introduces a new custom exception class, DBSMException, and updates the database utility code to use this exception instead of the more generic OBException when handling SSL certificate-related errors and connection failures. This change improves error specificity and clarity in the DDLUtils utility layer.

Exception handling improvements:

  • Added a new custom runtime exception class, DBSMException, in DBSMException.java to provide more specific error reporting for database schema management operations.
  • Updated the DBSMOBUtil class to throw DBSMException instead of OBException for SSL root certificate validation errors and unpooled connection failures, resulting in clearer and more consistent error handling in these scenarios. [1] [2]

Code cleanup:

  • Removed the unused import of OBException from DBSMOBUtil.java since it is no longer referenced in the file.

@RomanMagnoli
RomanMagnoli requested a review from Copilot April 8, 2026 18:57
@RomanMagnoli RomanMagnoli self-assigned this Apr 8, 2026
@RomanMagnoli RomanMagnoli added the enhancement New feature or request label Apr 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated DBSMException for database schema management utilities and switches DBSMOBUtil to throw it instead of the generic OBException for SSL/certificate validation and unpooled connection failures, improving error specificity within the DBSM/DDLUtils layer.

Changes:

  • Added org.openbravo.ddlutils.util.DBSMException (runtime exception) for DBSM-related failures.
  • Updated DBSMOBUtil#getUnpooledConnection() to throw DBSMException for SSL root certificate validation errors and SQL connection failures.
  • Removed the unused OBException import from DBSMOBUtil.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/org/openbravo/ddlutils/util/DBSMOBUtil.java Replaces OBException throws with DBSMException in SSL/connection error paths and removes the unused import.
src/org/openbravo/ddlutils/util/DBSMException.java Adds a local runtime exception type for DBSM utility-layer failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RomanMagnoli
RomanMagnoli force-pushed the feature/ETP-1917-Y26 branch from 2065ec9 to 7cb8348 Compare April 9, 2026 12:42
@sonarscanetendo

Copy link
Copy Markdown

* </p>
*/
public class DBSMException extends RuntimeException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Consider adding the default constructor and the constructor that accepts a Throwable cause.

public class DBSMException extends RuntimeException {

  public DBSMException() {
    super();
  }

  public DBSMException(Throwable cause) {
    super(cause);
  }

Rationale: Adding the default constructor and the constructor that accepts only a Throwable is a best practice for custom exceptions, allowing for greater flexibility when wrapping other exceptions without needing a custom message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants