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

CommonTest.testToBitTypeImgPlus throws NullPointerException #100

Closed
rimadoma opened this issue Jun 8, 2018 · 4 comments
Closed

CommonTest.testToBitTypeImgPlus throws NullPointerException #100

rimadoma opened this issue Jun 8, 2018 · 4 comments

Comments

@rimadoma
Copy link
Contributor

rimadoma commented Jun 8, 2018

The test throws a NullPointerException here. Ultimately the cause is that the field ij1Helper in net.imagej.legacy.LegacyService is null. However, the exception only happens if the test is run from Maven! When I run the test in IntelliJ, it passes.

Steps to reproduce

  • Depend on pom-scijava:21.0.0 or newer
    • Specifically, he problem appears at scijava-common:2.70.0
  • Depend on imagej-legacy (run time)
    • The issue doesn't appear if you don't have this dependency
  • Remove the @Ignore annotation from the aforementioned test if necessary
  • Run mvn test
@rimadoma rimadoma changed the title CommonTest. CommonTest.testToBitTypeImgPlus throws NullPointerException Jun 8, 2018
@rimadoma
Copy link
Contributor Author

rimadoma commented Jun 8, 2018

The issue has been reproduced in two environments with different versions of Maven and JVM. On my computer they are 3.3.9 and 1.8.0_172 respectively.

I was able to find the exact line by running mvn -Dmaven.surefire.debug test and then attaching the IntelliJ debugger to the process. Instructions for remote debugging here (use port: 5005).

rimadoma pushed a commit that referenced this issue Sep 7, 2018
Updating to pom-scijava:22.3.0 seems to have fixed the issue with the test method.
@rimadoma rimadoma closed this as completed Sep 7, 2018
@rimadoma
Copy link
Contributor Author

rimadoma commented Sep 7, 2018

Spoke too soon, issue still persisted (hence the broken build). I thought the problem had solved itself, because a Maven build succeeded on my local machine, when I ran mvn -PallTests test. Thus I decided to add @Category(org.bonej.wrapperPlugins.SlowWrapperTest.class) to CommonTest.testToBitTypeImgPlus. This way we don't have to ignore the problematic test all together.

As far as I can see, the test shouldn't need this annotation. I don't yet understand why it succeeds only when ran together with the SlowWrapperTests.

@rimadoma rimadoma reopened this Sep 7, 2018
@alessandrofelder
Copy link
Member

alessandrofelder commented Sep 13, 2018

@rimadoma I have had the same issue in some ElllipsoidFactorWrapper tests
adding the @Category tag as above also is a viable workaround for me

rimadoma added a commit that referenced this issue Feb 19, 2020
The workaround annotation for issue #100 doesn't seem to be necessary
any more.
@rimadoma
Copy link
Contributor Author

@alessandrofelder See if you can remove the annotations now too

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

No branches or pull requests

2 participants