From 7b2463d3bdac302acb675c7906c51ca3fb04e39f Mon Sep 17 00:00:00 2001 From: "hannes%helma.at" Date: Fri, 14 Nov 2008 14:05:55 +0000 Subject: [PATCH] Fix bug 329908: Throw exception if file can't be read in readFile() git-svn-id: svn://10.0.0.236/trunk@255040 18797224-902f-48f8-a5cc-f745e15eee43 --- .../toolsrc/org/mozilla/javascript/tools/shell/Global.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Global.java b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Global.java index 720e770a1f6..aabb6e8c8e5 100644 --- a/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Global.java +++ b/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Global.java @@ -1037,7 +1037,11 @@ public class Global extends ImporterTopLevel } } else { File f = new File(filePath); - + if (!f.exists()) { + throw new FileNotFoundException("File not found: " + filePath); + } else if (!f.canRead()) { + throw new IOException("Cannot read file: " + filePath); + } long length = f.length(); chunkLength = (int)length; if (chunkLength != length)