KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > logging > impl > MyPrivilegedAction


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.logging.impl;
7
8 import java.security.PrivilegedAction JavaDoc;
9
10 /**
11  * This used to be an anonymous class in LogFactoryImpl but it
12  * was causing bizarre compilation failures in JDK1.2.
13  *
14  * @version $Revision: 1.3 $, $Date: 2003/03/03 11:11:55 $
15  * @author bill
16  * @author $Author: billhorsman $ (current maintainer)
17  * @since Proxool 0.7
18  */

19 public class MyPrivilegedAction implements PrivilegedAction JavaDoc {
20
21     private ClassLoader JavaDoc threadCL;
22
23     private String JavaDoc name;
24
25     public MyPrivilegedAction(ClassLoader JavaDoc threadCL, String JavaDoc name) {
26         this.threadCL = threadCL;
27         this.name = name;
28     }
29
30     public Object JavaDoc run() {
31         if (threadCL != null) {
32             try {
33                 return threadCL.loadClass(name);
34             } catch (ClassNotFoundException JavaDoc ex) {
35                 // ignore
36
}
37         }
38         try {
39             return Class.forName(name);
40         } catch (ClassNotFoundException JavaDoc e) {
41             return e;
42         }
43     }
44
45 }
46
47
48 /*
49  Revision history:
50  $Log: MyPrivilegedAction.java,v $
51  Revision 1.3 2003/03/03 11:11:55 billhorsman
52  fixed licence
53
54  Revision 1.2 2003/02/10 15:49:23 billhorsman
55  extracted anonymous PrivilegedAction class to fix
56  bizarre compilation problem with jdk1.2
57
58  */
Popular Tags