Skip to content

Commit d5f439c

Browse files
authored
Merge pull request #52 from DevFactory/release/null-pointers-should-not-be-dereferenced-fix-1
Code quality fix - Null pointers should not be dereferenced.
2 parents 5dbb563 + cf3d0f0 commit d5f439c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

uri-translator/src/main/java/net/fortytwo/sesametools/URITranslator.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,25 @@ public static void doTranslation(Repository repository, final String inputUriPre
340340
// rollback the connection and then throw the resulting exception
341341
// TODO: Will this get called before the repositoryConnection.close() in the finally
342342
// block?
343-
repositoryConnection.rollback();
343+
if (repositoryConnection != null){
344+
repositoryConnection.rollback();
345+
}
344346
throw rex;
345347
} catch (MalformedQueryException mqe) {
346348
// rollback the connection and then throw the resulting exception
347349
// TODO: Will this get called before the repositoryConnection.close() in the finally
348350
// block?
349-
repositoryConnection.rollback();
351+
if (repositoryConnection != null){
352+
repositoryConnection.rollback();
353+
}
350354
throw mqe;
351355
} catch (UpdateExecutionException uee) {
352356
// rollback the connection and then throw the resulting exception
353357
// TODO: Will this get called before the repositoryConnection.close() in the finally
354358
// block?
355-
repositoryConnection.rollback();
359+
if (repositoryConnection != null){
360+
repositoryConnection.rollback();
361+
}
356362
throw uee;
357363
} finally {
358364
if (repositoryConnection != null) {

0 commit comments

Comments
 (0)