mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-30 04:55:21 +00:00
[fixed] Workspace link generates NPE when workspace contains files that Hudson can not access (issue #1633)
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9065 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
1332d2d28d
commit
e2871c00a2
3 files changed
+87
-54
No files matched your search
@@ -215,19 +215,21 @@ public final class FilePath implements Serializable {
|
||||
}
|
||||
|
||||
private void scan(File f, ZipOutputStream zip, String path) throws IOException {
|
||||
if(f.isDirectory()) {
|
||||
zip.putNextEntry(new ZipEntry(path+f.getName()+'/'));
|
||||
zip.closeEntry();
|
||||
for( File child : f.listFiles() )
|
||||
scan(child,zip,path+f.getName()+'/');
|
||||
} else {
|
||||
zip.putNextEntry(new ZipEntry(path+f.getName()));
|
||||
FileInputStream in = new FileInputStream(f);
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
zip.write(buf,0,len);
|
||||
in.close();
|
||||
zip.closeEntry();
|
||||
if (f.canRead()) {
|
||||
if(f.isDirectory()) {
|
||||
zip.putNextEntry(new ZipEntry(path+f.getName()+'/'));
|
||||
zip.closeEntry();
|
||||
for( File child : f.listFiles() )
|
||||
scan(child,zip,path+f.getName()+'/');
|
||||
} else {
|
||||
zip.putNextEntry(new ZipEntry(path+f.getName()));
|
||||
FileInputStream in = new FileInputStream(f);
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
zip.write(buf,0,len);
|
||||
in.close();
|
||||
zip.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,13 +260,16 @@ public final class FilePath implements Serializable {
|
||||
ZipOutputStream zip = new ZipOutputStream(out);
|
||||
zip.setEncoding(System.getProperty("file.encoding"));
|
||||
for( String entry : glob(dir,glob) ) {
|
||||
zip.putNextEntry(new ZipEntry(dir.getName()+'/'+entry));
|
||||
FileInputStream in = new FileInputStream(new File(dir,entry));
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
zip.write(buf,0,len);
|
||||
in.close();
|
||||
zip.closeEntry();
|
||||
File file = new File(dir,entry);
|
||||
if (file.canRead()) {
|
||||
zip.putNextEntry(new ZipEntry(dir.getName()+'/'+entry));
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
zip.write(buf,0,len);
|
||||
in.close();
|
||||
zip.closeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
zip.close();
|
||||
|
||||
Reference in new issue
Block a user