diff options
author | Jeffrey Stedfast <jeff@xamarin.com> | 2011-09-27 20:20:49 +0400 |
---|---|---|
committer | Jeffrey Stedfast <jeff@xamarin.com> | 2011-09-27 20:20:49 +0400 |
commit | db303921325f58b5b80bbf7dca80b21583471705 (patch) | |
tree | 9c5f2d5a9d8914f723b8f779514dbfb2156deb98 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui | |
parent | 599c1f9520fb93c89fec284c76c4ac6d45b14351 (diff) |
[Ide] Catch InvalidEncodingException for newContent.Load as well. Fixes bug #784.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 0e564fbe21..00b156f14e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -1041,15 +1041,18 @@ namespace MonoDevelop.Ide.Gui Counters.OpenDocumentTimer.Trace ("Loading file"); IEncodedTextContent etc = newContent.GetContent<IEncodedTextContent> (); - if (fileInfo.Encoding != null && etc != null) { - try { + try { + if (fileInfo.Encoding != null && etc != null) etc.Load (fileName, fileInfo.Encoding); - } catch (InvalidEncodingException iex) { - fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. {1}", fileName, iex.Message), null); - return; - } - } else - newContent.Load (fileName); + else + newContent.Load (fileName); + } catch (InvalidEncodingException iex) { + fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. {1}", fileName, iex.Message), null); + return; + } catch (OverflowException oex) { + fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not opened. File too large.", fileName), null); + return; + } } catch (Exception ex) { fileInfo.ProgressMonitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not be opened.", fileName), ex); return; |