You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/03/28 23:38:51 UTC

svn commit: r1306605 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java

Author: veithen
Date: Wed Mar 28 21:38:51 2012
New Revision: 1306605

URL: http://svn.apache.org/viewvc?rev=1306605&view=rev
Log:
Give the user a hint about the missing JAR when throwing an exception with "No meta factory found for feature 'xxx'".

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java?rev=1306605&r1=1306604&r2=1306605&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java Wed Mar 28 21:38:51 2012
@@ -154,7 +154,20 @@ public class OMAbstractFactory {
         }
         OMMetaFactory metaFactory = locator.getOMMetaFactory(feature);
         if (metaFactory == null) {
-            throw new OMException("No meta factory found for feature '" + feature + "'");
+            String jarHint;
+            if (feature.equals(FEATURE_DEFAULT)) {
+                jarHint = "axiom-impl.jar";
+            } else if (feature.equals(FEATURE_DOM)) {
+                jarHint = "axiom-dom.jar";
+            } else {
+                jarHint = null;
+            }
+            StringBuilder buffer = new StringBuilder();
+            buffer.append("No meta factory found for feature '").append(feature).append("'");
+            if (jarHint != null) {
+                buffer.append("; this usually means that ").append(jarHint).append(" is not in the classpath");
+            }
+            throw new OMException(buffer.toString());
         } else {
             return metaFactory;
         }