+1 -- Moving to Java 7 should include a comprehensive review of which classes 
should become closable to enable try-with-resources.

Ideally, the Jena code base should also use try-with-resources internally 
wherever that makes sense.

Note that in some cases extending AutoCloseable might be preferable.  
Closeable.close() may only throw IOException, whereas AutoCloseable.close() may 
throw Exception.


> On Jan 24, 2015, at 6:01 AM, Claude Warren <[email protected]> wrote:
> 
> Background:
> 
>   1. TDBGraph implements org.apache.jena.atlas.lib.Closable which defines
>   a close() method
>   2. Graph does not.
>   3. DatasetGraphMaker.close() calls close() on the defaultGraph.
> 
> 
> The security system creates dynamic proxies.
> When a TDBGraph is closed the method that is being attempted is
> Closable.close() not Graph.close() (probably has to do with the order they
> are defined in the TDBGraph class definition.
> 
> The security system sees that it is proxying a method with the same
> signature (name and args). but when it attempts to execute the
> Closable.close() method and fails since the proxy doesn't really proxy that
> method it proxies Graph.close().
> 
> I can fix this in the proxy code by calling the Graph.close() rather than
> the Closable.close() but I began to wonder if Graph (and other classes with
> close() methods) shouldn't extend Closable?
> 
> Thoughts?

Reply via email to