-
Bug
-
Resolution: Duplicate
-
P4
-
7u6
-
Mac OS X 10.8.2, JDK 1.7.0_10, JavaFX 2.2
I created a native Mac OS X DMG file using the "javafxpackager" command (Version 2.2 from Oracle JDK 1.7.0_10 on Mac OS X 10.8.2). Everything runs fine until I try to open an SSL connection. The connection fails with "RSA premaster secret error". Is there something missing in the bundled JRE?
Steps to reproduce:
----------------------------------------
(1) TLSTest.java
----------------------------------------
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class TLSTest extends Application {
@Override
public void start(Stage primaryStage) {
final TextField textField = new TextField("https://login.oracle.com");
final Label label = new Label();
Button btn = new Button();
btn.setText("Open HTTPS connection");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String urlString = textField.getText();
if ( urlString.startsWith("http")) {
label.setText("Connecting");
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
e.printStackTrace();
}
URLConnection conn = null;
try {
conn = url.openConnection();
conn.connect();
} catch (IOException e2) {
e2.printStackTrace();
label.setText(e2.getMessage());
return;
}
label.setText("OK");
} else {
System.out.println("Missing argument");
}
}
});
FlowPane root = new FlowPane();
root.getChildren().addAll(textField, btn, label);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
----------------------------------------
----------------------------------------
(2) Create JAR Ant task
----------------------------------------
<target name="TLSTEST">
<fx:jar destfile="TLSTest.jar">
<fx:application name="TLS Test" mainClass="TLSTest"/>
<fileset dir="TLSTest\bin">
</fileset>
<manifest>
<attribute name="Class-Path" value=""/>
</manifest>
</fx:jar>
</target>
----------------------------------------
(3) On Mac: Run JAR with "java -jar"
Result: The connection can be opened (Label shows "OK")
----------------------------------------
----------------------------------------
(4) On Mac: Create DMG using "javafxpackager"
----------------------------------------
# javafxpackager -deploy -native dmg -srcdir in -outdir out -outfile TLSTest.dmg -v -appclass TLSTest -name "TLSTest"
----------------------------------------
(5) On Mac: Run app via DMG
----------------------------------------
# open TLSTest.dmg
-> Click the button
Result: The connection cannot be opened, error message "RSA premaster secret error"
Steps to reproduce:
----------------------------------------
(1) TLSTest.java
----------------------------------------
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class TLSTest extends Application {
@Override
public void start(Stage primaryStage) {
final TextField textField = new TextField("https://login.oracle.com");
final Label label = new Label();
Button btn = new Button();
btn.setText("Open HTTPS connection");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String urlString = textField.getText();
if ( urlString.startsWith("http")) {
label.setText("Connecting");
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
e.printStackTrace();
}
URLConnection conn = null;
try {
conn = url.openConnection();
conn.connect();
} catch (IOException e2) {
e2.printStackTrace();
label.setText(e2.getMessage());
return;
}
label.setText("OK");
} else {
System.out.println("Missing argument");
}
}
});
FlowPane root = new FlowPane();
root.getChildren().addAll(textField, btn, label);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
----------------------------------------
----------------------------------------
(2) Create JAR Ant task
----------------------------------------
<target name="TLSTEST">
<fx:jar destfile="TLSTest.jar">
<fx:application name="TLS Test" mainClass="TLSTest"/>
<fileset dir="TLSTest\bin">
</fileset>
<manifest>
<attribute name="Class-Path" value=""/>
</manifest>
</fx:jar>
</target>
----------------------------------------
(3) On Mac: Run JAR with "java -jar"
Result: The connection can be opened (Label shows "OK")
----------------------------------------
----------------------------------------
(4) On Mac: Create DMG using "javafxpackager"
----------------------------------------
# javafxpackager -deploy -native dmg -srcdir in -outdir out -outfile TLSTest.dmg -v -appclass TLSTest -name "TLSTest"
----------------------------------------
(5) On Mac: Run app via DMG
----------------------------------------
# open TLSTest.dmg
-> Click the button
Result: The connection cannot be opened, error message "RSA premaster secret error"