Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java8
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java8
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java3
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java3
4 files changed, 20 insertions, 2 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
index d86cf604344..a47231d511d 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
@@ -14,6 +14,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.io.IOException;
+
import org.junit.After;
import org.junit.Test;
@@ -68,7 +70,11 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions
@Test
public void testBug118199_fixed() throws Exception {
- IFile file= getProject().getWorkspace().getRoot().getFileForLocation(getPath());
+ IPath location= getPath();
+ IFile file= getProject().getWorkspace().getRoot().getFileForLocation(location);
+ if (file == null) {
+ throw new IOException("File '" + location + "' can not be found."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
IPath path= file.getFullPath();
assertFalse(file.exists());
fManager.connect(path, LocationKind.IFILE, null);
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
index 235b8f55b5a..76efc9dbb13 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
@@ -12,6 +12,8 @@ package org.eclipse.core.filebuffers.tests;
import static org.junit.Assert.*;
+import java.io.IOException;
+
import org.junit.After;
import org.junit.Test;
@@ -66,7 +68,11 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF
@Test
public void testBug118199_fixed() throws Exception {
- IFile file= getProject().getWorkspace().getRoot().getFileForLocation(getPath());
+ IPath location= getPath();
+ IFile file= getProject().getWorkspace().getRoot().getFileForLocation(location);
+ if (file == null) {
+ throw new IOException("File '" + location + "' can not be found."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
IPath path= file.getFullPath();
assertFalse(file.exists());
fManager.connect(path, LocationKind.IFILE, null);
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
index 022c8c94de8..cf984534842 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
@@ -162,6 +162,9 @@ public class FileTool {
public static void copy(File src, File dst) throws IOException {
if(src.isDirectory()){
String[] srcChildren = src.list();
+ if (srcChildren == null) {
+ throw new IOException("Content from directory '" + src.getAbsolutePath() + "' can not be listed."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
for(int i = 0; i < srcChildren.length; ++i){
File srcChild= new File(src, srcChildren[i]);
File dstChild= new File(dst, srcChildren[i]);
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
index 26568301af5..7a7aa6868a4 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
@@ -141,6 +141,9 @@ public class FileTool {
public static void copy(File src, File dst) throws IOException {
if(src.isDirectory()){
String[] srcChildren = src.list();
+ if (srcChildren == null) {
+ throw new IOException("Content from directory '" + src.getAbsolutePath() + "' can not be listed."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
for(int i = 0; i < srcChildren.length; ++i){
File srcChild= new File(src, srcChildren[i]);
File dstChild= new File(dst, srcChildren[i]);

Back to the top