Code in Jena 2.7.2

   @Override
    public Resource getPropertyResourceValue( Property p )
        {
        for (StmtIterator it = listProperties( p ); it.hasNext();)
            {
            RDFNode n = it.next().getObject();
            if (n.isResource()) return (Resource) n;
            }
        return null;
        }


Suggested code


   @Override
    public Resource getPropertyResourceValue( Property p )
     {
      StmtIterator it = listProperties( p );
        try {
            while (it.hasNext())
            {
                RDFNode n = it.next().getObject();
                if (n.isResource()) return (Resource) n;
            }
            return null;
        }
        finally {
            it.close();
        }
        }


Jeremy

Reply via email to