From 7d38166d02b60e2b2c8c5d422cf3f6d522d74d9f Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Fri, 17 Jan 2003 02:14:39 +0000 Subject: [PATCH] Fix up PVCS folder creation PR: 3219 Submitted by: Shane Hartman git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273818 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/taskdefs/optional/pvcs/Pvcs.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index 19854880c..b92f067ca 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -142,7 +142,7 @@ public class Pvcs extends org.apache.tools.ant.Task { exe.setCommandline(cmd.getCommandline()); return exe.execute(); } catch (java.io.IOException e) { - String msg = "Failed executing: " + cmd.toString() + String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage(); throw new BuildException(msg, getLocation()); } @@ -193,7 +193,7 @@ public class Pvcs extends org.apache.tools.ant.Task { // default pvcs project is "/" if (getPvcsproject() == null && getPvcsprojects().isEmpty()) { - pvcsProject = "/"; + pvcsProject = "/"; } if (getPvcsproject() != null) { @@ -204,7 +204,7 @@ public class Pvcs extends org.apache.tools.ant.Task { while (e.hasMoreElements()) { String projectName = ((PvcsProject) e.nextElement()).getName(); if (projectName == null || (projectName.trim()).equals("")) { - throw new BuildException("name is a required attribute " + throw new BuildException("name is a required attribute " + "of pvcsproject"); } commandLine.createArgument().setValue(projectName); @@ -234,8 +234,8 @@ public class Pvcs extends org.apache.tools.ant.Task { } if (!tmp.exists()) { - throw new BuildException("Communication between ant and pvcs " - + "failed. No output generated from executing PVCS " + throw new BuildException("Communication between ant and pvcs " + + "failed. No output generated from executing PVCS " + "commandline interface \"pcli\" and \"get\""); } @@ -257,7 +257,7 @@ public class Pvcs extends org.apache.tools.ant.Task { } if (getPromotiongroup() != null) { - commandLine.createArgument().setValue("-G" + commandLine.createArgument().setValue("-G" + getPromotiongroup()); } else { if (getLabel() != null) { @@ -272,24 +272,24 @@ public class Pvcs extends org.apache.tools.ant.Task { commandLine.createArgument().setValue("@" + tmp2.getAbsolutePath()); log("Getting files", Project.MSG_INFO); log("Executing " + commandLine.toString(), Project.MSG_VERBOSE); - result = runCmd(commandLine, + result = runCmd(commandLine, new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); if (result != 0 && !ignorerc) { - String msg = "Failed executing: " + commandLine.toString() + String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; throw new BuildException(msg, getLocation()); } } catch (FileNotFoundException e) { - String msg = "Failed executing: " + commandLine.toString() + String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); throw new BuildException(msg, getLocation()); } catch (IOException e) { - String msg = "Failed executing: " + commandLine.toString() + String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); throw new BuildException(msg, getLocation()); } catch (ParseException e) { - String msg = "Failed executing: " + commandLine.toString() + String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); throw new BuildException(msg, getLocation()); } finally { @@ -315,7 +315,11 @@ public class Pvcs extends org.apache.tools.ant.Task { log("Considering \"" + line + "\"", Project.MSG_VERBOSE); if (line.startsWith("\"\\") || line.startsWith("\"/") || - line.startsWith(getLineStart())) { + (line.length() >3 && + line.startsWith("\"") && + Character.isLetter(line.charAt(1)) && + String.valueOf(line.charAt(2)).equals(":") && + String.valueOf(line.charAt(3)).equals("\\"))) { Object[] objs = mf.parse(line); String f = (String) objs[1]; // Extract the name of the directory from the filename @@ -355,10 +359,10 @@ public class Pvcs extends org.apache.tools.ant.Task { /** - * Simple hack to handle the PVCS command-line tools botch when + * Simple hack to handle the PVCS command-line tools botch when * handling UNC notation. */ - private void massagePCLI(File in, File out) + private void massagePCLI(File in, File out) throws FileNotFoundException, IOException { BufferedReader inReader = null; BufferedWriter outWriter = null; @@ -636,3 +640,4 @@ public class Pvcs extends org.apache.tools.ant.Task { filenameFormat = "{0}-arc({1})"; } } +