You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/10/27 22:41:23 UTC

svn commit: r1190011 - in /cxf/branches/2.3.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java

Author: dkulp
Date: Thu Oct 27 20:41:22 2011
New Revision: 1190011

URL: http://svn.apache.org/viewvc?rev=1190011&view=rev
Log:
Merged revisions 1189996 via svnmerge from 
https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1189996 | dkulp | 2011-10-27 16:22:13 -0400 (Thu, 27 Oct 2011) | 10 lines
  
  Merged revisions 1189966 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1189966 | dkulp | 2011-10-27 15:40:10 -0400 (Thu, 27 Oct 2011) | 2 lines
    
    [CXF-3887] Also update the DynamicClientFactory to display all the
    errors.
  ........
................

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1190011&r1=1190010&r2=1190011&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Thu Oct 27 20:41:22 2011
@@ -274,8 +274,9 @@ public class DynamicClientFactory {
         SchemaCompiler compiler = 
             JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<String>());
         
+        InnerErrorListener listener = new InnerErrorListener(wsdlUrl);
         Object elForRun = ReflectionInvokationHandler
-            .createProxyWrapper(new InnerErrorListener(wsdlUrl),
+            .createProxyWrapper(listener,
                                 JAXBUtils.getParamClass(compiler, "setErrorListener"));
         
         compiler.setErrorListener(elForRun);
@@ -283,6 +284,9 @@ public class DynamicClientFactory {
         addSchemas(wsdlUrl, schemas, compiler);
         addBindingFiles(bindingFiles, compiler);
         S2JJAXBModel intermediateModel = compiler.bind();
+        
+        listener.throwException();
+        
         JCodeModel codeModel = intermediateModel.generateCode(null, elForRun);
         StringBuilder sb = new StringBuilder();
         boolean firstnt = false;
@@ -570,14 +574,37 @@ public class DynamicClientFactory {
     class InnerErrorListener {
 
         private String url;
+        private StringBuilder errors = new StringBuilder();
+        private Exception ex;
 
         InnerErrorListener(String url) {
             this.url = url;
         }
 
+        public void throwException() {
+            if (errors.length() > 0) {
+                throw new RuntimeException(errors.toString(), ex);
+            }
+        }
         public void error(SAXParseException arg0) {
-            throw new RuntimeException("Error compiling schema from WSDL at {" + url + "}: "
-                                       + arg0.getMessage(), arg0);
+            if (ex == null) {
+                ex = arg0;
+            }
+            if (errors.length() == 0) {
+                errors.append("Error compiling schema from WSDL at {").append(url).append("}: \n");
+            } else {
+                errors.append("\n");
+            }
+            if (arg0.getLineNumber() > 0) {
+                errors.append(arg0.getLocalizedMessage() + "\n"
+                    + " at line " + arg0.getLineNumber()
+                    + " column " + arg0.getColumnNumber()
+                    + " of schema " + arg0.getSystemId()
+                    + "\n");
+            } else {
+                errors.append(arg0.getMessage());
+                errors.append("\n");
+            }
         }
 
         public void fatalError(SAXParseException arg0) {