Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160326

Char value is returned as integer, not as character

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: javafx
    • Labels:
    • Subcomponent:
      web
    • Resolved In Build:
      master

      Backports

        Description

         
        import javafx.scene.Scene;
        import javafx.scene.layout.StackPane;
        import javafx.scene.web.WebEngine;
        import javafx.scene.web.WebView;
        import javafx.stage.Stage;
        import netscape.javascript.JSObject;

        public class CharBindingFailure extends Application {
            public char c = 'm';
            public char doChar(char c) {
                return c;
            }
            @Override
            public void start(Stage stage) throws Exception {
                WebView view = new WebView();
                WebEngine engine = view.getEngine();
                stage.setScene(new Scene(new StackPane(view), 320, 240));
                stage.setOnShown((e) -> {
                    JSObject window = (JSObject) engine.executeScript("window;");
                    window.setMember("testObject", this);
                    window.setMember("testValue", 'a');
                    Object resultObject = engine.executeScript("testValue");
                    System.out.println(resultObject instanceof Character);
                    resultObject = engine.executeScript("testObject.doChar(testValue)");
                    System.out.println(resultObject instanceof Character);
                    resultObject = engine.executeScript("testObject.doChar('n')");
                    System.out.println(resultObject instanceof Character);
                    resultObject = engine.executeScript("testObject.c = 'hello world';");
                    System.out.println(resultObject instanceof String);
                    resultObject = engine.executeScript("testObject.c;");
                    System.out.println(resultObject instanceof Character);
                });
                stage.show();
            }
            public static void main(String[] args) {
                launch(args);
            }
        }

        Above code should print "true" all cases.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  arajkumar Arunprasad Rajkumar
                  Reporter:
                  arajkumar Arunprasad Rajkumar
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: