You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2011/08/19 15:58:38 UTC

svn commit: r1159641 - /openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java

Author: jlmonteiro
Date: Fri Aug 19 13:58:38 2011
New Revision: 1159641

URL: http://svn.apache.org/viewvc?rev=1159641&view=rev
Log:
OPENEJB-1312 Remove the SecurityException catch block to prevent invalid state of the object. Moreover the catch block does not contain anything so the exception is silently ignore which is not relevant because it will result in an unpredictable behavior. Thanks Mark!

Modified:
    openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java

Modified: openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java?rev=1159641&r1=1159640&r2=1159641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java (original)
+++ openejb/trunk/openejb3/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java Fri Aug 19 13:58:38 2011
@@ -35,30 +35,26 @@ public class FileUtils {
 
     public FileUtils(String homeDir, String defaultDir, Hashtable env) {
         String homePath = null;
-        try {
-            homePath = (String) env.get(homeDir);
-            if (homePath == null) {
-                homePath = (String) env.get(defaultDir);
-            }
+        homePath = (String) env.get(homeDir);
+        if (homePath == null) {
+            homePath = (String) env.get(defaultDir);
+        }
 
-            if (homePath == null) {
-                homePath = System.getProperty("user.dir");
-            }
+        if (homePath == null) {
+            homePath = System.getProperty("user.dir");
+        }
 
+        home = new File(homePath);
+        if (!home.exists() || (home.exists() && !home.isDirectory())) {
+            homePath = System.getProperty("user.dir");
             home = new File(homePath);
-            if (!home.exists() || (home.exists() && !home.isDirectory())) {
-                homePath = System.getProperty("user.dir");
-                home = new File(homePath);
-            }
-
-            try {
-                home = home.getCanonicalFile();
-            } catch (IOException e) {
-                // this shouldn't happen, but let's get absolute file
-                home = home.getAbsoluteFile();
-            }
-        } catch (SecurityException e) {
+        }
 
+        try {
+            home = home.getCanonicalFile();
+        } catch (IOException e) {
+            // this shouldn't happen, but let's get absolute file
+            home = home.getAbsoluteFile();
         }
     }