Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fnlp-demo module #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Einsteinnnnn
Copy link

Description of the error that occurred:

While fixing the fnlp-core module of this project earlier, I noticed that the fnlp-demo module of the project reported an error when running a test of the whole project, i.e. using the code mvn test.
The error message is:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for fnlp-all 2.1-SNAPSHOT:
[INFO] 
[INFO] fnlp-core .......................................... SUCCESS [  5.516 s]
[INFO] fnlp-all ........................................... SUCCESS [  0.003 s]
[INFO] fnlp-dev ........................................... SUCCESS [  0.880 s]
[INFO] fnlp-train ......................................... SUCCESS [  0.975 s]
[INFO] fnlp-app ........................................... SUCCESS [  2.701 s]
[INFO] fnlp-demo .......................................... FAILURE [ 15.912 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  26.122 s
[INFO] Finished at: 2023-10-26T21:10:49-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project fnlp-demo: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]

After look through the error logs, I found out that there are 3 tests where the error occurs, they are:

SimpleClassifier2.java
HierClassifierUsage1.java
HierClassifierUsage2.java

All three tests would cause one same failure, this is:

[�[1;31mERROR�[m] Failed to execute goal �[32morg.apache.maven.plugins:maven-surefire-plugin:2.12.4:test�[m �[1m(default-test)�[m on project �[36mfnlp-demo�[m: �[1;31mExecution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?�[m -> �[1m[Help 1]�[m

And for the SimpleClassifier2.java, it not only have the above problem, it also has another failure:

java.lang.NullPointerException
	at org.fnlp.data.reader.SimpleFileReader.hasNext(SimpleFileReader.java:116)
	at org.fnlp.ml.types.InstanceSet.loadThruStagePipes(InstanceSet.java:214)
	at org.fnlp.demo.ml.HierClassifierUsage2.main(HierClassifierUsage2.java:70)

Reasons for the error and how to fix

First for the failure that all three tests all exist, it is because they used System.exit(0); at the end of the file.
Using System.exit() in a Java program immediately terminates the currently running Java Virtual Machine (JVM). This method is typically used in application-specific scenarios, such as situations where program execution needs to be stopped immediately. This leads to The forked VM terminated without saying properly goodbye. When we removed System.exit(0); from all three files, this problem was resolved immediately.

And next for the NullPointerException failure in the SimpleClassifier2.java file, the key goes to the SimpleFileReader.hasNext function. The original code didn't check if the reader is null or not, so it would cause a
NullPointerException if a reader is null. We just need to check if a reader is null at first to solve this problem.

How to reproduce the problem

Simply run 'mvn test', and there will be a failure occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant