if (m_aExceptionCallbacks.isNotEmpty ()) m_aExceptionCallbacks.forEach (x -> x.onException (ex)); else
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param bIsInitialization * <code>true</code> if this happened during initialization of a new * file, <code>false</code> if it happened during regular reading. * @param aFile * The file that was read. May be <code>null</code> for in-memory DAOs. */ protected static void triggerExceptionHandlersRead (@Nonnull final Throwable t, final boolean bIsInitialization, @Nullable final File aFile) { // Custom exception handler for reading if (exceptionHandlersRead ().isNotEmpty ()) { final IReadableResource aRes = aFile == null ? null : new FileSystemResource (aFile); exceptionHandlersRead ().forEach (aCB -> aCB.onDAOReadException (t, bIsInitialization, aRes)); } }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param bIsInitialization * <code>true</code> if this happened during initialization of a new * file, <code>false</code> if it happened during regular reading. * @param aFile * The file that was read. May be <code>null</code> for in-memory DAOs. */ protected static void triggerExceptionHandlersRead (@Nonnull final Throwable t, final boolean bIsInitialization, @Nullable final File aFile) { // Custom exception handler for reading if (exceptionHandlersRead ().isNotEmpty ()) { final IReadableResource aRes = aFile == null ? null : new FileSystemResource (aFile); exceptionHandlersRead ().forEach (aCB -> aCB.onDAOReadException (t, bIsInitialization, aRes)); } }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param sErrorFilename * The filename tried to write to. Never <code>null</code>. * @param aDoc * The XML content that should be written. May be <code>null</code> if * the error occurred in XML creation. */ protected static void triggerExceptionHandlersWrite (@Nonnull final Throwable t, @Nonnull final String sErrorFilename, @Nullable final IMicroDocument aDoc) { // Check if a custom exception handler is present if (exceptionHandlersWrite ().isNotEmpty ()) { final IReadableResource aRes = new FileSystemResource (sErrorFilename); final String sXMLContent = aDoc == null ? "no XML document created" : MicroWriter.getNodeAsString (aDoc); exceptionHandlersWrite ().forEach (aCB -> aCB.onDAOWriteException (t, aRes, sXMLContent)); } }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param sErrorFilename * The filename tried to write to. Never <code>null</code>. * @param aDoc * The XML content that should be written. May be <code>null</code> if * the error occurred in XML creation. */ protected static void triggerExceptionHandlersWrite (@Nonnull final Throwable t, @Nonnull final String sErrorFilename, @Nullable final IMicroDocument aDoc) { // Check if a custom exception handler is present if (exceptionHandlersWrite ().isNotEmpty ()) { final IReadableResource aRes = new FileSystemResource (sErrorFilename); final String sXMLContent = aDoc == null ? "no XML document created" : MicroWriter.getNodeAsString (aDoc); exceptionHandlersWrite ().forEach (aCB -> aCB.onDAOWriteException (t, aRes, sXMLContent)); } }