Mike
Mike

Reputation: 1899

Java lang Assertion Error

I am facing this error while running my java application using Java Web Start. Although Application is running perfectly fine in eclipse and application is being loaded properly in Java web start as well. The code is trying to open a file chooser but unable to do that.

Exception in thread "AWT-EventQueue-0" java.lang.AssertionError
    at sun.awt.shell.Win32ShellFolder2$4.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$4.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
    at sun.awt.shell.ShellFolder.invoke(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.access$200(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$2.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$2.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
    at sun.awt.shell.ShellFolder.invoke(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2.<init>(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2.createShellFolderFromRelativePIDL(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$11.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$11.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Upvotes: 0

Views: 2993

Answers (2)

Robin
Robin

Reputation: 36611

Take a look at the source code of that class. There are only 2 assert statements, and they occur both in an anonymous class. So they match perfectly with your stack trace

assert(isDirectory());
assert(parent != null);

Instead of disabling these assertions, just check why those conditions are not met and fix that.

Upvotes: 2

Mike
Mike

Reputation: 1899

Ok So I just found the Answer to my own question. I have disabled the assertion in JNLP file and code started working perfectly fine.

I have changed

<j2se version="1.5+" java-vm-args="-esa -Xnoclassgc"/>

to

<j2se version="1.5+" java-vm-args="-dsa -Xnoclassgc"/>

Hope this will help others as well.

Upvotes: 2

Related Questions