Example usage for org.apache.commons.logging Log error

List of usage examples for org.apache.commons.logging Log error

Introduction

In this page you can find the example usage for org.apache.commons.logging Log error.

Prototype

void error(Object message, Throwable t);

Source Link

Document

Logs an error with error log level.

Usage

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataLoggingHandler.java

/**
 * Handles given information.//from   w w  w . jav a  2 s  .com
 * @param metaData the database metadata.
 * @return <code>true</code> if the chain should be stopped.
 * @throws QueryJBuildException if the metadata cannot be logged.
 */
protected boolean handle(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException {
    final boolean result = false;

    @Nullable
    Log t_Log = null;

    try {
        t_Log = UniqueLogFactory.getLog(DatabaseMetaDataLoggingHandler.class);

        if (t_Log != null) {
            t_Log.debug("Numeric functions:" + metaData.getNumericFunctions());

            t_Log.debug("String functions:" + metaData.getStringFunctions());

            t_Log.debug("System functions:" + metaData.getSystemFunctions());

            t_Log.debug("Time functions:" + metaData.getTimeDateFunctions());

            t_Log.debug("insertsAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("insertsAreDetected(TYPE_SCROLL_SENS):"
                    + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("isCatalogAtStart():" + metaData.isCatalogAtStart());

            t_Log.debug("isReadOnly():" + metaData.isReadOnly());

            /*
             * Fails for MySQL with a java.lang.AbstractMethodError 
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.locatorsUpdateCopy()
             t_Log.debug(
               "locatorsUpdateCopy():"
             + metaData.locatorsUpdateCopy());
             */

            t_Log.debug("nullPlusNonNullIsNull():" + metaData.nullPlusNonNullIsNull());

            t_Log.debug("nullsAreSortedAtEnd():" + metaData.nullsAreSortedAtEnd());

            t_Log.debug("nullsAreSortedAtStart():" + metaData.nullsAreSortedAtStart());

            t_Log.debug("nullsAreSortedHigh():" + metaData.nullsAreSortedHigh());

            t_Log.debug("nullsAreSortedLow():" + metaData.nullsAreSortedLow());

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):"
                    + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("storesLowerCaseIdentifiers():" + metaData.storesLowerCaseIdentifiers());

            t_Log.debug("storesLowerCaseQuotedIdentifiers():" + metaData.storesLowerCaseQuotedIdentifiers());

            t_Log.debug("storesMixedCaseIdentifiers():" + metaData.storesMixedCaseIdentifiers());

            t_Log.debug("storesMixedCaseQuotedIdentifiers():" + metaData.storesMixedCaseQuotedIdentifiers());

            t_Log.debug("storesUpperCaseIdentifiers():" + metaData.storesUpperCaseIdentifiers());

            t_Log.debug("storesUpperCaseQuotedIdentifiers():" + metaData.storesUpperCaseQuotedIdentifiers());

            t_Log.debug("supportsAlterTableWithAddColumn():" + metaData.supportsAlterTableWithAddColumn());

            t_Log.debug("supportsAlterTableWithDropColumn():" + metaData.supportsAlterTableWithDropColumn());

            t_Log.debug("supportsANSI92EntryLevelSQL():" + metaData.supportsANSI92EntryLevelSQL());

            t_Log.debug("supportsANSI92FullSQL():" + metaData.supportsANSI92FullSQL());

            t_Log.debug("supportsANSI92IntermediateSQL():" + metaData.supportsANSI92IntermediateSQL());

            t_Log.debug("supportsBatchUpdates():" + metaData.supportsBatchUpdates());

            t_Log.debug(
                    "supportsCatalogsInDataManipulation():" + metaData.supportsCatalogsInDataManipulation());

            t_Log.debug(
                    "supportsCatalogsInIndexDefinitions():" + metaData.supportsCatalogsInIndexDefinitions());

            t_Log.debug("supportsCatalogsInPrivilegeDefinitions():"
                    + metaData.supportsCatalogsInPrivilegeDefinitions());

            t_Log.debug("supportsCatalogsInProcedureCalls():" + metaData.supportsCatalogsInProcedureCalls());

            t_Log.debug(
                    "supportsCatalogsInTableDefinitions():" + metaData.supportsCatalogsInTableDefinitions());

            t_Log.debug("supportsColumnAliasing():" + metaData.supportsColumnAliasing());

            t_Log.debug("supportsConvert():" + metaData.supportsConvert());

            t_Log.debug("supportsCoreSQLGrammar():" + metaData.supportsCoreSQLGrammar());

            t_Log.debug("supportsCorrelatedSubqueries():" + metaData.supportsCorrelatedSubqueries());

            t_Log.debug("supportsDataDefinitionAndDataManipulationTransactions():"
                    + metaData.supportsDataDefinitionAndDataManipulationTransactions());

            t_Log.debug("supportsDataManipulationTransactionsOnly():"
                    + metaData.supportsDataManipulationTransactionsOnly());

            t_Log.debug("supportsDifferentTableCorrelationNames():"
                    + metaData.supportsDifferentTableCorrelationNames());

            t_Log.debug("supportsExpressionsInOrderBy():" + metaData.supportsExpressionsInOrderBy());

            t_Log.debug("supportsExtendedSQLGrammar():" + metaData.supportsExtendedSQLGrammar());

            t_Log.debug("supportsFullOuterJoins():" + metaData.supportsFullOuterJoins());

            String t_strSupportsGetGeneratedKeys = Boolean.FALSE.toString();

            try {
                t_strSupportsGetGeneratedKeys = "" + metaData.supportsGetGeneratedKeys();
            } catch (@NotNull final SQLException sqlException) {
                t_strSupportsGetGeneratedKeys += sqlException.getMessage();
            }

            t_Log.debug("supportsGetGeneratedKeys():" + t_strSupportsGetGeneratedKeys);

            t_Log.debug("supportsGroupBy():" + metaData.supportsGroupBy());

            t_Log.debug("supportsGroupByBeyondSelect():" + metaData.supportsGroupByBeyondSelect());

            t_Log.debug("supportsGroupByUnrelated():" + metaData.supportsGroupByUnrelated());

            t_Log.debug("supportsIntegrityEnhancementFacility():"
                    + metaData.supportsIntegrityEnhancementFacility());

            t_Log.debug("supportsLikeEscapeClause():" + metaData.supportsLikeEscapeClause());

            t_Log.debug("supportsLimitedOuterJoins():" + metaData.supportsLimitedOuterJoins());

            t_Log.debug("supportsMinimumSQLGrammar():" + metaData.supportsMinimumSQLGrammar());

            t_Log.debug("supportsMixedCaseIdentifiers():" + metaData.supportsMixedCaseIdentifiers());

            t_Log.debug(
                    "supportsMixedCaseQuotedIdentifiers():" + metaData.supportsMixedCaseQuotedIdentifiers());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsMultipleOpenResults()
             t_Log.debug(
               "supportsMultipleOpenResults():"
             + metaData.supportsMultipleOpenResults());
             */

            t_Log.debug("supportsMultipleResultSets():" + metaData.supportsMultipleResultSets());

            t_Log.debug("supportsMultipleTransactions():" + metaData.supportsMultipleTransactions());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsNamedParameters()
             t_Log.debug(
               "supportsNamedParameters():"
             + metaData.supportsNamedParameters());
             */

            t_Log.debug("supportsNonNullableColumns():" + metaData.supportsNonNullableColumns());

            t_Log.debug("supportsOpenCursorsAcrossCommit():" + metaData.supportsOpenCursorsAcrossCommit());

            t_Log.debug("supportsOpenCursorsAcrossRollback():" + metaData.supportsOpenCursorsAcrossRollback());

            t_Log.debug(
                    "supportsOpenStatementsAcrossCommit():" + metaData.supportsOpenStatementsAcrossCommit());

            t_Log.debug("supportsOpenStatementsAcrossRollback():"
                    + metaData.supportsOpenStatementsAcrossRollback());

            t_Log.debug("supportsOrderByUnrelated():" + metaData.supportsOrderByUnrelated());

            t_Log.debug("supportsOuterJoins():" + metaData.supportsOuterJoins());

            t_Log.debug("supportsPositionedDelete():" + metaData.supportsPositionedDelete());

            t_Log.debug("supportsPositionedUpdate():" + metaData.supportsPositionedUpdate());

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE):"
                    + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_UPDATABLE));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY));

            t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE):" + metaData
                    .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsResultSetHoldability()
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "HOLD_CURSORS_OVER_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.HOLD_CURSORS_OVER_COMMIT));
                    
             t_Log.debug(
               "supportsResultSetHoldability("
             +     "CLOSE_CURSORS_AT_COMMIT):"
             + metaData.supportsResultSetHoldability(
             ResultSet.CLOSE_CURSORS_AT_COMMIT));
             */

            t_Log.debug("supportsResultSetType(TYPE_FORWARD_ONLY):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("supportsResultSetType(TYPE_SCROLL_SENSITIVE):"
                    + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE));

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsSavePoints()
             t_Log.debug(
               "supportsSavepoints():"
             + metaData.supportsSavepoints());
             */

            t_Log.debug("supportsSchemasInDataManipulation():" + metaData.supportsSchemasInDataManipulation());

            t_Log.debug("supportsSchemasInIndexDefinitions():" + metaData.supportsSchemasInIndexDefinitions());

            t_Log.debug("supportsSchemasInPrivilegeDefinitions():"
                    + metaData.supportsSchemasInPrivilegeDefinitions());

            t_Log.debug("supportsSchemasInProcedureCalls():" + metaData.supportsSchemasInProcedureCalls());

            t_Log.debug("supportsSchemasInTableDefinitions():" + metaData.supportsSchemasInTableDefinitions());

            t_Log.debug("supportsSelectForUpdate():" + metaData.supportsSelectForUpdate());

            /*
             * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError
             * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsStatementPooling()
             t_Log.debug(
               "supportsStatementPooling():"
             + metaData.supportsStatementPooling());
            */

            t_Log.debug("supportsStoredProcedures():" + metaData.supportsStoredProcedures());

            t_Log.debug("supportsSubqueriesInComparisons():" + metaData.supportsSubqueriesInComparisons());

            t_Log.debug("supportsSubqueriesInExists():" + metaData.supportsSubqueriesInExists());

            t_Log.debug("supportsSubqueriesInIns():" + metaData.supportsSubqueriesInIns());

            t_Log.debug("supportsSubqueriesInQuantifieds():" + metaData.supportsSubqueriesInQuantifieds());

            t_Log.debug("supportsTableCorrelationNames():" + metaData.supportsTableCorrelationNames());

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_NONE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_COMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_UNCOMMITTED):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_REPEATABLE_READ):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ));

            t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_SERIALIZABLE):"
                    + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE));

            t_Log.debug("supportsTransactions():" + metaData.supportsTransactions());

            t_Log.debug("supportsUnion():" + metaData.supportsUnion());

            t_Log.debug("supportsUnionAll():" + metaData.supportsUnionAll());

            t_Log.debug("updatesAreDetected(TYPE_FORWARD_ONLY):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));

            t_Log.debug("updatesAreDetected(TYPE_SCROLL_INSENSITIVE):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));

            t_Log.debug("updatesAreDetected(" + "TYPE_SCROLL_SENS):"
                    + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));

            t_Log.debug("usesLocalFilePerTable():" + metaData.usesLocalFilePerTable());

            t_Log.debug("usesLocalFiles():" + metaData.usesLocalFiles());
        }
    } catch (@NotNull final SQLException sqlException) {
        t_Log.error("Database metadata request failed.", sqlException);
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java

/**
 * Analyzes the database metadata./*from  w w  w. j a v a 2 s  .  c o  m*/
 * @param metaData such metadata.
 * @param parameters the command.
 */
protected void analyzeMetaData(@NotNull final DatabaseMetaData metaData,
        @NotNull final QueryJCommand parameters) {
    boolean t_bCaseSensitive = false;

    try {
        t_bCaseSensitive = metaData.storesLowerCaseIdentifiers() || metaData.storesLowerCaseQuotedIdentifiers()
                || metaData.storesMixedCaseIdentifiers() || metaData.storesMixedCaseQuotedIdentifiers()
                || metaData.storesUpperCaseIdentifiers() || metaData.storesUpperCaseQuotedIdentifiers();
    } catch (@NotNull final SQLException cannotCheckCaseSensitivity) {
        @Nullable
        final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class);

        if (t_Log != null) {
            t_Log.error("Cannot check whether the database engine is case sensitive or not.",
                    cannotCheckCaseSensitivity);
        }
    }

    storeCaseSensitive(t_bCaseSensitive, parameters);
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java

/**
 * Builds a database metadata manager.//  ww w  . ja  v a  2 s. c  o  m
 * @param parameters the parameters.
 * @param tables the tables.
 * @param metaData the database metadata.
 * @param catalog the database catalog.
 * @param schema the database schema.
 * @param caseSensitive whether the engine is case sensitive or not.
 * @param engine the engine.
 * @return the metadata manager instance.
 * @throws QueryJBuildException if the metadata manager cannot be built.
 */
@NotNull
protected MetadataManager buildMetadataManager(
        @SuppressWarnings("unused") @NotNull final QueryJCommand parameters,
        @NotNull final List<Table<String, Attribute<String>, List<Attribute<String>>>> tables,
        @NotNull final DatabaseMetaData metaData, @Nullable final String catalog, @Nullable final String schema,
        final boolean caseSensitive, @NotNull final Engine<String> engine) throws QueryJBuildException {
    @NotNull
    final MetadataManager result;

    try {
        result = new JdbcMetadataManager("jdbc", metaData, new MetadataExtractionLogger(), catalog, schema,
                new ArrayList<String>(0), tables, false, false, caseSensitive, engine);
    } catch (@NotNull final RuntimeException exception) {
        throw exception;
    } catch (@NotNull final Exception exception) {
        @Nullable
        final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class);

        if (t_Log != null) {
            t_Log.error("Cannot build a database metadata manager.", exception);
        }

        throw new CannotRetrieveDatabaseMetadataException(exception);
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java

/**
 * Retrieves the product name.// w ww  .  ja  v a  2 s  .co  m
 * @param metaData the database metadata.
 * @return the product name.
 * @throws QueryJBuildException if the product name information is not available.
 */
@NotNull
protected String retrieveProductName(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException {
    @NotNull
    String result = "";

    @Nullable
    QueryJBuildException t_ExceptionToThrow = null;

    try {
        result = metaData.getDatabaseProductName();
    } catch (@NotNull final SQLException sqlException) {
        @Nullable
        final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class);

        if (t_Log != null) {
            t_Log.error("Cannot retrieve database vendor's product name.", sqlException);
        }

        t_ExceptionToThrow = new CannotRetrieveDatabaseInformationException(sqlException);
    }

    if (t_ExceptionToThrow != null) {
        throw t_ExceptionToThrow;
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java

/**
 * Retrieves the product version./*w  w  w  .j av a2 s .  com*/
 * @param metaData the database metadata.
 * @return the product version.
 */
@NotNull
protected String retrieveProductVersion(@NotNull final DatabaseMetaData metaData) {
    @NotNull
    String result = "";

    try {
        result = metaData.getDatabaseProductVersion();
    } catch (@NotNull final SQLException sqlException) {
        @Nullable
        final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class);

        if (t_Log != null) {
            t_Log.error("Cannot retrieve database vendor's product version.", sqlException);
        }
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java

/**
 * Retrieves the product's identifier quote string.
 * @param metaData the database metadata.
 * @return the quote string./*from  ww  w . j  a v  a  2s . c  om*/
 * @throws QueryJBuildException if the product quote information is not available.
 */
@SuppressWarnings("unused")
protected String retrieveProductQuote(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException {
    @NotNull
    String result = "";

    @Nullable
    QueryJBuildException t_ExceptionToThrow = null;

    try {
        result = metaData.getIdentifierQuoteString();
    } catch (@NotNull final SQLException sqlException) {
        @Nullable
        final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class);

        if (t_Log != null) {
            t_Log.error("Cannot retrieve database vendor's quote string.", sqlException);
        }

        t_ExceptionToThrow = new CannotRetrieveDatabaseInformationException(sqlException);
    }

    if (t_ExceptionToThrow != null) {
        throw t_ExceptionToThrow;
    }

    return result;
}

From source file:org.acmsl.queryj.tools.handlers.JdbcConnectionClosingHandler.java

/**
 * Waits until all generation threads have finish.
 * @param tasks the tasks./*from w w w  .  j ava2s.  c o m*/
 * @param log the {@link Log} instance.
 */
protected void waitUntilGenerationThreadsFinish(
        @NotNull final List<Future<? extends QueryJTemplate<QueryJTemplateContext>>> tasks,
        @Nullable final Log log) {
    for (@Nullable
    final Future<? extends QueryJTemplate<QueryJTemplateContext>> t_Task : tasks) {
        if (t_Task != null) {
            while (!t_Task.isDone()) {
                try {
                    if (log != null) {
                        log.debug("Waiting for " + t_Task.get().getTemplateContext().getTemplateName()
                                + " to finish");
                    }
                } catch (@NotNull final InterruptedException interrupted) {
                    log.info(INTERRUPTED_WHILE_WAITING_FOR_THE_THREADS_TO_FINISH, interrupted);
                } catch (@NotNull final ExecutionException interrupted) {
                    log.info(interrupted.getMessage());

                    Throwable cause = interrupted.getCause();

                    while (cause != null) {
                        log.error(cause.getMessage(), cause);
                        cause = cause.getCause();
                    }
                }

                synchronized (LOCK) {
                    try {
                        LOCK.wait(1000);
                    } catch (@NotNull final InterruptedException interrupted) {
                        if (log != null) {
                            log.info(INTERRUPTED_WHILE_WAITING_FOR_THE_THREADS_TO_FINISH, interrupted);
                        }
                    }
                }
            }
        }
    }
}

From source file:org.acmsl.queryj.tools.QueryJChain.java

/**
 * Performs any clean up whenever an error occurs.
 * @param buildException the error that triggers this clean-up.
 * @param command the command./* ww  w . ja  va 2s  .c  om*/
 */
@Override
protected void cleanUpOnError(@NotNull final QueryJBuildException buildException,
        @NotNull final QueryJCommand command) {
    @Nullable
    final Log t_Log = UniqueLogFactory.getLog(QueryJChain.class);

    if (t_Log != null) {
        t_Log.info("Performing clean up");
    }

    try {
        new JdbcConnectionClosingHandler().handle(command);
    } catch (@NotNull final QueryJBuildException closingException) {
        if (t_Log != null) {
            t_Log.error("Error closing the connection", closingException);
        }
    }
}

From source file:org.alfresco.extension.bulkimport.util.LogUtils.java

public final static void error(final Log log, final String message, final Throwable cause) {
    log.error(PREFIX + message, cause);
}

From source file:org.alfresco.extension.bulkimport.util.LogUtils.java

public final static void error(final Log log, final Throwable cause) {
    log.error(RAW_EXCEPTION, cause);
}