You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/10/21 16:57:02 UTC
svn commit: r1400663 -
/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java
Author: andy
Date: Sun Oct 21 14:57:01 2012
New Revision: 1400663
URL: http://svn.apache.org/viewvc?rev=1400663&view=rev
Log:
JENA-315 : Close iterators when throwables happen.
Modified:
jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java
Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java?rev=1400663&r1=1400662&r2=1400663&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/rdf/model/impl/ResourceImpl.java Sun Oct 21 14:57:01 2012
@@ -25,9 +25,6 @@ import com.hp.hpl.jena.enhanced.*;
import com.hp.hpl.jena.graph.*;
/** An implementation of Resource.
- *
- * @author bwm
- * @version Release='$Name: not supported by cvs2svn $' Revision='$Revision: 1.4 $' Date='$Date: 2010-01-19 10:06:17 $'
*/
public class ResourceImpl extends EnhNode implements Resource {
@@ -382,13 +379,16 @@ public class ResourceImpl extends EnhNod
{ return (ModelCom) getGraph(); }
@Override
- public Resource getPropertyResourceValue( Property p )
- {
- for (StmtIterator it = listProperties( p ); it.hasNext();)
+ public Resource getPropertyResourceValue(Property p)
+ {
+ StmtIterator it = listProperties(p) ;
+ try {
+ while (it.hasNext())
{
- RDFNode n = it.next().getObject();
- if (n.isResource()) return (Resource) n;
+ RDFNode n = it.next().getObject() ;
+ if (n.isResource()) return (Resource)n ;
}
- return null;
- }
+ return null ;
+ } finally { it.close() ; }
+ }
}