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

NullPointer Exception on null values using Projections.map #778

Closed
dmiorandi opened this issue May 27, 2014 · 6 comments
Closed

NullPointer Exception on null values using Projections.map #778

dmiorandi opened this issue May 27, 2014 · 6 comments
Labels
bug
Milestone

Comments

@dmiorandi
Copy link

@dmiorandi dmiorandi commented May 27, 2014

Consider this trivial query. It seems that if there is a null value in resultset
Projections.map generate a null pointer exception. Is it something wrong on my code or is it a bug?

        SQLQuery query=queryDslJdbcTemplateViaHibernateSession.getQuery();
        QSQL_Domande domande=QSQL_Domande.Domande;
        Map<Expression<?>, ?> resultSet=query.from(QSQL_Domande.Domande)
                .where(QSQL_Domande.Domande.handicap6675CertificatoDa.isNull()).singleResult(
            Projections.map(QSQL_Domande.Domande.iDDomanda,QSQL_Domande.Domande.iDEnteErogatore,QSQL_Domande.Domande.handicap6675CertificatoDa)
        );

        //TODO: bug querydsl here???
        Object a=resultSet.get(domande.iDDomanda);
        Object b=resultSet.get(domande.iDEnteErogatore);
        Object c=resultSet.get(domande.handicap6675CertificatoDa);
@timowest
Copy link
Member

@timowest timowest commented May 27, 2014

Could you provide the stacktrace?

@timowest timowest added the bug label May 27, 2014
@dmiorandi
Copy link
Author

@dmiorandi dmiorandi commented May 28, 2014

there no stack trace available

it happens on class / method

ProjectableQuery.uniqueResult

when closing iterator (resultset is already printed by jdbc proxy driver)

finally{
            it.close();
}

This is call stack, but it doesn't say nothing interesting.

Thread [main] (Suspended)   
    InvocationTargetException.<init>(Throwable) line: 72    
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] [local variables unavailable]    
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57  
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
    Method.invoke(Object, Object...) line: 606  
    FrameworkMethod$1.runReflectiveCall() line: 47  
    FrameworkMethod$1(ReflectiveCallable).run() line: 12    
    FrameworkMethod.invokeExplosively(Object, Object...) line: 44   
    InvokeMethod.evaluate() line: 17    
    RunBeforeTestMethodCallbacks.evaluate() line: 74    
    RunAfterTestMethodCallbacks.evaluate() line: 83 
    SpringRepeat.evaluate() line: 72    
    SpringJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 231    
    SpringJUnit4ClassRunner.runChild(Object, RunNotifier) line: 88  
    ParentRunner$3.run() line: 238  
    ParentRunner$1.schedule(Runnable) line: 63  
    SpringJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 236 
    ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 53  
    ParentRunner$2.evaluate() line: 229 
    RunBeforeTestClassCallbacks.evaluate() line: 61 
    RunAfterTestClassCallbacks.evaluate() line: 71  
    SpringJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 309 
    SpringJUnit4ClassRunner.run(RunNotifier) line: 174  
    JUnit4TestMethodReference(JUnit4TestReference).run(TestExecution) line: 50  
    TestExecution.run(ITestReference[]) line: 38    
    RemoteTestRunner.runTests(String[], String, TestExecution) line: 467    
    RemoteTestRunner.runTests(TestExecution) line: 683  
    RemoteTestRunner.run() line: 390    
    RemoteTestRunner.main(String[]) line: 197   
@timowest
Copy link
Member

@timowest timowest commented May 29, 2014

Could you provide the original stack trace? This looks like a wrapped exception. Could you also confirm that all the expression arguments to Projections.map are not null?

@dmiorandi
Copy link
Author

@dmiorandi dmiorandi commented May 29, 2014

I've got some difficult to extract original stacktrace because it happens
on finally so it jump to spring exception as I remember and there is no
information on original exception but I can try more in depth tomorrow,

Anyway one the field is intentionally null. I expect that should be
possible
have a resultset with null field also in map. Are there something wrong in
my test?

@timowest
Copy link
Member

@timowest timowest commented May 29, 2014

@timowest timowest added the fixed label May 29, 2014
@timowest timowest added this to the 3.4.0 milestone Jun 9, 2014
@timowest
Copy link
Member

@timowest timowest commented Jun 9, 2014

Released in 3.4.0

@timowest timowest closed this Jun 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.