[Design the new POJO MicroContainer] - Re: Those terrible error messages
by david.lloyd@jboss.com
"alesj" wrote : Sure, go ahead.
| But this is not the only place this is done.
| Search Deployers code for similar error msg aka 'alien language'. ;-)
|
| You must fix them both or none. :-)
Ales, Ales, Ales. :-)
OK, I found some stuff in jboss-deployers-client-spi which I imagine is it. Here's that patch:
| Index: deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java
| ===================================================================
| --- deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java
| +++ deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java
| @@ -30,6 +30,7 @@
| import java.util.Set;
| import java.util.TreeMap;
| import java.util.TreeSet;
| +import java.util.Iterator;
|
| /**
| * IncompleteDeployments.
| @@ -261,19 +262,18 @@
| // Display all the missing dependencies
| if (contextsMissingDependencies.isEmpty() == false)
| {
| - buffer.append("\n*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n\n");
| + buffer.append("\nDEPLOYMENTS MISSING DEPENDENCIES:\n");
| for (Map.Entry<String, Set<MissingDependency>> entry : contextsMissingDependencies.entrySet())
| {
| String name = entry.getKey();
| - buffer.append(name).append("\n");
| + buffer.append(String.format(" Deployment \"%s\" is missing the following dependencies:\n", name));
| for (MissingDependency dependency : entry.getValue())
| {
| - buffer.append(" -> ").append(dependency.getDependency());
| - buffer.append('{').append(dependency.getRequiredState());
| - buffer.append(':').append(dependency.getActualState()).append("}");
| - buffer.append("\n");
| + buffer.append(String.format(" Dependency \"%s\" (should be in state \"%s\", but is actually in state \"%s\")\n",
| + dependency.getDependency(),
| + dependency.getRequiredState(),
| + dependency.getActualState()));
| }
| - buffer.append('\n');
|
| // It is not a root cause if it has missing dependencies
| rootCauses.remove(name);
| @@ -286,22 +286,19 @@
|
| if (rootCauses.isEmpty() == false)
| {
| - buffer.append("\n*** CONTEXTS IN ERROR: Name -> Error\n\n");
| + buffer.append("\nDEPLOYMENTS IN ERROR:\n");
| for (String key : rootCauses.keySet())
| {
| - buffer.append(key).append(" -> ");
| + buffer.append(String.format(" Deployment \"%s\" is in error due to the following reason(s): ", key));
| Set<String> values = rootCauses.get(key);
| - boolean first = true;
| - for (String value : values)
| - {
| - if (first == false)
| - buffer.append(" | ");
| - else
| - first = false;
| -
| - buffer.append(value);
| - }
| - buffer.append("\n\n");
| + Iterator<String> it = values.iterator();
| + while (it.hasNext())
| + {
| + buffer.append(it.next());
| + if (it.hasNext())
| + buffer.append(", ");
| + }
| + buffer.append("\n");
| }
| }
| contextsInErrorInfo = buffer.toString();
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205305#4205305
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205305
17 years, 2 months
[Design the new POJO MicroContainer] - Those terrible error messages
by david.lloyd@jboss.com
One of the most off-putting things about JBossMC is the confusing, non-human error messages it produces when a deployment fails. Carlo's thread gave me the notion to try and fix this. Here's the patch to AbstractKernelDeployer which humanizes the error message. What do you think? Should I commit it?
| Index: kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
| ===================================================================
| --- kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
| +++ kernel/src/main/java/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
| @@ -217,22 +217,21 @@
| buffer.append("Incompletely deployed:\n");
| if (errors.size() != 0)
| {
| - buffer.append("\n*** DEPLOYMENTS IN ERROR: Name -> Error\n");
| + buffer.append("\nDEPLOYMENTS IN ERROR:\n");
| for (ControllerContext ctx : errors)
| {
| - buffer.append(ctx.getName()).append(" -> ").append(ctx.getError().toString()).append('\n');
| + buffer.append(String.format(" Deployment \"%s\" is in error due to: %s\n", ctx.getName(), ctx.getError()));
| }
| }
| if (incomplete.size() != 0)
| {
| - buffer.append("\n*** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n");
| + buffer.append("\nDEPLOYMENTS MISSING DEPENDENCIES:\n");
| for (ControllerContext ctx : incomplete)
| {
| Object name = ctx.getName();
| - buffer.append(name).append(" -> ");
| + buffer.append(String.format(" Deployment \"%s\" is missing the following dependencies:\n", name));
| DependencyInfo dependsInfo = ctx.getDependencyInfo();
| Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
| - boolean first = true;
| for (DependencyItem item : depends)
| {
| ControllerState dependentState = item.getDependentState();
| @@ -262,29 +261,18 @@
|
| if (print)
| {
| - if (first)
| - first = false;
| - else
| - buffer.append(", ");
| -
| - buffer.append(iDependOn).append('{').append(dependentState.getStateString());
| - buffer.append(':');
| - if (iDependOn == null)
| - {
| - buffer.append("** UNRESOLVED " + item.toHumanReadableString() + " **");
| - }
| - else
| - {
| - if (other == null)
| - buffer.append("** NOT FOUND **");
| - else
| - buffer.append(otherState.getStateString());
| - }
| - buffer.append('}');
| + buffer.append(String.format(" Dependency \"%s\" (should be in state \"%s\", but is actually %s)\n",
| + iDependOn,
| + dependentState.getStateString(),
| + iDependOn == null ?
| + String.format("unresolved (%s)",
| + item.toHumanReadableString()) :
| + other == null ?
| + "not found" :
| + String.format("in state \"%s\"", otherState.getStateString())));
| }
| }
| }
| - buffer.append('\n');
| }
| }
| throw new IllegalStateException(buffer.toString());
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205283#4205283
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205283
17 years, 2 months