[ 
https://issues.apache.org/jira/browse/SLING-10581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dirk Rudolph resolved SLING-10581.
----------------------------------
    Resolution: Fixed

Thanks Konrad for reporting. Fixed with 
[7713444018106e96cc81f1454ffa6efb9680d397|https://github.com/apache/sling-org-apache-sling-sitemap/commit/7713444018106e96cc81f1454ffa6efb9680d397]

> 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
>              Labels: sitemaps
>             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)

Reply via email to