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.

Bug 233532

Summary: java.lang.NullPointerException at org.netbeans.modules.j2ee.persistence.spi.jpql.TypeRepository.getType(TypeRepository.java:143)
Product: javaee Reporter: Martin Entlicher <mentlicher>
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED WONTFIX    
Severity: normal CC: bht
Priority: P4    
Version: 7.3   
Hardware: PC   
OS: Linux   
URL: https://netbeans.org/bugzilla/attachment.cgi?id=137876
Issue Type: DEFECT Exception Reporter:

Description Martin Entlicher 2013-07-27 09:45:48 UTC
Have a look at https://netbeans.org/bugzilla/attachment.cgi?id=137876
There are a lot of NPEs thrown from TypeRepository.getType(TypeRepository.java:143)
The log file was attached to issue #232670.
Comment 1 Sergey Petrov 2013-07-29 07:51:07 UTC
Is there a way to get jpql sample to reproduce these exceptions?
Also jpql parser is changed in 7.4 and it may not be reproducible but I need something to verify.
Comment 2 Sergey Petrov 2013-07-31 09:29:33 UTC
The exception is logged with info level and may not be severe, also there is no details and null check isn't good in my opinion and I don't see neither way to continue evaluation now nor a way for a good fix, keep open for now but as P4, 

bht.
please rice back to P3 after providing additional details. or if some else will provide more details.
Comment 3 mhankus 2014-01-10 14:26:21 UTC
It happens also on 7.4

INFO [org.netbeans.modules.j2ee.jpa.verification.JPAProblemFinder]: NPE in jpql validation: null
java.lang.NullPointerException
	at org.netbeans.modules.j2ee.persistence.spi.jpql.TypeRepository.getType(TypeRepository.java:143)
	at org.netbeans.modules.j2ee.persistence.spi.jpql.Mapping.getType(Mapping.java:88)
	at org.netbeans.modules.j2ee.persistence.spi.jpql.Mapping.getTypeDeclaration(Mapping.java:100)
	at org.eclipse.persistence.jpa.jpql.tools.resolver.CollectionValuedFieldResolver.resolveManagedType(CollectionValuedFieldResolver.java:79)
	at org.eclipse.persistence.jpa.jpql.tools.resolver.AbstractPathResolver.getManagedType(AbstractPathResolver.java:96)
...
...
[catch] at org.netbeans.modules.j2ee.jpa.verification.rules.entity.JPQLValidation.apply(JPQLValidation.java:112)
	at org.netbeans.modules.j2ee.jpa.verification.rules.entity.JPQLValidation.apply(JPQLValidation.java:81)
	at org.netbeans.modules.j2ee.jpa.verification.common.Rule.execute(Rule.java:68)
	at org.netbeans.modules.j2ee.jpa.verification.common.RulesEngine.visitTypeAsClass(RulesEngine.java:70)
	at org.netbeans.modules.j2ee.jpa.verification.JPAProblemFinder.processClass(JPAProblemFinder.java:174)
	at org.netbeans.modules.j2ee.jpa.verification.JPAProblemFinder.access$000(JPAProblemFinder.java:95)


Please let me know if some debugging can be turned on to see which class is causing this problem. My project is way too big, so if it is possible to narrow problem to single class I'll be happy to provide sample.
Comment 4 Sergey Petrov 2014-01-10 14:40:49 UTC
as it's said in the exception, it's caused by a class where named queries are present, there are(at least) two possibilities for this kind of npe,
first one is when verification is cancelled, it may be just artifact and may not need any attention except case of growing message.log too much.
another case if it' happened during usual validation because persistence model wasn't constructed prperly. But to evaluate second case I likely will need jpql text with all related entities structures information.
Comment 5 Martin Balin 2016-07-07 08:55:35 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss