Author: nextgens
Date: 2007-03-15 09:46:30 +0000 (Thu, 15 Mar 2007)
New Revision: 12117
Modified:
trunk/apps/new_installer/src/Sha1Test.java
Log:
new_installer: refactor Sha1test a bit, display a helpfull message insteed of
just the exception name
Modified: trunk/apps/new_installer/src/Sha1Test.java
===================================================================
--- trunk/apps/new_installer/src/Sha1Test.java 2007-03-14 12:18:37 UTC (rev
12116)
+++ trunk/apps/new_installer/src/Sha1Test.java 2007-03-15 09:46:30 UTC (rev
12117)
@@ -98,22 +98,20 @@
public static void get(String file, String filename) throws
FileNotFoundException{
URL url;
- InputStream is = null;
DataInputStream dis;
- String s;
+ InputStream is = null;
+ BufferedOutputStream os = null;
try {
url = new URL(base+file);
- is = url.openStream(); // throws an IOException
+ is = url.openStream();
dis = new DataInputStream(new BufferedInputStream(is));
File f = new File(filename);
- BufferedOutputStream os = new BufferedOutputStream(new
FileOutputStream(f));
+ os = new BufferedOutputStream(new FileOutputStream(f));
int b;
while ((b = dis.read()) != -1) {
os.write(b);
}
- os.close();
-
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException
happened ; please report it.");
mue.printStackTrace();
@@ -121,11 +119,12 @@
} catch (FileNotFoundException e) {
throw new FileNotFoundException();
} catch (IOException ioe) {
- System.out.println(ioe);
+ System.out.println("Caught :"+ioe.getMessage());
ioe.printStackTrace();
} finally {
try {
if(is != null) is.close();
+ if(os != null) os.close();
} catch (IOException ioe) {}
}
}