从具有Applet的页面注销后出现空指针异常

时间:2014-02-18 08:57:28

标签: java applet

我们有一个用户看到登录页面的应用程序,登录后他被重定向到有applet的页面。整个应用程序在applet中运行。小程序有摆动组件。现在问题是当用户退出应用程序时,间歇性地他在登录页面上看到异常。

是个例外
java.lang.NullPointerException
                at com.sun.deploy.cache.Cache.clobber(Unknown Source)
                at com.sun.deploy.cache.Cache.removeCacheEntryImpl(Unknown Source)
                at com.sun.deploy.cache.Cache.access$100(Unknown Source)
                at com.sun.deploy.cache.Cache$4.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at com.sun.deploy.cache.Cache.removeCacheEntry(Unknown Source)
                at com.sun.deploy.cache.Cache.removeCacheEntry(Unknown Source)
                at com.sun.deploy.cache.Cache.removeAllCacheEntries(Unknown Source)
                at com.sun.javaws.CacheUtil.removeEntries(Unknown Source)
                at com.sun.javaws.CacheUtil.remove(Unknown Source)
                at com.sun.javaws.CacheUtil.remove(Unknown Source)
                at com.sun.javaws.CacheUtil.remove(Unknown Source)
                at com.sun.javaws.Main.uninstallAll(Unknown Source)
                at com.sun.javaws.Main.uninstall(Unknown Source)
                at com.sun.javaws.Main.uninstallCache(Unknown Source)
                at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
                at com.sun.javaws.Main$1.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)

这是java弹出的enter image description here

-----------------------------------------代码部分--- -------------------------------

当applet加载时,我正在使用命令

制作批处理文件

START /B javaws -uninstall

当调用applet的destroy方法

时,将在单独的进程中调用此批处理文件
@Override
    public void destroy() {

        AccessController.doPrivileged(new PrivilegedAction() {
            @Override
            public Object run() {

String OSType = System.getProperty("os.name");
                if ( OSType.contains("Windows") || OSType.contains("windows")){
                    final ProcessBuilder builder = new ProcessBuilder(batchFile.getAbsolutePath());
                    builder.redirectErrorStream(true);
                    builder.directory(batchFile.getParentFile());
                    try {
                        builder.start();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }                   
                }else{
                    if(shellFile.exists()){
                        Process process = Runtime.getRuntime().exec(shellFile.getAbsolutePath()+" &");
                        //in case if any error occurs , lets print the error stream
                        BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                        String line = stdError.readLine();
                        while(line != null){
                            System.out.println(line);
                            line = stdError.readLine();
                        }                           
                    }
                }
}
}

0 个答案:

没有答案