~ubuntu-branches/ubuntu/raring/libjboss-remoting-java/raring

« back to all changes in this revision

Viewing changes to src/tests/org/jboss/test/security/LoggingSecurityManager.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jboss.test.security;
 
2
 
 
3
import java.security.Permission;
 
4
import java.io.FileDescriptor;
 
5
import java.net.InetAddress;
 
6
 
 
7
/**
 
8
 *
 
9
 */
 
10
public final class LoggingSecurityManager extends SecurityManager {
 
11
 
 
12
    public LoggingSecurityManager() {
 
13
    }
 
14
 
 
15
    private static SecurityException logged(SecurityException se) {
 
16
        se.printStackTrace(System.err);
 
17
        return se;
 
18
    }
 
19
 
 
20
    public void checkPermission(final Permission perm) {
 
21
        try {
 
22
            super.checkPermission(perm);
 
23
        } catch (SecurityException se) {
 
24
            throw logged(se);
 
25
        }
 
26
    }
 
27
 
 
28
    public void checkPermission(final Permission perm, final Object context) {
 
29
        try {
 
30
            super.checkPermission(perm, context);
 
31
        } catch (SecurityException se) {
 
32
            throw logged(se);
 
33
        }
 
34
    }
 
35
 
 
36
    public void checkCreateClassLoader() {
 
37
        try {
 
38
            super.checkCreateClassLoader();
 
39
        } catch (SecurityException se) {
 
40
            throw logged(se);
 
41
        }
 
42
    }
 
43
 
 
44
    public void checkAccess(final Thread t) {
 
45
        try {
 
46
            super.checkAccess(t);
 
47
        } catch (SecurityException se) {
 
48
            throw logged(se);
 
49
        }
 
50
    }
 
51
 
 
52
    public void checkAccess(final ThreadGroup g) {
 
53
        try {
 
54
            super.checkAccess(g);
 
55
        } catch (SecurityException se) {
 
56
            throw logged(se);
 
57
        }
 
58
    }
 
59
 
 
60
    public void checkExit(final int status) {
 
61
        try {
 
62
            super.checkExit(status);
 
63
        } catch (SecurityException se) {
 
64
            throw logged(se);
 
65
        }
 
66
    }
 
67
 
 
68
    public void checkExec(final String cmd) {
 
69
        try {
 
70
            super.checkExec(cmd);
 
71
        } catch (SecurityException se) {
 
72
            throw logged(se);
 
73
        }
 
74
    }
 
75
 
 
76
    public void checkLink(final String lib) {
 
77
        try {
 
78
            super.checkLink(lib);
 
79
        } catch (SecurityException se) {
 
80
            throw logged(se);
 
81
        }
 
82
    }
 
83
 
 
84
    public void checkRead(final FileDescriptor fd) {
 
85
        try {
 
86
            super.checkRead(fd);
 
87
        } catch (SecurityException se) {
 
88
            throw logged(se);
 
89
        }
 
90
    }
 
91
 
 
92
    public void checkRead(final String file) {
 
93
        try {
 
94
            super.checkRead(file);
 
95
        } catch (SecurityException se) {
 
96
            throw logged(se);
 
97
        }
 
98
    }
 
99
 
 
100
    public void checkRead(final String file, final Object context) {
 
101
        try {
 
102
            super.checkRead(file, context);
 
103
        } catch (SecurityException se) {
 
104
            throw logged(se);
 
105
        }
 
106
    }
 
107
 
 
108
    public void checkWrite(final FileDescriptor fd) {
 
109
        try {
 
110
            super.checkWrite(fd);
 
111
        } catch (SecurityException se) {
 
112
            throw logged(se);
 
113
        }
 
114
    }
 
115
 
 
116
    public void checkWrite(final String file) {
 
117
        try {
 
118
            super.checkWrite(file);
 
119
        } catch (SecurityException se) {
 
120
            throw logged(se);
 
121
        }
 
122
    }
 
123
 
 
124
    public void checkDelete(final String file) {
 
125
        try {
 
126
            super.checkDelete(file);
 
127
        } catch (SecurityException se) {
 
128
            throw logged(se);
 
129
        }
 
130
    }
 
131
 
 
132
    public void checkConnect(final String host, final int port) {
 
133
        try {
 
134
            super.checkConnect(host, port);
 
135
        } catch (SecurityException se) {
 
136
            throw logged(se);
 
137
        }
 
138
    }
 
139
 
 
140
    public void checkConnect(final String host, final int port, final Object context) {
 
141
        try {
 
142
            super.checkConnect(host, port, context);
 
143
        } catch (SecurityException se) {
 
144
            throw logged(se);
 
145
        }
 
146
    }
 
147
 
 
148
    public void checkListen(final int port) {
 
149
        try {
 
150
            super.checkListen(port);
 
151
        } catch (SecurityException se) {
 
152
            throw logged(se);
 
153
        }
 
154
    }
 
155
 
 
156
    public void checkAccept(final String host, final int port) {
 
157
        try {
 
158
            super.checkAccept(host, port);
 
159
        } catch (SecurityException se) {
 
160
            throw logged(se);
 
161
        }
 
162
    }
 
163
 
 
164
    public void checkMulticast(final InetAddress maddr) {
 
165
        try {
 
166
            super.checkMulticast(maddr);
 
167
        } catch (SecurityException se) {
 
168
            throw logged(se);
 
169
        }
 
170
    }
 
171
 
 
172
    /** @noinspection deprecation*/
 
173
    public void checkMulticast(final InetAddress maddr, final byte ttl) {
 
174
        try {
 
175
            super.checkMulticast(maddr, ttl);
 
176
        } catch (SecurityException se) {
 
177
            throw logged(se);
 
178
        }
 
179
    }
 
180
 
 
181
    public void checkPropertiesAccess() {
 
182
        try {
 
183
            super.checkPropertiesAccess();
 
184
        } catch (SecurityException se) {
 
185
            throw logged(se);
 
186
        }
 
187
    }
 
188
 
 
189
    public void checkPropertyAccess(final String key) {
 
190
        try {
 
191
            super.checkPropertyAccess(key);
 
192
        } catch (SecurityException se) {
 
193
            throw logged(se);
 
194
        }
 
195
    }
 
196
 
 
197
    public boolean checkTopLevelWindow(final Object window) {
 
198
        try {
 
199
            return super.checkTopLevelWindow(window);
 
200
        } catch (SecurityException se) {
 
201
            throw logged(se);
 
202
        }
 
203
    }
 
204
 
 
205
    public void checkPrintJobAccess() {
 
206
        try {
 
207
            super.checkPrintJobAccess();
 
208
        } catch (SecurityException se) {
 
209
            throw logged(se);
 
210
        }
 
211
    }
 
212
 
 
213
    public void checkSystemClipboardAccess() {
 
214
        try {
 
215
            super.checkSystemClipboardAccess();
 
216
        } catch (SecurityException se) {
 
217
            throw logged(se);
 
218
        }
 
219
    }
 
220
 
 
221
    public void checkAwtEventQueueAccess() {
 
222
        try {
 
223
            super.checkAwtEventQueueAccess();
 
224
        } catch (SecurityException se) {
 
225
            throw logged(se);
 
226
        }
 
227
    }
 
228
 
 
229
    public void checkPackageAccess(final String pkg) {
 
230
        try {
 
231
            super.checkPackageAccess(pkg);
 
232
        } catch (SecurityException se) {
 
233
            throw logged(se);
 
234
        }
 
235
    }
 
236
 
 
237
    public void checkPackageDefinition(final String pkg) {
 
238
        try {
 
239
            super.checkPackageDefinition(pkg);
 
240
        } catch (SecurityException se) {
 
241
            throw logged(se);
 
242
        }
 
243
    }
 
244
 
 
245
    public void checkSetFactory() {
 
246
        try {
 
247
            super.checkSetFactory();
 
248
        } catch (SecurityException se) {
 
249
            throw logged(se);
 
250
        }
 
251
    }
 
252
 
 
253
    public void checkMemberAccess(final Class clazz, final int which) {
 
254
        try {
 
255
            super.checkMemberAccess(clazz, which);
 
256
        } catch (SecurityException se) {
 
257
            throw logged(se);
 
258
        }
 
259
    }
 
260
 
 
261
    public void checkSecurityAccess(final String target) {
 
262
        try {
 
263
            super.checkSecurityAccess(target);
 
264
        } catch (SecurityException se) {
 
265
            throw logged(se);
 
266
        }
 
267
    }
 
268
}