You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/09/04 06:24:16 UTC

svn commit: r572510 - /geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java

Author: jdillon
Date: Mon Sep  3 21:24:16 2007
New Revision: 572510

URL: http://svn.apache.org/viewvc?rev=572510&view=rev
Log:
Move the bits which actually do the loading to load()

Modified:
    geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java

Modified: geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java?rev=572510&r1=572509&r2=572510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-layout/src/main/java/org/apache/geronimo/gshell/layout/LayoutManagerImpl.java Mon Sep  3 21:24:16 2007
@@ -71,15 +71,20 @@
             throw new InitializationException("Invalid URL for layout configuration", e);
         }
 
-        log.debug("Loading layout from XML: {}", url);
-
-        InputStream input;
         try {
-            input = url.openStream();
+            this.layout = load(url);
         }
         catch (IOException e) {
-            throw new InitializationException("Failed to initialize the shell layout", e);
+            throw new InitializationException("Failed to load layout from URL: " + url, e);
         }
+    }
+
+    private Layout load(final URL url) throws IOException {
+        assert url != null;
+
+        log.debug("Loading layout from XML: {}", url);
+
+        InputStream input = url.openStream();
 
         // Setup the XStream marshallar and configure it with the aliases for the model we are working with
         XStream xs = new XStream(new DomDriver());
@@ -92,10 +97,7 @@
             assert layout != null;
         }
         finally {
-            try {
-                input.close();
-            }
-            catch (IOException ignore) {}
+           input.close();
         }
 
         log.debug("Loaded layout: {}", layout);
@@ -103,7 +105,7 @@
         //
         // TODO: Do some kind post-parsing validation or someting?
 
-        this.layout = layout;
+        return layout;
     }
 
     public Layout getLayout() {