Hello. Le mar. 9 mai 2023 à 23:43, Gary D. Gregory <ggreg...@apache.org> a écrit : > > Hi All, > > The method > org.apache.commons.imaging.icc.IccProfileParser.getICCProfileInfo(ByteSource) > looks like: > > public IccProfileInfo getICCProfileInfo(final ByteSource byteSource) { > // TODO Throw instead of logging? > final IccProfileInfo result; > try (InputStream is = byteSource.getInputStream()) { > result = readICCProfileInfo(is); > } catch (final Exception e) { > LOGGER.log(Level.SEVERE, e.getMessage(), e); > return null; > } > // > try { > for (final IccTag tag : result.getTags()) { > final byte[] bytes = byteSource.getBlock(tag.offset, > tag.length); > // Debug.debug("bytes: " + bytes.length); > tag.setData(bytes); > // tag.dump("\t" + i + ": "); > } > // result.fillInTagData(byteSource); > return result; > } catch (final Exception e) { > // Debug.debug("Error: " + file.getAbsolutePath()); > LOGGER.log(Level.SEVERE, e.getMessage(), e); > } > return null; > } > > I find it odd and dubious that we would short-circuit the propagation of > exceptions
In principle, exception swallowing is not good. Perhaps in this case, the result is considered "optional" (?). [In which case, the API should be upgraded to use Perhaps the method should not be "public" (?). > with logging in such a low-level code. Unless someone can argue otherwise, I > would like to propagate the exceptions. Unchecked ones then, I suppose. Regards, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org