-
Type:
Bug
-
Resolution: Other
-
Priority:
P3
-
Affects Version/s: 7u21
-
Component/s: deploy
-
os_x
FULL PRODUCT VERSION :
Java Plug-in 10.21.2.12
Using JRE version 1.7.0_21-b12 Java HotSpot(TM) 64-Bit Server VM
User home directory = /Users/admin
ADDITIONAL OS VERSION INFORMATION :
Darwin MacBook-Pro.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
Safari Version 6.0.4 (8536.29.13)
Firefox 20.0
A DESCRIPTION OF THE PROBLEM :
This also happens on both Firefox and Safari on Mac.
We have a headless applet (an applet without UI component) that needs to access client file directory. So we use JFileChooser dialog for the user to choose a file or a directory. We found that in the latest release of java for Mac, if you simply open the dialog after closing it the first time (either by selecting a file or cancel the dialog), the Java seems to hang there forever. The mouse pointer turns into a spinner, and basically locks the whole browser.
From my java console, I can see that the applet does receive the call. But it doesn't go very far.
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an HTML file that has a button to invoke the javascript function included below. And compile the java snippet included below into a .class file. Create an <applet> tag to define the applet. Once everything is in a web server, click on the button to invoke the JFileChooser dialog. Cancel to close the dialog. Click on the button again, and now the browser is hung.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFileChooser should open again.
ACTUAL -
The browser hangs.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Here is the sample code for my program,
public String openFileChooserDialog() {
MyDialog me = new MyDialog();
me.setContainer(this);
String fileName = null;
try {
AccessController.doPrivileged(me);
fileName = me.getFileName();
System.out.println( " main: fileName is: " + fileName);
fileName = URLEncoder.encode(fileName, " UTF-8 " );
System.out.println( " main: encoded fileName is: " + fileName);
} catch (Throwable e) {
e.printStackTrace();
}
return fileName;
}
@SuppressWarnings( " rawtypes " )
public class MyDialog implements PrivilegedExceptionAction {
Applet container;
String fileName;
public String getFileName() {
System.out.println( " MyDialog: fileName is " + fileName);
return fileName;
}
@Override
public Object run() throws Exception {
try {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(true);
//fileChooser.setApproveButtonText(approveButtonText);
int returnVal = fileChooser.showOpenDialog(container);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File[] files = fileChooser.getSelectedFiles();
for (File f : files) {
System.out.println( " selected " + f.getAbsolutePath());
fileName = f.getAbsolutePath();
}
} else {
System.out.println( " User canceled the file chooser dialog. " ); //$NON-NLS-1$
}
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
And to invoke the applet, here is the javascript code,
function getSelectedFiles() {
var applet = document.WuJFileChooser;
var selectedFile = applet.openFileChooserDialog();
alert('selectedFile is:' + selectedFile);
var ret = applet.checkFileURLEncode(selectedFile);
alert('checkFileURLEncode ret is:' + ret);
}
---------- END SOURCE ----------
Java Plug-in 10.21.2.12
Using JRE version 1.7.0_21-b12 Java HotSpot(TM) 64-Bit Server VM
User home directory = /Users/admin
ADDITIONAL OS VERSION INFORMATION :
Darwin MacBook-Pro.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
Safari Version 6.0.4 (8536.29.13)
Firefox 20.0
A DESCRIPTION OF THE PROBLEM :
This also happens on both Firefox and Safari on Mac.
We have a headless applet (an applet without UI component) that needs to access client file directory. So we use JFileChooser dialog for the user to choose a file or a directory. We found that in the latest release of java for Mac, if you simply open the dialog after closing it the first time (either by selecting a file or cancel the dialog), the Java seems to hang there forever. The mouse pointer turns into a spinner, and basically locks the whole browser.
From my java console, I can see that the applet does receive the call. But it doesn't go very far.
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an HTML file that has a button to invoke the javascript function included below. And compile the java snippet included below into a .class file. Create an <applet> tag to define the applet. Once everything is in a web server, click on the button to invoke the JFileChooser dialog. Cancel to close the dialog. Click on the button again, and now the browser is hung.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFileChooser should open again.
ACTUAL -
The browser hangs.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Here is the sample code for my program,
public String openFileChooserDialog() {
MyDialog me = new MyDialog();
me.setContainer(this);
String fileName = null;
try {
AccessController.doPrivileged(me);
fileName = me.getFileName();
System.out.println( " main: fileName is: " + fileName);
fileName = URLEncoder.encode(fileName, " UTF-8 " );
System.out.println( " main: encoded fileName is: " + fileName);
} catch (Throwable e) {
e.printStackTrace();
}
return fileName;
}
@SuppressWarnings( " rawtypes " )
public class MyDialog implements PrivilegedExceptionAction {
Applet container;
String fileName;
public String getFileName() {
System.out.println( " MyDialog: fileName is " + fileName);
return fileName;
}
@Override
public Object run() throws Exception {
try {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(true);
//fileChooser.setApproveButtonText(approveButtonText);
int returnVal = fileChooser.showOpenDialog(container);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File[] files = fileChooser.getSelectedFiles();
for (File f : files) {
System.out.println( " selected " + f.getAbsolutePath());
fileName = f.getAbsolutePath();
}
} else {
System.out.println( " User canceled the file chooser dialog. " ); //$NON-NLS-1$
}
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
And to invoke the applet, here is the javascript code,
function getSelectedFiles() {
var applet = document.WuJFileChooser;
var selectedFile = applet.openFileChooserDialog();
alert('selectedFile is:' + selectedFile);
var ret = applet.checkFileURLEncode(selectedFile);
alert('checkFileURLEncode ret is:' + ret);
}
---------- END SOURCE ----------