jlaskowski 2004/07/07 19:29:36
Modified: modules/core/src/java/org/openejb/alt/config
ConfigUtils.java
Log:
Make WebAdmin webapp work
Revision Changes Path
1.6 +17 -15
openejb1/modules/core/src/java/org/openejb/alt/config/ConfigUtils.java
Index: ConfigUtils.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/config/ConfigUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConfigUtils.java 5 Jul 2004 15:47:45 -0000 1.5
+++ ConfigUtils.java 7 Jul 2004 23:29:36 -0000 1.6
@@ -52,6 +52,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
@@ -407,26 +408,27 @@
return (file == null)? null: file.getAbsolutePath() ;
}
- public static File createConfig(File config) throws java.io.IOException{
- try{
+ public static File createConfig(File config) throws java.io.IOException {
+ InputStream in = null;
+ OutputStream out = null;
+ try {
URL defaultConfig = new URL("resource:/default.openejb.conf");
- InputStream in = defaultConfig.openStream();
- FileOutputStream out = new FileOutputStream(config);
+ in = defaultConfig.openStream();
+ out = new FileOutputStream(config);
- int b = in.read();
-
- while (b != -1) {
+ int b;
+ while ((b = in.read()) != -1) {
out.write(b);
- b = in.read();
+ }
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ if (out != null) {
+ out.close();
}
- in.close();
- out.close();
-
- } catch (Exception e){
- e.printStackTrace();
}
-
return config;
}