/** * Helper method to properly log any exceptions raised by Bio-Formats. * @param pixels passed to {@link BfPixelBuffer} * @param filePath Non-null. * @return the initialized {@link BfPyramidPixelBuffer} */ protected BfPyramidPixelBuffer createPyramidPixelBuffer(final Pixels pixels, final String filePath, boolean write) { try { if (write) { // #5159. Creating the path if we need to write. createSubpath(filePath); } return new BfPyramidPixelBuffer(pixels, filePath, write); } catch (Exception e) { if (e instanceof LockTimeout) { throw (LockTimeout) e; } String msg = "Error instantiating pixel buffer: " + filePath; log.error(msg, e); throw new ResourceError(msg); } }