Add missing catch blocks. Add warning in getCustomListViewConfigFileName() if property can't be found.
This commit is contained in:
parent
f49460245b
commit
74c0edabda
3 changed files with 35 additions and 15 deletions
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -362,6 +363,12 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
Literal value = sol.getLiteral("value");
|
Literal value = sol.getLiteral("value");
|
||||||
values.add(value);
|
values.add(value);
|
||||||
}
|
}
|
||||||
|
return values;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error getting data property values for individual " + subjectUri + " and property " + propertyUri);
|
||||||
|
return Collections.emptyList();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
|
@ -369,6 +376,6 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
qexec.close();
|
qexec.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -913,10 +913,15 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
ResultSet results = qexec.execSelect();
|
ResultSet results = qexec.execSelect();
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution soln = results.next();
|
QuerySolution soln = results.next();
|
||||||
ObjectProperty prop = getObjectPropertyByURI(soln.getResource("property").getURI());
|
String propertyUri = soln.getResource("property").getURI();
|
||||||
|
ObjectProperty prop = getObjectPropertyByURI(propertyUri);
|
||||||
|
if (prop == null) {
|
||||||
|
log.warn("Can't find property for uri " + propertyUri);
|
||||||
|
} else {
|
||||||
String filename = soln.getLiteral("filename").getLexicalForm();
|
String filename = soln.getLiteral("filename").getLexicalForm();
|
||||||
customListViewConfigFileMap.put(prop, filename);
|
customListViewConfigFileMap.put(prop, filename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
qexec.close();
|
qexec.close();
|
||||||
}
|
}
|
||||||
return customListViewConfigFileMap.get(op);
|
return customListViewConfigFileMap.get(op);
|
||||||
|
|
|
@ -321,7 +321,11 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
list.add(QueryUtils.querySolutionToStringValueMap(soln));
|
list.add(QueryUtils.querySolutionToStringValueMap(soln));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error getting object property values for subject " + subjectUri + " and property " + propertyUri);
|
||||||
|
return Collections.emptyList();
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
|
@ -329,7 +333,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
qexec.close();
|
qexec.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model constructModelForSelectQueries(String subjectUri,
|
private Model constructModelForSelectQueries(String subjectUri,
|
||||||
|
@ -366,17 +370,17 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
DatasetWrapper w = dwf.getDatasetWrapper();
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
QueryExecution qe = null;
|
||||||
try {
|
try {
|
||||||
|
qe = QueryExecutionFactory.create(
|
||||||
QueryExecution qe = QueryExecutionFactory.create(
|
|
||||||
query, dataset, initialBindings);
|
query, dataset, initialBindings);
|
||||||
try {
|
|
||||||
qe.execConstruct(constructedModel);
|
qe.execConstruct(constructedModel);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error getting constructed model for subject " + subjectUri + " and property " + propertyUri);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (qe != null) {
|
||||||
qe.close();
|
qe.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
|
@ -444,6 +448,11 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
types.put(type, label);
|
types.put(type, label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return types;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error getting most specific types for subject " + subjectUri);
|
||||||
|
return Collections.emptyMap();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
|
@ -453,6 +462,5 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue