[jboss-cvs] JBossAS SVN: r90165 - projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/profileservice.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 12 14:43:37 EDT 2009


Author: ispringer
Date: 2009-06-12 14:43:37 -0400 (Fri, 12 Jun 2009)
New Revision: 90165

Modified:
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/profileservice/PsGetExe.java
Log:
gracefully handle RuntimeExceptions thrown by ManagedProperty.getValue()


Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/profileservice/PsGetExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/profileservice/PsGetExe.java	2009-06-12 17:05:28 UTC (rev 90164)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/profileservice/PsGetExe.java	2009-06-12 18:43:37 UTC (rev 90165)
@@ -152,7 +152,18 @@
         Collections.sort(props, new ManagedPropertyComparator()); // sort by name
         for (ManagedProperty managedProperty : props)
         {
-            buf.append(managedProperty.getName()).append("=").append(toString(managedProperty.getValue(), complex));
+            buf.append(managedProperty.getName()).append("=");
+            try
+            {
+                buf.append(toString(managedProperty.getValue(), complex));
+            }
+            catch (RuntimeException e)
+            {
+                // It's not uncommon for managedProperty.getValue() to throw a RuntimeException.
+                // Don't let that cause this entire toString() method to fail.
+                buf.append("<").append(e).append(">");
+            }
+
             if (metadata) {
                 buf.append(" (");
                 EnumSet<ViewUse> viewUses = getViewUses(managedProperty);




More information about the jboss-cvs-commits mailing list