8

I've been experiencing this strange issue for a while now. I'm making a JavaFX application which has a login screen.

The issue is that whenever I press enter after putting in the username and password, I encounter the following fatal error. It works fine if I use the Login button.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007efc4bf78948, pid=7213, tid=139620596950784
#
# JRE version: Java(TM) SE Runtime Environment (8.0_91-b14) (build 1.8.0_91-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.91-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x6cf948]  jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x38
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

Full error log here.

Following are the action listeners for username field and password field which detect ENTER key press:

fieldUsername.setOnKeyPressed((KeyEvent event) -> {
    if (event.getCode() == KeyCode.ENTER) {
        KeyEvent.fireEvent(buttonLogin, new MouseEvent(MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, MouseButton.PRIMARY, 1, true, true, true, true, true, true, true, true, true, true, null));
    }
});

fieldPassword.setOnKeyPressed((KeyEvent event) -> {
    if (event.getCode() == KeyCode.ENTER) {
        KeyEvent.fireEvent(buttonLogin, new MouseEvent(MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, MouseButton.PRIMARY, 1, true, true, true, true, true, true, true, true, true, true, null));
    }
});

I'm firing the login button whenever I encounter an ENTER key press.

And following is the action listener for buttonLogin:

buttonLogin.setOnMouseClicked((MouseEvent event) -> {
    CheckLoginAndPin c1 = new CheckLoginAndPin();
    if (!fieldUsername.getText().isEmpty() && !fieldPassword.getText().isEmpty()) {
        if (c1.checkUsername(fieldUsername.getText())) {
            if (c1.login(fieldUsername.getText(), fieldPassword.getText())) {
                ArrayList<String> arrayListGetUserDetails = c1.getPriviledge(fieldUsername.getText());
                stageLogin.close();
                MainFrame mainFrame = new MainFrame(arrayListGetUserDetails.get(0), arrayListGetUserDetails.get(1), arrayListGetUserDetails.get(2), fieldUsername.getText());
            } else {
                PopupErrorMessage popupErrorMessage = new PopupErrorMessage(stageLogin, "Password incorrect", fieldPassword, 100, 60);
            }
        } else {
            PopupErrorMessage popupErrorMessage = new PopupErrorMessage(stageLogin, "User name incorrect", fieldUsername, 100, 60);
        }
    } else {
        if (fieldUsername.getText().isEmpty() && !fieldPassword.getText().isEmpty()) {
            PopupErrorMessage popupErrorMessage = new PopupErrorMessage(stageLogin, "User name can not be empty", fieldUsername, 100, 60);
        } else if (fieldPassword.getText().isEmpty() && !fieldUsername.getText().isEmpty()) {
            PopupErrorMessage popupErrorMessage = new PopupErrorMessage(stageLogin, "Password can not be empty", fieldPassword, 100, 60);
        } else if (fieldUsername.getText().isEmpty() && fieldPassword.getText().isEmpty()) {
            PopupErrorMessage popupErrorMessage = new PopupErrorMessage(stageLogin, "User name & password can not be empty", fieldUsername, 100, 60);
        }
    }
});

JDK - Oracle Java 8 Update 91
OS - Ubuntu 16.04 LTS 64-bit
IDE - Netbeans IDE 8.0.2

What am I doing wrong here?

UrsinusTheStrong
  • 1,239
  • 1
  • 16
  • 33
  • @MrD Oh sorry. Yes. Added it in the question. – UrsinusTheStrong May 29 '16 at 07:02
  • You might want to check [this](http://stackoverflow.com/questions/28982396/failed-to-write-core-dump-core-dumps-have-been-disabled) out. Are you using [eclipse](http://stackoverflow.com/questions/19332489/how-to-fix-failed-to-write-core-dump-core-dumps-have-been-disabled-error-whil)? – 0x6C38 May 29 '16 at 07:03
  • @MrD Dude, I answered that. Increasing the size of the core dump won't solve this issue. – UrsinusTheStrong May 29 '16 at 07:05
  • 2
    *"/usr/lib/jvm/java-8-oracle"* sounds like a binary blob from oracle, which aiui has some differences to openjdk builds. Have you tried a jre compiled by your distro's maintainers? – the8472 May 29 '16 at 10:47
  • Now that I notice, It isn't using OpenJDK 8. I've two JDKs installed. Let me check. – UrsinusTheStrong May 29 '16 at 10:48
  • 3
    The native stack looks similar to [JDK-8087368](https://bugs.openjdk.java.net/browse/JDK-8087368) and the submitted testcase seems unreliable. If yours reproduces 100% that might help them with fixing. – the8472 May 29 '16 at 10:59
  • Ok, I'll check with OpenJDK then. Thanks for pointing it out. – UrsinusTheStrong May 29 '16 at 11:00
  • Unable to run it with OpenJDK. Giving an error "Unable to locate Login.Login" (My Main class). Also, Netbeans not recognizing OpenJDK after adding OpenJDK through platform manager. Also, OpenJDK lacks source packages. – UrsinusTheStrong May 29 '16 at 11:23
  • @the8472 After, some tinkering, I was able to change the JDK of the project to OpenJDK. I still wasn't able to run it because there are no JavaFX sources in case of OpenJDK like that in Oracle JDK. – UrsinusTheStrong May 29 '16 at 12:24
  • Wild stab in the dark, but JDK 8 u91 is pretty old. Maybe try it on the latest available, update u171, and see if someone fixed the problem since u91. You never know... – Speakjava Jun 14 '18 at 16:59

0 Answers0