Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 40CD99A69 for ; Thu, 27 Oct 2011 20:22:35 +0000 (UTC) Received: (qmail 95616 invoked by uid 500); 27 Oct 2011 20:22:35 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 95567 invoked by uid 500); 27 Oct 2011 20:22:35 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 95560 invoked by uid 99); 27 Oct 2011 20:22:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2011 20:22:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2011 20:22:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C470523889EB for ; Thu, 27 Oct 2011 20:22:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1189996 - in /cxf/branches/2.4.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Date: Thu, 27 Oct 2011 20:22:13 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111027202213.C470523889EB@eris.apache.org> Author: dkulp Date: Thu Oct 27 20:22:13 2011 New Revision: 1189996 URL: http://svn.apache.org/viewvc?rev=1189996&view=rev Log: 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.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1189996&r1=1189995&r2=1189996&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original) +++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Thu Oct 27 20:22:13 2011 @@ -274,8 +274,9 @@ public class DynamicClientFactory { SchemaCompiler compiler = JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet()); + 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) {