This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I run tests in nbcvs:/refactoring/test/qa-functional, attribute 'move'. The 'testClass3' test is failing because of NPE: java.lang.NullPointerException org.netbeans.modules.javacore.JMManager.isElementGuarded(JMManager.java:450) org.netbeans.modules.refactoring.WhereUsedElement.<init>(WhereUsedElement.java:94) org.netbeans.modules.refactoring.RenameUsageElement.<init>(RenameUsageElement.java:27) org.netbeans.modules.refactoring.RenameFullNameElement.<init>(RenameFullNameElement.java:30) org.netbeans.modules.refactoring.api.MoveClassRefactoring.checkWhereUsed(MoveClassRefactoring.java:425) org.netbeans.modules.refactoring.api.MoveClassRefactoring.checkWhereUsed(MoveClassRefactoring.java:378) org.netbeans.modules.refactoring.api.MoveClassRefactoring.prepare(MoveClassRefactoring.java:196) org.netbeans.test.refactoring.move.SimpleTest.moveClass(SimpleTest.java:143) org.netbeans.test.refactoring.move.SimpleTest.testClass3(SimpleTest.java:86)
is this a regression or this was the first time you were running the test?
no, I forgot to create an issue for this. I see it there for about two weeks (since i created the tests).
I don't understand why this issue is P2. I tried to run this tests and 75% of them failing because of "Golden file differs". I cannot reproduce it. Our unit tests works, and this issue is not reproducible "by hand".
Yesterday, I run the test on 7 machines. Tests testClass3, testClass4 testClass5 failed in 50% by the reason of this exception. The next 50% of their failing were caused by javax.jmi.reflect.InvalidObjectException: Object with MOFID ... no longer exists.
Created attachment 16405 [details] The second exception's stacktrace.
I still cannot reproduce NPE. IOE is duplicate of issue 46208.
I've seen it again in several tests. Could you catch the NPE there and throw an exception with some debug information?
We must fix reproducible InvalidObjectException first.
I made a little research about this NPE. The NPE is thrown becauseof DataObject of resource (resource of checked element) is null. The bad resource points to bad location, to a file which was previously moved into default package: a/b/c/A.java was moved to A.java bud resource name still shows a/b/c/A.java
Cannot reproduce in latest build. Expected passes: 81, Unexpected fails: 15. 15 test failed due to AssertionFileFailedError: Golden file differs - no NPE.
Move class tests are randomly failing by this NPE or FileNotFound exception. I think the reason is a resource of a moved class remains unchanged to the next testrun - it produces the NPE - DataObject of this class is null or FNFE from tests - tests try to find source file of moved class by its resource name to compare.
What FileNotFound Exception? Anyway, please use this pattern for access java meta model. JavaMetamodel.getDefaultRepository().beginTrans(true); try { //do JMI stuff } finally { JavaMetamodel.getDefaultRepository().endTrans(); } Never call JMI outside transaction. You do that in your tests: try { Resource resource = (Resource) jc.refImmediateComposite(); //!!!JMI call outside transaction!!! FileObject targetFolder = URLMapper.findFileObject(new File(classPathWorkDir, newPackage.replace('.','/')).toURL()); Utility.prepareTest(); //!!!this should be called before try statement!!!
Thank you, i'll repair it and watch for future results.
Still cannot reproduce. Only one test failed probably due to issue 46669.
Emane, are you able to reproduce it?
I haven't seen it for days.
This issue is no more reproducible.
verified