added error diagnostics

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@10979 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-07-24 02:00:38 +00:00
1 parent f1defd55f4
commit af8f487296
1 file changed
+8 -2
+8 -2
View File
@@ -159,7 +159,7 @@ public final class FilePath implements Serializable {
public FilePath(FilePath base, String rel) {
this.channel = base.channel;
if(rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches()) {
if(isAbsolute(rel)) {
// absolute
this.remote = rel;
} else
@@ -170,6 +170,10 @@ public final class FilePath implements Serializable {
}
}
private static boolean isAbsolute(String rel) {
return rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches();
}
private static final Pattern DRIVE_PATTERN = Pattern.compile("[A-Za-z]:\\\\.+");
/**
@@ -613,7 +617,9 @@ public final class FilePath implements Serializable {
* @return
* A set of relative file names from the base directory.
*/
private static String[] glob(File dir, String includes) {
private static String[] glob(File dir, String includes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/CoreTypes/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();