NSEvent中的断言失败? [英] Assertion failure in NSEvent?
问题描述
感谢您花时间阅读本文。我是JavaFX的新手,在我的编译器中有一个奇怪的错误,我想要一些见解。
thanks for taking the time to read this. I'm fairly new to JavaFX and have a weird error in my compiler that I would like some insight on.
这是错误:
2018-09-13 19:09:36.387 java[8040:660455] unrecognized type is 4294967295
2018-09-13 19:09:36.387 java[8040:660455] *** Assertion failure in -[NSEvent _initWithCGEvent:eventRef:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1652/AppKit.subproj/NSEvent.m:1969
以下是我正在使用的代码:
这是一个名为 applicationSettings 的<.java文件
Here is the code I am working with: This is in a .java file named applicationSettings
public static double lookupUser(String name, String password) throws IOException {
InputStream inputStream = applicationSettings.class.getResourceAsStream("/files/users.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Integer lastRow = sheet.getPhysicalNumberOfRows();
int currentRow = 1;
while(currentRow < lastRow) {
if(sheet.getRow(currentRow).getCell(0).getStringCellValue().toLowerCase().equals(name.toLowerCase())) {
if(sheet.getRow(currentRow).getCell(1).getStringCellValue().toLowerCase().equals(password.toLowerCase())) {
double accessLevel = sheet.getRow(currentRow).getCell(2).getNumericCellValue();
System.out.println(accessLevel);
return accessLevel;
}
}
currentRow++;
}
return 4.0;
}
}
这是在.java文件中名为 loginScreen
This is in a .java file named loginScreen
EventHandler<ActionEvent> loginClicked = new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
double userFound = 0.0;
try {
userFound = applicationSettings.lookupUser(usernameField.getText(), passwordField.getText());
} catch (IOException e) {
e.printStackTrace();
}//END of Try/Catch
if(userFound == 1.0) { //1 is Admin Access
//TODO: Implement Login
System.out.println("Admin Login");
errorLabel.setVisible(false);
}else if(userFound == 2.0){ //2 is Elevated Access
//TODO: Elevated Access
System.out.println("Elevated Login");
errorLabel.setVisible(false);
}else if(userFound == 3.0){
//TODO: Basic Access
System.out.println("Basic Login");
errorLabel.setVisible(false);
}else{//Show Error
errorLabel.setVisible(true);
//TODO: Show Error
}//End If Statement
}
};
我的Excel文件基本上是这样的结构:
My Excel File is basically structured like this:
NAME PASSWORD ACCESS LEVEL
所以对于我的登录就像:
So for my login it would be like:
Trey Carey March3199; 1
除了自动执行一些繁琐的任务之外,它除了教堂以外什么都没做,所以安全性不是问题。
This isn't going anywhere besides by church where it's not really doing anything besides automating some tedious tasks, so security isn't an issue.
另外,无论如何我可以清理其中一些if语句和我的代码一般我会很感激任何提示或帮助!
Also, if there's anyway I can clean up some of these if statements and my code in general I would appreciate any tips or help!
推荐答案
编辑2 13.11.2018:
此错误已在JavaFX 12中正式修复,被移植到JDK8并被批准向后移植到JFX 11.您可以查看错误报告以查找有关它的更多信息。 JDK-8211304 以下是他们所做更改的链接。 openjfx 我个人不确定当前的情况JDK8的许可证情况所以我建议尽可能切换到最新的OpenJDK和OpenJFX。
Edit 2 13.11.2018: This bug has been officially fixed now in JavaFX 12, was backported to JDK8 and approved to be backported to JFX 11. You can have a look at the bug report to find more information about it.JDK-8211304 Here is a link to the changes they've made. openjfx I'm personally not sure about the current license situation of JDK8 so I would advise to switch to the newest OpenJDK and OpenJFX if possible.
嘿,我遇到了同样的问题,我可以不断重现它。我在macOS 10.14上的JavaFX上出现了这个问题。您只需使用按钮打开第二个阶段即可创建应用程序。如果你在第二个阶段调用stage.showAndWait()(可能与任何持有该线程的东西有关),然后在不同的应用程序之间切换焦点(我只是在我的JavaFX应用程序和Safari之间使用alt-tab),JavaFX应用程序崩溃了。也可在任何IDE中重现。
Hey there I'm experiencing the same issue you have and I can constantly reproduce it. The issue appears for me on JavaFX on macOS 10.14. You can simply create an application with a button that opens a second stage. If you invoke stage.showAndWait() (could be related to anything that holds the thread) on the second stage and then switch focus between different applications (I just alt-tab between my JavaFX app and Safari), the JavaFX Application crashes. Also reproducible in any IDE.
我实际上发现了一个关于OpenJDK / OpenJFX错误跟踪器的错误报告,但目前还没有太多进展。 JDK-8211137 Mac:因未捕获的异常导致JVM崩溃
I actually found a bug report on the OpenJDK/OpenJFX bug tracker but there isn't much going on at the moment. JDK-8211137 Mac: JVM Crash due to uncaught exception
我还没有解决方案,因为我遇到了确定问题的麻烦,但我找到了一个适用于我特定情况的解决方法。
I don't have a solution yet as I'm having troubles pinning down the exact problem but I found a workaround that works in my specific case.
编辑:
如果我正在使用stage.show()我只会收到错误,但在使用stage.showAndWait()或其他任何内容时它会进行某种等待循环,应用程序完全崩溃。
If I'm using "stage.show()" I'm only getting the error but when using stage.showAndWait() or anything that does some kind of waiting loop, the application completely crashes.
这篇关于NSEvent中的断言失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!