You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by aj...@apache.org on 2004/05/03 18:50:39 UTC

svn commit: rev 10511 - in incubator/depot/trunk/version/src/java/org/apache/depot/version: ant/environment ant/util util

Author: ajack
Date: Mon May  3 11:50:38 2004
New Revision: 10511

Added:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/util/IdentifierHelper.java
Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/util/AntLogListener.java
Log:
1) Filter out JDK stuff (since it is a repeast of knowing whatr JDK)
2) Log exception stacks


Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java	Mon May  3 11:50:38 2004
@@ -158,8 +158,7 @@
 
 			boolean evenNotOdd = true;
 			for (Iterator i = versions.iterator();
-				i.hasNext();
-				evenNotOdd = !evenNotOdd) {
+				i.hasNext();) {
 				Object entry = (Object) i.next();
 				if (entry instanceof VersionInformation) {
 					VersionInformation info = (VersionInformation) entry;
@@ -168,7 +167,15 @@
 
 					String id = versionMarker.getId();
 					String version = versionMarker.getVersion().toString();
+					
+					//
+					// Perhaps allow these to show, if verbose.
+					//
+					if (IdentifierHelper.isPartOfJdk(id)) 
+						continue;
 
+					evenNotOdd = !evenNotOdd;
+					
 					logPair(
 						Project.MSG_INFO,
 						id,
@@ -242,8 +249,15 @@
 					}
 				}
 				else{
+					String id = entry.getClass().getName();
+					//
+					// Perhaps allow these to show, if verbose.
+					//
+					if (IdentifierHelper.isPartOfJdk(id)) 
+						continue;
+					
 					log(
-						entry.getClass().getName() + ":" + entry.toString(),
+						id + ":" + entry.toString(),
 						Project.MSG_INFO);
 					evenNotOdd = !evenNotOdd;}
 			}

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/util/AntLogListener.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/util/AntLogListener.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/util/AntLogListener.java	Mon May  3 11:50:38 2004
@@ -32,8 +32,11 @@
 		m_component = component;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.apache.version.log.LogListener#log(int, java.lang.Object, java.lang.Throwable)
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.version.log.LogListener#log(int, java.lang.Object,
+	 *      java.lang.Throwable)
 	 */
 	public void log(int severity, Object message, Throwable thrower) {
 		int antSeverity = Project.MSG_ERR;
@@ -66,10 +69,31 @@
 					break;
 				}
 		}
-		String messageStr = message.toString();
 
-		//:TODO: The exception?
-		
-		m_component.log(messageStr, antSeverity);
+		StringBuffer messageStr = new StringBuffer(message.toString());
+
+		if (null != thrower) {
+			appendThrower(messageStr, thrower);
+
+		}
+
+		m_component.log(messageStr.toString(), antSeverity);
+
+	}
+
+	private void appendThrower(StringBuffer messageStr, Throwable thrower) {
+
+		messageStr.append(thrower.getLocalizedMessage());
+
+		StackTraceElement stacks[] = thrower.getStackTrace();
+		for (int i = 0; i < stacks.length; ++i) {
+			messageStr.append("\n");
+			messageStr.append(stacks[i].toString());
+		}
+
+		Throwable cause = thrower.getCause();
+		if (null != cause)
+			messageStr.append("Cause: \n");
+			appendThrower(messageStr, cause);
 	}
 }

Added: incubator/depot/trunk/version/src/java/org/apache/depot/version/util/IdentifierHelper.java
==============================================================================
--- (empty file)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/util/IdentifierHelper.java	Mon May  3 11:50:38 2004
@@ -0,0 +1,40 @@
+/*
+ * Copyright  2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.depot.version.util;
+
+/**
+ * @author arb_jack
+ */
+public class IdentifierHelper {
+
+	/**
+	 * Bit of a hack (for now)...
+	 */
+	public static boolean isPartOfJdk(String id) {
+		if (id.startsWith("java.") || id.startsWith("javax."))
+			return true;
+
+		if (id.startsWith("com.sun.") || id.startsWith("sun."))
+			return true;
+		
+		if (id.startsWith("org.omg.CORBA"))
+			return true;
+
+		return false;
+	}
+
+}