Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE8434C10 for ; Fri, 1 Jul 2011 12:08:51 +0000 (UTC) Received: (qmail 77085 invoked by uid 500); 1 Jul 2011 12:08:51 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 76778 invoked by uid 500); 1 Jul 2011 12:08:50 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 76761 invoked by uid 99); 1 Jul 2011 12:08:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 12:08:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 12:08:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 7767A43EFF4 for ; Fri, 1 Jul 2011 12:08:28 +0000 (UTC) Date: Fri, 1 Jul 2011 12:08:28 +0000 (UTC) From: "Kedar Raybagkar (JIRA)" To: issues@commons.apache.org Message-ID: <1859394592.8444.1309522108485.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (EXEC-36) CommandLine does not work with double quote or single quote correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/EXEC-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058512#comment-13058512 ] Kedar Raybagkar commented on EXEC-36: ------------------------------------- StringUtils also needs a change to handle the issue of quote... Trip the ending as well as starting double or single quote if they start or end with quotes. method static String quoteArgument... while((argument.trim().endsWith(SINGLE_QUOTE) || argument.trim().endsWith(DOUBLE_QUOTE)) && cleanedArgument.startsWith(SINGLE_QUOTE) || cleanedArgument.startsWith(DOUBLE_QUOTE)) { cleanedArgument = cleanedArgument.substring(1); } while((argument.trim().startsWith(SINGLE_QUOTE) || argument.trim().startsWith(DOUBLE_QUOTE)) && cleanedArgument.endsWith(SINGLE_QUOTE) || cleanedArgument.endsWith(DOUBLE_QUOTE)) { cleanedArgument = cleanedArgument.substring(0, cleanedArgument.length() - 1); } > CommandLine does not work with double quote or single quote correctly > --------------------------------------------------------------------- > > Key: EXEC-36 > URL: https://issues.apache.org/jira/browse/EXEC-36 > Project: Commons Exec > Issue Type: Bug > Affects Versions: 1.0 > Environment: Ubuntu 704, JDK1.6 > Reporter: Kai Hu > Assignee: Siegfried Goeschl > Priority: Critical > Attachments: ExecParseUtils.java, ExecParseUtilsTest.java > > > Please review and run the following junit test, either apache ant or apache exec does not handle the qoute in the arguments correctly. > @Test > public void shouldHandleTheDoubelQuote() throws Exception { > String commandline = "./script/jrake cruise:publish_installers " > + "INSTALLER_VERSION=unstable_2_1 " > + "INSTALLER_PATH=\"/var/lib/ cruise-agent/installers\" " > + "INSTALLER_DOWNLOAD_SERVER='something'" > + "WITHOUT_HELP_DOC=true"; > CommandLine line = CommandLine.parse(commandline); > String[] args = line.getArguments(); > assertThat(args[0], is("cruise:publish_installers")); > assertThat(args[1], is("INSTALLER_VERSION=unstable_2_1")); > assertThat(args[2], is("INSTALLER_PATH=\"/var/lib/ cruise-agent/installers\"")); > assertThat(args[3], is("INSTALLER_DOWNLOAD_SERVER='something'")); > assertThat(args[4], is("WITHOUT_HELP_DOC=true")); > } -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira