posts - 97,  comments - 93,  trackbacks - 0
出于java的安全限制,System.getProperty("line.seperator")是不能够直接取得的。可以这样做:
String lineSeparator = (String) java.security.AccessController.doPrivileged(
               
new sun.security.action.GetPropertyAction("line.separator"));
具体参考java.io.BufferedWriter的源代码就可以找到上面这行代码。 DriverManager里也有
 1     private static void loadInitialDrivers() {
 2         String drivers;
 3 
 4         try {
 5             drivers = (String) java.security.AccessController
 6                     .doPrivileged(new sun.security.action.GetPropertyAction(
 7                             "jdbc.drivers"));
 8         } catch (Exception ex) {
 9             drivers = null;
10         }
11         println("DriverManager.initialize: jdbc.drivers = " + drivers);
12         if (drivers == null) {
13             return;
14         }
15         while (drivers.length() != 0) {
16             int x = drivers.indexOf(':');
17             String driver;
18             if (x < 0) {
19                 driver = drivers;
20                 drivers = "";
21             } else {
22                 driver = drivers.substring(0, x);
23                 drivers = drivers.substring(x + 1);
24             }
25             if (driver.length() == 0) {
26                 continue;
27             }
28             try {
29                 println("DriverManager.Initialize: loading " + driver);
30                 Class.forName(driver, true, ClassLoader.getSystemClassLoader());
31             } catch (Exception ex) {
32                 println("DriverManager.Initialize: load failed: " + ex);
33             }
34         }
35     }
sun.security.action.GetPropertyAction() hasn't been publiced.actually and exactly,it's not be doced,which reflects that sun doesn't surport us to use these class or method which is lower class,usually, we use the classes api tells us is proier and maybe has called these undoc class  but usually for us ,it's not necessary.so in the program of us or even others ,we could and i think it's really better for us to neglect  them which u can find out in the jar file of rt.jar.

posted on 2007-04-11 16:35 wqwqwqwqwq 阅读(560) 评论(0)  编辑  收藏 所属分类: Simple Java

只有注册用户登录后才能发表评论。


网站导航:
 
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345




常用链接

留言簿(10)

随笔分类(95)

随笔档案(97)

文章档案(10)

相册

J2ME技术网站

java技术相关

mess

搜索

  •  

最新评论

阅读排行榜

校园梦网网络电话,中国最优秀的网络电话