You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2005/04/01 04:48:15 UTC

svn commit: r159656 - excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java

Author: leif
Date: Thu Mar 31 18:48:14 2005
New Revision: 159656

URL: http://svn.apache.org/viewcvs?view=rev&rev=159656
Log:
Make it possible for errors thrown on the state file to report the location of the file that they came from.

Modified:
    excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java

Modified: excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java?view=diff&r1=159655&r2=159656
==============================================================================
--- excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java (original)
+++ excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java Thu Mar 31 18:48:14 2005
@@ -870,7 +870,7 @@
         FileInputStream is = new FileInputStream( stateFile );
         try
         {
-            loadStateFromStream( is );
+            loadStateFromStream( is, stateFile.getCanonicalPath() );
         }
         finally
         {
@@ -891,9 +891,32 @@
     public void loadStateFromStream( InputStream is )
         throws Exception
     {
+        loadStateFromStream( is, null );
+    }
+
+    /**
+     * Loads the Instrument Manager state from the specified stream.
+     *
+     * @param is Stream to read the instrument manager's state from.
+     * @param location The location of the stream. Used to improve the
+     *                 usefulness of any exceptions thrown.
+     *
+     * @throws Exception if there are any problems loading the state.
+     */
+    private void loadStateFromStream( InputStream is, String location )
+        throws Exception
+    {
         // Ride on top of the Configuration classes to load the state.
         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
-        Configuration stateConfig = builder.build( is );
+        Configuration stateConfig;
+        if ( location == null )
+        {
+            stateConfig = builder.build( is );
+        }
+        else
+        {
+            stateConfig = builder.build( is, location );
+        }
 
         loadStateFromConfiguration( stateConfig );
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org