Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornitind2007-09-03 07:52:46 +0000
committernitind2007-09-03 07:52:46 +0000
commitb7460e3db0d58906aac0edec6f1abc97ce227a29 (patch)
tree2d24912137148e6894da5b6f2b734c5a1f0465cb
parent04a604db3190bc832c99e20b68b8eb06cd6f145d (diff)
downloadwebtools.sourceediting-b7460e3db0d58906aac0edec6f1abc97ce227a29.tar.gz
webtools.sourceediting-b7460e3db0d58906aac0edec6f1abc97ce227a29.tar.xz
webtools.sourceediting-b7460e3db0d58906aac0edec6f1abc97ce227a29.zip
[196020] IllegalArgumentException rebuilding project
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/util/FileContentCache.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/util/FileContentCache.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/util/FileContentCache.java
index 59148aba4f..e6243ad509 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/util/FileContentCache.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/util/FileContentCache.java
@@ -50,7 +50,10 @@ public class FileContentCache {
}
private IFile getFile(IPath path) {
- return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (path.segmentCount() > 1) {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+ return null;
}
boolean isStale() {
@@ -105,7 +108,7 @@ public class FileContentCache {
private long getModificationStamp(IPath filePath) {
IFile f = getFile(filePath);
- if (f.isAccessible()) {
+ if (f != null && f.isAccessible()) {
return f.getModificationStamp();
}
File file = filePath.toFile();
@@ -121,7 +124,7 @@ public class FileContentCache {
InputStream is = null;
try {
IFile f = getFile(filePath);
- if (f.isAccessible()) {
+ if (f != null && f.isAccessible()) {
String charset = detectCharset(f);
is = f.getContents();
Reader reader = new InputStreamReader(is, charset);
@@ -155,12 +158,19 @@ public class FileContentCache {
ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(filePath, LocationKind.LOCATION);
if (buffer != null) {
s.append(buffer.getDocument().get());
- FileBuffers.getTextFileBufferManager().disconnect(filePath, LocationKind.LOCATION, new NullProgressMonitor());
}
}
catch (CoreException e) {
// nothing to do
- e.printStackTrace();
+ Logger.logException(e);
+ }
+ finally {
+ try {
+ FileBuffers.getTextFileBufferManager().disconnect(filePath, LocationKind.LOCATION, new NullProgressMonitor());
+ }
+ catch (CoreException e) {
+ Logger.logException(e);
+ }
}
}
return s.toString();

Back to the top