[196020] IllegalArgumentException rebuilding project
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 59148ab..e6243ad 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 @@ } 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 @@ 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 @@ 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 @@ 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();