From d5375cc4792b6ba4752119f3664c0caa006ddf40 Mon Sep 17 00:00:00 2001 From: Roland Haeder <roland@mxchange.org> Date: Wed, 19 Aug 2015 14:43:12 +0200 Subject: [PATCH] =?utf8?q?Added=20debug=20message=20Signed-off-by:Roland?= =?utf8?q?=20H=C3=A4der=20<roland@mxchange.org>?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jcore/database/frontend/BaseDatabaseFrontend.java | 11 +++++++---- .../factory/database/backend/BackendFactory.java | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java b/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java index ca318f2..7de1749 100644 --- a/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java +++ b/src/org/mxchange/jcore/database/frontend/BaseDatabaseFrontend.java @@ -201,22 +201,25 @@ public abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implement protected void initBackend () throws UnsupportedDatabaseBackendException, SQLException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N - + // Try it try { // Try to get get instance from factory DatabaseBackend backend = BackendFactory.createInstance(this); - + + // Debug message + this.getLogger().debug(MessageFormat.format("backend={0}", backend)); + // Try to run a connect on it backend.connectToDatabase(); - + // All fine so far, then set it here this.setBackend(backend); } catch (final ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { // Continue to throw throw new UnsupportedDatabaseBackendException(ex); } - + // Trace message this.getLogger().trace("EXIT!"); //NOI18N } diff --git a/src/org/mxchange/jcore/factory/database/backend/BackendFactory.java b/src/org/mxchange/jcore/factory/database/backend/BackendFactory.java index 821779b..5e16166 100644 --- a/src/org/mxchange/jcore/factory/database/backend/BackendFactory.java +++ b/src/org/mxchange/jcore/factory/database/backend/BackendFactory.java @@ -48,6 +48,12 @@ public class BackendFactory extends BaseFrameworkSystem { // Trace message factory.getLogger().trace(MessageFormat.format("frontend={0} - CALLED!", frontend)); //NOI18N + // frontend must be set + if (frontend == null) { + // Is null + throw new NullPointerException("frontend is null"); + } + // Get property String className = factory.getProperty("database.backend.class"); //NOI18N -- 2.39.5