Search in sources :

Example 1 with AcsJObjectExplorerReportEx

use of alma.objexpErrType.wrappers.AcsJObjectExplorerReportEx in project ACS by ACS-Community.

the class BACIRemoteAccess method logACSException.

/**
	 * Logs ACSException.
	 * @param exceptionThrown
	 */
private void logACSException(Exception exceptionThrown) {
    /* all user exception is expected to be using ACS Error System */
    if (exceptionThrown instanceof DataException) {
        DataException de = (DataException) exceptionThrown;
        /*
			 * This is just to probe if we have an ACS Exception.
			 * All applications should deal with ACS Exception and we want 
			 * to issue a warning if this is not the case.
			 * In this case we get an exception and the trap will log the warning.
			 */
        if (de.get("errorTrace") != null) {
            AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(exceptionThrown);
            objexpEx.log(BACILogger.getLogger());
        } else {
            AcsJObjectExplorerReportEx notAnAcsEx = new AcsJObjectExplorerReportEx(exceptionThrown);
            notAnAcsEx.setContext("Logging a User Exception that is NOT an ACS Exception");
            notAnAcsEx.log(BACILogger.getLogger());
            notifier.reportDebug("BACIRemoteAccess::logACSExcpetion", "Failed to wrap user exception into native ACS Error System exception" + " for '" + de.id() + "'.");
        }
    } else /* End if org.omg.CORBA.UserException */
    if (exceptionThrown instanceof alma.acs.exceptions.AcsJException) {
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(exceptionThrown);
        objexpEx.log(BACILogger.getLogger());
    } else if (exceptionThrown instanceof org.omg.CORBA.SystemException) {
        org.omg.CORBA.SystemException corbaSys = (org.omg.CORBA.SystemException) exceptionThrown;
        AcsJCORBAProblemEx corbaProblemEx = new AcsJCORBAProblemEx(exceptionThrown);
        corbaProblemEx.setMinor(corbaSys.minor);
        corbaProblemEx.setCompletionStatus(corbaSys.completed.value());
        corbaProblemEx.setInfo(corbaSys.toString());
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(corbaProblemEx);
        objexpEx.log(BACILogger.getLogger());
    } else {
        AcsJUnexpectedExceptionEx unexpectedEx = new AcsJUnexpectedExceptionEx(exceptionThrown);
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(unexpectedEx);
        objexpEx.log(BACILogger.getLogger());
        notifier.reportDebug("BACIRemoteAccess::logACSException", "Received an unexpected exception: " + " '" + exceptionThrown.getClass().getName() + "'.");
    }
}
Also used : DataException(si.ijs.acs.objectexplorer.engine.DataException) AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) AcsJException(alma.acs.exceptions.AcsJException) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) AcsJObjectExplorerReportEx(alma.objexpErrType.wrappers.AcsJObjectExplorerReportEx)

Aggregations

AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)1 AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)1 AcsJException (alma.acs.exceptions.AcsJException)1 AcsJObjectExplorerReportEx (alma.objexpErrType.wrappers.AcsJObjectExplorerReportEx)1 DataException (si.ijs.acs.objectexplorer.engine.DataException)1