notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1966 - trunk/main/transit/core/src/main/dpml/util
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1966 - trunk/main/transit/core/src/main/dpml/util
- Date: Mon, 16 Apr 2007 17:15:10 +0200
Author: mcconnell
Date: 2007-04-16 17:15:10 +0200 (Mon, 16 Apr 2007)
New Revision: 1966
Modified:
trunk/main/transit/core/src/main/dpml/util/Main.java
Log:
housekeeping
Modified: trunk/main/transit/core/src/main/dpml/util/Main.java
===================================================================
--- trunk/main/transit/core/src/main/dpml/util/Main.java 2007-04-16
15:14:29 UTC (rev 1965)
+++ trunk/main/transit/core/src/main/dpml/util/Main.java 2007-04-16
15:15:10 UTC (rev 1966)
@@ -35,8 +35,6 @@
import javax.tools.Tool;
-//import net.dpml.lang.Strategy;
-
import net.dpml.transit.Transit;
import net.dpml.transit.Artifact;
@@ -244,9 +242,19 @@
logger.error( error );
return -1;
}
- //ClassLoader system = ClassLoader.getSystemClassLoader();
- //Tool tool = Strategy.load( system, Tool.class, uri, null );
- return tool.run( null, null, null, args );
+ try
+ {
+ return tool.run( null, null, null, args );
+ }
+ catch( Throwable ee )
+ {
+ final String error =
+ "Tool execution error."
+ + "\nTool: " + tool.getClass().getName()
+ + "\nURI: " + uri;
+ processError( error, ee );
+ return -1;
+ }
}
else
{
@@ -260,11 +268,48 @@
}
catch( Throwable e )
{
- e.printStackTrace();
+ final String error =
+ "Tool creation error."
+ + "\nURI: " + path;
+ processError( error, e );
return -1;
}
}
+ private void processError( String message, Throwable cause )
+ {
+ Logger logger = getLogger();
+ if( logger.isTraceEnabled() )
+ {
+ logger.error( message, cause );
+ }
+ /*
+ try
+ {
+ logger.info( "# START" );
+ NotificationStatus status =
NotificationHelper.getNotificationStatus( cause );
+ logger.info( "# STATUS: " + status + ", " + cause.getClass() );
+ if( NotificationStatus.INFO.equals( status ) )
+ {
+ logger.info( message + "\n" + cause.getMessage() );
+ }
+ else if( NotificationStatus.WARN.equals( status ) )
+ {
+ logger.warn( message + "\n" + cause.getMessage() );
+ }
+ else
+ {
+ logger.error( message, cause );
+ }
+ logger.info( "# END" );
+ }
+ catch( Throwable e )
+ {
+ logger.error( message, cause );
+ }
+ */
+ }
+
private Logger resolveLogger( Logger logger )
{
String partition = System.getProperty( "dpml.station.partition",
null );
- r1966 - trunk/main/transit/core/src/main/dpml/util, mcconnell at BerliOS, 04/16/2007
Archive powered by MHonArc 2.6.24.