[ 
https://issues.apache.org/jira/browse/JDO-776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762045#comment-16762045
 ] 

Craig L Russell commented on JDO-776:
-------------------------------------

The close() method on Query was added specifically in JDO 3.2 to be useful with 
try-with-resources with no catch clause. Semantically it is identical to 
closeAll(). JDO 3.1 does not include the close() method, to avoid confusion. 
The close(queryResult) method does not close the Query but closes a single 
result. The closeAll() method closes all results and then the Query object 
itself.

Can you provide a simple test case that shows the error you are seeing? 

> Exception on Query.close()
> --------------------------
>
>                 Key: JDO-776
>                 URL: https://issues.apache.org/jira/browse/JDO-776
>             Project: JDO
>          Issue Type: Improvement
>          Components: api
>    Affects Versions: JDO 3.2
>            Reporter: Steve Springett
>            Priority: Minor
>
> The Query interface has an exception thrown on the close() method. This 
> prevents elegant use of try-with-resource and requires more complex cases 
> instead, such as try within try, or try-with-resource with catch. In both 
> cases, the code gets rather ugly when using try-with-resource.
>  
> The closeAll() method however, does not throw an exception which allows for 
> simpler, more elegant code. Users should be encouraged to use modern language 
> constructs, but in the case of the Query interface, I prefer not to, and use 
> closeAll instead.
>  
> Propose: Remove the Exception from Query.close(). If an exception is thrown 
> while closing it, ignore it.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to