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 034E8C20A for ; Thu, 21 Jun 2012 01:17:00 +0000 (UTC) Received: (qmail 55109 invoked by uid 500); 21 Jun 2012 01:17:00 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 55067 invoked by uid 500); 21 Jun 2012 01:17:00 -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 55060 invoked by uid 99); 21 Jun 2012 01:17:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2012 01:17:00 +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, 21 Jun 2012 01:16:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 791B923889BB; Thu, 21 Jun 2012 01:16:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1352386 - in /cxf/branches/2.4.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/util/Compiler.java systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java Date: Thu, 21 Jun 2012 01:16:39 -0000 To: commits@cxf.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120621011639.791B923889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Thu Jun 21 01:16:38 2012 New Revision: 1352386 URL: http://svn.apache.org/viewvc?rev=1352386&view=rev Log: Merged revisions 1352383 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes ................ r1352383 | ffang | 2012-06-21 09:07:34 +0800 (四, 21 6 2012) | 20 lines Merged revisions 1352376 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ................ r1352376 | ffang | 2012-06-21 08:38:15 +0800 (四, 21 6 2012) | 13 lines Merged revisions 1352369-1352374 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1352369 | ffang | 2012-06-21 07:34:21 +0800 (四, 21 6 2012) | 1 line [CXF-4387]put long classpath in @argfiles to avoid javac command too long(windows has limitation for command length) ........ r1352374 | ffang | 2012-06-21 08:28:20 +0800 (四, 21 6 2012) | 1 line [[CXF-4387]]remove classpath temp file in finally block after javac ........ ................ ................ Modified: cxf/branches/2.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/Compiler.java cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/Compiler.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/Compiler.java?rev=1352386&r1=1352385&r2=1352386&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/Compiler.java (original) +++ cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/Compiler.java Thu Jun 21 01:16:38 2012 @@ -39,6 +39,7 @@ public class Compiler { private String outputDir; private String classPath; private boolean forceFork = Boolean.getBoolean(Compiler.class.getName() + "-fork"); + private File classpathTmpFile; public Compiler() { } @@ -147,7 +148,6 @@ public class Compiler { javacstr = System.getProperty("java.home") + fsep + ".." + fsep + "bin" + fsep + platformjavacname; } - list.add(javacstr); // End of honoring java.home for used javac @@ -160,7 +160,9 @@ public class Compiler { list.add("-J-Xmx" + maxMemory); addArgs(list); - + int classpathIdx = list.indexOf("-classpath"); + String classpath = list.get(classpathIdx + 1); + checkLongClasspath(classpath, list, classpathIdx); int idx = list.size(); list.addAll(Arrays.asList(files)); @@ -252,7 +254,6 @@ public class Compiler { StreamPrinter infoStreamPrinter = new StreamPrinter(p.getInputStream(), "[INFO]", System.out); infoStreamPrinter.start(); } - if (p != null) { return p.waitFor() == 0 ? true : false; } @@ -268,6 +269,9 @@ public class Compiler { if (tmpFile != null && tmpFile.exists()) { FileUtils.delete(tmpFile); } + if (classpathTmpFile != null && classpathTmpFile.exists()) { + FileUtils.delete(classpathTmpFile); + } } return false; @@ -280,6 +284,26 @@ public class Compiler { } return strBuffer.toString().length() > 4096 ? true : false; } + + private boolean isLongClasspath(String classpath) { + return classpath.length() > 2048 ? true : false; + } + + private void checkLongClasspath(String classpath, List list, int classpathIdx) { + if (isLongClasspath(classpath)) { + PrintWriter out = null; + try { + classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null); + out = new PrintWriter(new FileWriter(classpathTmpFile)); + out.println(classpath); + out.flush(); + out.close(); + list.set(classpathIdx + 1, "@" + classpathTmpFile); + } catch (IOException e) { + System.err.print("[ERROR] can't write long classpath to @argfile"); + } + } + } } Modified: cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java?rev=1352386&r1=1352385&r2=1352386&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java (original) +++ cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxWsDynamicClientTest.java Thu Jun 21 01:16:38 2012 @@ -105,4 +105,19 @@ public class JaxWsDynamicClientTest exte client.invoke("init", list); } + @Test + public void testArgfiles() throws Exception { + System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true"); + JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); + Client client = dcf.createClient(new URL("http://localhost:" + + PORT1 + "/ArrayService?wsdl")); + + String[] values = new String[] {"foobar", "something" }; + List list = Arrays.asList(values); + + client.getOutInterceptors().add(new LoggingOutInterceptor()); + client.getInInterceptors().add(new LoggingInInterceptor()); + client.invoke("init", list); + } + }