# Coverage details for com.martiansoftware.nailgun.NGSecurityManager

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | ``
3 |  | `Copyright 2004, Martian Software, Inc.`
4 |  | ``
5 |  | `Licensed under the Apache License, Version 2.0 (the "License");`
6 |  | `you may not use this file except in compliance with the License.`
7 |  | `You may obtain a copy of the License at`
8 |  | ``
9 |  | `http://www.apache.org/licenses/LICENSE-2.0`
10 |  | ``
11 |  | `Unless required by applicable law or agreed to in writing, software`
12 |  | `distributed under the License is distributed on an "AS IS" BASIS,`
13 |  | `WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.`
14 |  | `See the License for the specific language governing permissions and`
15 |  | `limitations under the License.`
16 |  | ``
17 |  | `*/`
18 |  | ``
19 |  | `package com.martiansoftware.nailgun;`
20 |  | ``
21 |  | `import java.security.Permission;`
22 |  | ``
23 |  | `import java.io.PrintStream;`
24 |  | ``
25 |  | `/**`
26 |  | `* Security manager which does nothing other than trap`
27 |  | `* checkExit, or delegate all non-deprecated methods to`
28 |  | `* a base manager.`
29 |  | `*`
30 |  | `* @author Pete Kirkham`
31 |  | `*`
32 |  | `*/`
33 |  | `public class NGSecurityManager extends SecurityManager {`
34 | 0 | `private static final ThreadLocal EXIT = new InheritableThreadLocal();`
35 |  | `final SecurityManager base;`
36 |  | ``
37 |  | `/**`
38 |  | `* Construct an NGSecurityManager with the given base.`
39 |  | `* @param base the base security manager, or null for no base.`
40 |  | `*/`
41 | 0 | `public NGSecurityManager (SecurityManager base) {`
42 | 0 | `this.base = base;`
43 | 0 | `}`
44 |  | ``
45 |  | `public void checkExit (int status) {`
46 | 0 | `if (base != null) {`
47 | 0 | `base.checkExit(status);`
48 |  | `}`
49 |  | ``
50 | 0 | `final PrintStream exit = (PrintStream)EXIT.get();`
51 |  | ``
52 | 0 | `if (exit != null) {`
53 | 0 | `exit.println(status);`
54 |  | `}`
55 |  | ``
56 | 0 | `throw new NGExitException(status);`
57 |  | `}`
58 |  | ``
59 |  | `public void checkPermission(Permission perm) {`
60 | 0 | `if (base != null) {`
61 | 0 | `base.checkPermission(perm);`
62 |  | `}`
63 | 0 | `}`
64 |  | ``
65 |  | `public void checkPermission(Permission perm, Object context) {`
66 | 0 | `if (base != null) {`
67 | 0 | `base.checkPermission(perm, context);`
68 |  | `}`
69 | 0 | `}`
70 |  | ``
71 |  | `public static void setExit (PrintStream exit) {`
72 | 0 | `EXIT.set(exit);`
73 | 0 | `}`
74 |  | `}`

this report was generated by version 1.0.5 of jcoverage. visit www.jcoverage.com for updates. | copyright © 2003, jcoverage ltd. all rights reserved. Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.