Martin W. created JENA-323:
------------------------------

             Summary: ModelCom: difference NullPointerExeption swallows the 
original cause
                 Key: JENA-323
                 URL: https://issues.apache.org/jira/browse/JENA-323
             Project: Apache Jena
          Issue Type: Bug
          Components: Jena
    Affects Versions: Jena 2.7.3
            Reporter: Martin W.
            Priority: Minor


I'm getting NullPointerException at 
com.hp.hpl.jena.rdf.model.impl.ModelCom.difference(ModelCom.java:1440)

Currently the source code reads as follows:

@Override
    public Model difference(Model model)  {
        Model resultModel = createWorkModel();
        StmtIterator iter = null;
        Statement stmt;
        try {
            iter = listStatements();
            while (iter.hasNext()) {
                stmt = iter.nextStatement();
                if (! model.contains(stmt)) {
                    resultModel.add(stmt);
                }
            }
            return resultModel;
        } finally {
            iter.close();
        }
    }


Probably, the finally section should be:

 } finally {
     if (iter != null) {
          iter.close();
     }
}




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to