[
https://issues.apache.org/jira/browse/SLING-10581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konrad Windszus updated SLING-10581:
------------------------------------
Component/s: Extensions
> Sitemap.close() violates contract of Closeable.close()
> ------------------------------------------------------
>
> Key: SLING-10581
> URL: https://issues.apache.org/jira/browse/SLING-10581
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Affects Versions: Sitemap 1.0.2
> Reporter: Konrad Windszus
> Assignee: Dirk Rudolph
> Priority: Major
> Fix For: Sitemap 1.0.4
>
>
> According to the contract of {{Closable.close()}}
> bq. If the stream is already closed then invoking this method has no effect.
> (https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html#close--)
> But in
> https://github.com/apache/sling-org-apache-sling-sitemap/blob/e73387d510a1ac3ac762baa97338ab6c4e919bdc/src/main/java/org/apache/sling/sitemap/impl/builder/SitemapImpl.java#L79
> an ISE is thrown if it has been closed before.
> Either implement AutoCloseable
> (https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html)
> which states
> bq. Note that unlike the close method of Closeable, this close method is not
> required to be idempotent. In other words, calling this close method more
> than once may have some visible side effect, unlike Closeable.close which is
> required to have no effect if called more than once. However, implementers of
> this interface are strongly encouraged to make their close methods idempotent.
> or allow close() being called twice without an exception.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)