Skip to content

Commit

Permalink
Get rid of potential NullPointerException when source attachment not …
Browse files Browse the repository at this point in the history
…found
  • Loading branch information
laurentpetit committed Oct 15, 2012
1 parent 176ae78 commit 399f158
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ccw.core/src/java/ccw/ClojureCore.java
Expand Up @@ -320,7 +320,11 @@ private static IEditorInput findEditorInputInSourceAttachment(
// Find outside workspace or in archive
final IPath sourceAbsolutePath = toOSAbsoluteIPath(sourceAttachmentPath);

if (sourceAbsolutePath.toFile().isDirectory()) {
final File sourceFile = sourceAbsolutePath.toFile();
if (!sourceFile.exists()) {
CCWPlugin.logWarning("sourceFile " + sourceFile + " does not exist form sourceAttachmentPath " + sourceAttachmentPath);
// Nothing can be done
} else if (sourceFile.isDirectory()) {
final File maybeSourceFile = sourceAbsolutePath.append(searchedPath + "/" + searchedFileName).toFile();
if (maybeSourceFile.exists()) {
return new LocalFileStorageEditorInput(
Expand All @@ -331,7 +335,7 @@ private static IEditorInput findEditorInputInSourceAttachment(
} else {
ZipFile zipFile;
try {
zipFile = new JarFile(sourceAbsolutePath.toFile(), true, JarFile.OPEN_READ);
zipFile = new JarFile(sourceFile, true, JarFile.OPEN_READ);
ZipEntry zipEntry = zipFile.getEntry(searchedPath + "/" + searchedFileName);
if (zipEntry != null) {
return new ZipEntryStorageEditorInput(
Expand Down

0 comments on commit 399f158

Please sign in to comment.