EMMA Coverage Report (generated Mon Oct 04 21:03:19 MDT 2004)
[all classes][biz.xsoftware.buildtemplate.test]

COVERAGE SUMMARY FOR SOURCE FILE [Util.java]

nameclass, %method, %block, %line, %
Util.java100% (1/1)100% (4/4)80%  (130/162)80%  (20.8/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Util100% (1/1)100% (4/4)80%  (130/162)80%  (20.8/26)
removeDir (File): boolean 100% (1/1)76%  (96/127)74%  (14.9/20)
<static initializer> 100% (1/1)92%  (11/12)92%  (0.9/1)
Util (): void 100% (1/1)100% (3/3)100% (1/1)
getAvailableFileName (File, String): String 100% (1/1)100% (20/20)100% (4/4)

1/*
2 * Created on Sep 13, 2004
3 *
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
6 */
7package biz.xsoftware.buildtemplate.test;
8 
9import java.io.File;
10import java.io.IOException;
11import java.util.logging.Logger;
12 
13/**
14 * @author Dean Hiller
15 *
16 * TODO To change the template for this generated type comment go to
17 * Window - Preferences - Java - Code Style - Code Templates
18 */
19public class Util {
20 
21        public final static Logger log = Logger.getLogger(Util.class.getName());
22        
23    public static boolean removeDir(File d) {
24                log.finest("starting("+d.getAbsolutePath()+")");
25 
26        String[] list = d.list();
27        if (list == null) list = new String[0];
28                log.finest("numFiles in directory=" + list.length);
29        for (int i = 0; i < list.length; i++) 
30                {
31            String s = list[i];
32            File f = new File(d, s);
33            if (f.isDirectory()) 
34                        {
35                                if(!removeDir(f))
36                                        return false;
37            }
38                        else 
39                        {
40                                log.finest("remove file="+f.getAbsolutePath());
41                if (!f.delete()) 
42                                {
43                                        log.finest("FAILED because file " + f.getAbsolutePath());
44                                        return false;
45                                }
46            }
47        }
48                log.finest("remove directory="+d.getAbsolutePath());
49        if (!d.delete())
50                {
51                        log.finest("FAILED because directory " + d.getAbsolutePath());
52                        return false;
53                }
54                log.finest("succeeded("+d.getAbsolutePath()+")");
55                return true;
56    }
57    
58    public static String getAvailableFileName(File directory, String prefix) throws IOException {
59                File temp = File.createTempFile(prefix+"-", "", directory);
60                String path = temp.getAbsolutePath();
61                temp.delete();
62                return path;
63    }
64 
65}

[all classes][biz.xsoftware.buildtemplate.test]
EMMA 2.0.4217 (C) Vladimir Roubtsov