EMMA Coverage Report (generated Fri Jun 19 09:16:10 CEST 2009)
[all classes][org.ktc.rbutils.api.file]

COVERAGE SUMMARY FOR SOURCE FILE [NotRootParentOfFileException.java]

nameclass, %method, %block, %line, %
NotRootParentOfFileException.java100% (1/1)100% (2/2)100% (38/38)100% (11/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NotRootParentOfFileException100% (1/1)100% (2/2)100% (38/38)100% (11/11)
NotRootParentOfFileException (File, File): void 100% (1/1)100% (9/9)100% (4/4)
getMessage (): String 100% (1/1)100% (29/29)100% (7/7)

1/*
2 * Copyright  2005-2006 The RbUtils Project
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 *
16 */
17 
18// $Id: NotRootParentOfFileException.java,v 1.1 2006/08/24 21:32:39 redfish Exp $
19 
20package org.ktc.rbutils.api.file;
21 
22import java.io.File;
23 
24/**
25 * Exception thrown when a <code>File</code> is not parent of another one.
26 * @since RbUtils 0.7.5
27 * @version $Revision: 1.1 $
28 * @author redfish
29 */
30public class NotRootParentOfFileException extends IllegalArgumentException {
31    /** Root directory. */
32    private File root;
33    /** <code>File</code> which is not in the root. */
34    private File file;
35 
36    /** Automaticly generated. */
37    private static final long serialVersionUID = -8732328571283186889L;
38 
39    /**
40     * Instanciates a new <code>NotRootParentOfFileException</code>.
41     * @param root <code>File</code> which is supposed to be parent of file.
42     * @param file <code>File</code> which is not in root.
43     */
44    public NotRootParentOfFileException(final File root, final File file) {
45        this.root = root;
46        this.file = file;
47    }
48 
49    /**
50     * {@inheritDoc}
51     */
52    public String getMessage() {
53        // RFE a localiser
54        String rootPath = null;
55        String filePath = null;
56        if (root != null) {
57            rootPath = root.getAbsolutePath();
58        }
59        if (file != null) {
60            filePath = file.getAbsolutePath();
61        }
62 
63        return filePath + " is not in " + rootPath;
64    }
65 
66}

[all classes][org.ktc.rbutils.api.file]
EMMA 2.0.5312 (C) Vladimir Roubtsov