You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/02/26 11:40:48 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs AbstractCvsTask.java
bodewig 2003/02/26 02:40:48
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
AbstractCvsTask.java
Log:
perform some sanity checks on CVS passfile attribute.
PR: 17365
Revision Changes Path
No revision
No revision
1.12.2.5 +20 -9 ant/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
Index: AbstractCvsTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java,v
retrieving revision 1.12.2.4
retrieving revision 1.12.2.5
diff -u -r1.12.2.4 -r1.12.2.5
--- AbstractCvsTask.java 10 Feb 2003 14:24:42 -0000 1.12.2.4
+++ AbstractCvsTask.java 26 Feb 2003 10:40:48 -0000 1.12.2.5
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -276,24 +276,35 @@
* Need a better cross platform integration with <cvspass>, so
* use the same filename.
*/
- if(passFile == null) {
+ if (passFile == null) {
File defaultPassFile = new File(
System.getProperty("cygwin.user.home",
System.getProperty("user.home"))
+ File.separatorChar + ".cvspass");
- if(defaultPassFile.exists())
+ if(defaultPassFile.exists()) {
this.setPassfile(defaultPassFile);
+ }
}
if (passFile != null) {
- Environment.Variable var = new Environment.Variable();
- var.setKey("CVS_PASSFILE");
- var.setValue(String.valueOf(passFile));
- env.addVariable(var);
- log("Using cvs passfile: " + String.valueOf(passFile),
- Project.MSG_INFO);
+ if (passFile.isFile() && passFile.canRead()) {
+ Environment.Variable var = new Environment.Variable();
+ var.setKey("CVS_PASSFILE");
+ var.setValue(String.valueOf(passFile));
+ env.addVariable(var);
+ log("Using cvs passfile: " + String.valueOf(passFile),
+ Project.MSG_INFO);
+ } else if (!passFile.canRead()) {
+ log("cvs passfile: " + String.valueOf(passFile)
+ + " ignored as it is not readable",
+ Project.MSG_WARN);
+ } else {
+ log("cvs passfile: " + String.valueOf(passFile)
+ + " ignored as it is not a file",
+ Project.MSG_WARN);
+ }
}
if (cvsRsh != null) {