[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[imp-commit] r22866 - trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor

Author: rfuhrer
Date: 2011-02-18 18:18:07 -0500 (Fri, 18 Feb 2011)
New Revision: 22866

Modified:
   trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/ZipDocumentProvider.java
Log:
getZipEntryContents() now catches IOExceptions and rethrows them as CoreExceptions, for higher levels to handle.

Modified: trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/ZipDocumentProvider.java
===================================================================
--- trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/ZipDocumentProvider.java	2011-02-18 23:16:46 UTC (rev 22865)
+++ trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/ZipDocumentProvider.java	2011-02-18 23:18:07 UTC (rev 22866)
@@ -12,12 +12,15 @@
 package org.eclipse.imp.editor;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.imp.runtime.RuntimePlugin;
 import org.eclipse.imp.utils.StreamUtils;
 import org.eclipse.jface.text.Document;
@@ -70,7 +73,7 @@
         return true;
     }
 
-    private String getZipEntryContents(IURIEditorInput uriEditorInput) {
+    private String getZipEntryContents(IURIEditorInput uriEditorInput) throws CoreException {
         String contents= "";
         try {
             URI uri= uriEditorInput.getURI();
@@ -82,7 +85,10 @@
             ZipFile zipFile= new ZipFile(new File(jarPath));
             ZipEntry entry= zipFile.getEntry(entryPath);
             InputStream is= zipFile.getInputStream(entry);
+
             contents= StreamUtils.readStreamContents(is);
+        } catch (IOException e) {
+            throw new CoreException(new Status(IStatus.ERROR, RuntimePlugin.IMP_RUNTIME, 0, "Error encountered while obtaining zip file contents", e));
         } catch (Exception e) {
             RuntimePlugin.getInstance().logException("Exception caught while obtaining contents of zip file entry", e);
         }