bodewig 2002/06/12 06:46:30
Modified: . Tag: ANT_15_BRANCH WHATSNEW
docs/manual/OptionalTasks Tag: ANT_15_BRANCH pvcstask.html
src/main/org/apache/tools/ant/taskdefs/optional/pvcs Tag:
ANT_15_BRANCH Pvcs.java
Log:
Document some attributes of <pvcs> that are related to PR 3219 and
fix a backwards incompatibility to 1.4.1 - which breaks compatibility
to 1.5beta[12] 8-(
Make sure all streams in <pvcs> get closed properly (hoped to address
PR 3220).
Revision Changes Path
No revision
No revision
1.263.2.37 +3 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.36
retrieving revision 1.263.2.37
diff -u -r1.263.2.36 -r1.263.2.37
--- WHATSNEW 12 Jun 2002 08:57:33 -0000 1.263.2.36
+++ WHATSNEW 12 Jun 2002 13:46:30 -0000 1.263.2.37
@@ -10,6 +10,9 @@
iterate over the returned list if listeners are added or removed
during the traversal.
+* <pvcs> default filenameformat has been different from Ant 1.4.1.
+ Now it is different from 1.5beta1 and 1.5beta2.
+
Fixed bugs:
-----------
No revision
No revision
1.4.2.1 +21 -1 jakarta-ant/docs/manual/OptionalTasks/pvcstask.html
Index: pvcstask.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/pvcstask.html,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- pvcstask.html 8 Sep 2001 01:05:18 -0000 1.4
+++ pvcstask.html 12 Jun 2002 13:46:30 -0000 1.4.2.1
@@ -137,6 +137,24 @@
newer than existing local files.</td>
<td VALIGN=TOP WIDTH="10%">No</td>
</tr>
+ <tr>
+ <td valign="TOP">filenameformat</td>
+ <td valign="TOP">The format of your folder names in a
+ format suitable for <code>java.text.MessageFormat</code>.
+ Index 1 of the format will be used as the file name.
+ Defaults to <code>{0}-arc({1})</code>.</td>
+ <td valign="TOP">No</td>
+ </tr>
+ <tr>
+ <td valign="TOP">linestart</td>
+ <td valign="TOP">What a valid return value from PVCS looks like
+ when it describes a file. Defaults to <code>"P:</code>.
+ If you are not using an UNC name for your repository and the
+ drive letter <code>P</code> is incorrect for your setup, you may
+ need to change this value, UNC names will always be
+ accepted.</td>
+ <td valign="TOP">No</td>
+ </tr>
</table>
<h3><a name="nested">Nested Elements</a></h3>
@@ -230,6 +248,8 @@
Total time: 22 seconds</pre>
<hr WIDTH="100%">
-PVCS is a registered trademark of MERANT.
+<p align="center">Copyright © 2001-2002 Apache Software
+Foundation. All rights Reserved.</p>
+<p>PVCS is a registered trademark of MERANT.</p>
</body>
</html>
No revision
No revision
1.14.2.1 +67 -42
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
Index: Pvcs.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- Pvcs.java 25 Apr 2002 12:14:51 -0000 1.14
+++ Pvcs.java 12 Jun 2002 13:46:30 -0000 1.14.2.1
@@ -207,11 +207,18 @@
try {
Random rand = new Random(System.currentTimeMillis());
tmp = new File("pvcs_ant_" + rand.nextLong() + ".log");
+ FileOutputStream fos = new FileOutputStream(tmp);
tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
log(commandLine.describeCommand(), Project.MSG_VERBOSE);
- result = runCmd(commandLine,
- new PumpStreamHandler(new FileOutputStream(tmp),
- new LogOutputStream(this, Project.MSG_WARN)));
+ try {
+ result = runCmd(commandLine,
+ new PumpStreamHandler(fos,
+ new LogOutputStream(this,
+ Project.MSG_WARN)));
+ } finally {
+ fos.close();
+ }
+
if (result != 0 && !ignorerc) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
@@ -290,44 +297,53 @@
* Parses the file and creates the folders specified in the output
section
*/
private void createFolders(File file) throws IOException, ParseException
{
- BufferedReader in = new BufferedReader(new FileReader(file));
- MessageFormat mf = new MessageFormat(getFilenameFormat());
- String line = in.readLine();
- while (line != null) {
- log("Considering \"" + line + "\"", Project.MSG_VERBOSE);
- if (line.startsWith("\"\\") ||
- line.startsWith("\"/") ||
- line.startsWith(getLineStart())) {
- Object[] objs = mf.parse(line);
- String f = (String) objs[1];
- // Extract the name of the directory from the filename
- int index = f.lastIndexOf(File.separator);
- if (index > -1) {
- File dir = new File(f.substring(0, index));
- if (!dir.exists()) {
- log("Creating " + dir.getAbsolutePath(),
- Project.MSG_VERBOSE);
- if (dir.mkdirs()) {
- log("Created " + dir.getAbsolutePath(),
- Project.MSG_INFO);
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new FileReader(file));
+ MessageFormat mf = new MessageFormat(getFilenameFormat());
+ String line = in.readLine();
+ while (line != null) {
+ log("Considering \"" + line + "\"", Project.MSG_VERBOSE);
+ if (line.startsWith("\"\\") ||
+ line.startsWith("\"/") ||
+ line.startsWith(getLineStart())) {
+ Object[] objs = mf.parse(line);
+ String f = (String) objs[1];
+ // Extract the name of the directory from the filename
+ int index = f.lastIndexOf(File.separator);
+ if (index > -1) {
+ File dir = new File(f.substring(0, index));
+ if (!dir.exists()) {
+ log("Creating " + dir.getAbsolutePath(),
+ Project.MSG_VERBOSE);
+ if (dir.mkdirs()) {
+ log("Created " + dir.getAbsolutePath(),
+ Project.MSG_INFO);
+ } else {
+ log("Failed to create "
+ + dir.getAbsolutePath(),
+ Project.MSG_INFO);
+ }
} else {
- log("Failed to create " + dir.getAbsolutePath(),
- Project.MSG_INFO);
+ log(dir.getAbsolutePath() + " exists. Skipping",
+ Project.MSG_VERBOSE);
}
} else {
- log(dir.getAbsolutePath() + " exists. Skipping",
- Project.MSG_VERBOSE);
+ log("File separator problem with " + line,
+ Project.MSG_WARN);
}
} else {
- log("File separator problem with " + line,
- Project.MSG_WARN);
+ log("Skipped \"" + line + "\"", Project.MSG_VERBOSE);
}
- } else {
- log("Skipped \"" + line + "\"", Project.MSG_VERBOSE);
+ line = in.readLine();
+ }
+ } finally {
+ if (in != null) {
+ in.close();
}
- line = in.readLine();
}
}
+
/**
* Simple hack to handle the PVCS command-line tools botch when
@@ -335,16 +351,25 @@
*/
private void massagePCLI(File in, File out)
throws FileNotFoundException, IOException {
- BufferedReader inReader = new BufferedReader(new FileReader(in));
- BufferedWriter outWriter = new BufferedWriter(new FileWriter(out));
- String s = null;
- while ((s = inReader.readLine()) != null) {
- String sNormal = s.replace('\\', '/');
- outWriter.write(sNormal);
- outWriter.newLine();
+ BufferedReader inReader = null;
+ BufferedWriter outWriter = null;
+ try {
+ inReader = new BufferedReader(new FileReader(in));
+ outWriter = new BufferedWriter(new FileWriter(out));
+ String s = null;
+ while ((s = inReader.readLine()) != null) {
+ String sNormal = s.replace('\\', '/');
+ outWriter.write(sNormal);
+ outWriter.newLine();
+ }
+ } finally {
+ if (inReader != null) {
+ inReader.close();
+ }
+ if (outWriter != null) {
+ outWriter.close();
+ }
}
- inReader.close();
- outWriter.close();
}
/**
@@ -547,6 +572,6 @@
ignorerc = false;
updateOnly = false;
lineStart = "\"P:";
- filenameFormat = "{0}_arc({1})";
+ filenameFormat = "{0}-arc({1})";
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>