Skip to content

Commit 18d3750

Browse files
committed
fixed NullPointer bug (check for != null was missing) [fixes #117]
1 parent 8639c5b commit 18d3750

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/de/unirostock/sems/cbarchive/web/rest/ShareApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public Response downloadRemoteArchive(@CookieParam(Fields.COOKIE_PATH) String us
202202
LOGGER.error(e, "Cannot read downloaded archive");
203203
return buildTextErrorResponse(400, user, "Cannot read/parse downloaded archive", e.getMessage(), "URL: " + remoteUrl);
204204
} finally {
205-
if( importer != null && importer.getTempFile().exists() )
205+
if( importer != null && importer.getTempFile() != null && importer.getTempFile().exists() )
206206
importer.getTempFile().delete();
207207

208208
importer.close();
@@ -604,7 +604,7 @@ else if( protocol.equals("post") && uploadedFiles != null && uploadedFiles.size(
604604
LOGGER.error(e, "Cannot download an additional file. ", addFile.getRemoteUrl());
605605
throw new ImporterException("Cannot download and add an additional file: " + addFile.getRemoteUrl(), e);
606606
} finally {
607-
if( temp != null )
607+
if( temp != null && temp.toFile().exists() )
608608
temp.toFile().delete();
609609
}
610610
}

0 commit comments

Comments
 (0)