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

upgrade from querydsl 3.3.3 to 3.3.4 causes NPE in Projections.constructor #772

Closed
Mahamoti1129 opened this issue May 24, 2014 · 12 comments
Closed
Labels
bug
Milestone

Comments

@Mahamoti1129
Copy link

@Mahamoti1129 Mahamoti1129 commented May 24, 2014

After upgrading from querydsl-jpa-3.3.3 to 3.3.4, any code using Projections.constructor is returning a NullPointerException. Using Projections.bean where applicable avoids the issue, but there are places where I need to use constructor. Downgrading to 3.3.3 resolves the issue. Stacktrace follows:

Caused by: java.lang.NullPointerException
        at com.google.common.base.Preconditions.checkNotNull
(Preconditions.java:213)
        at
com.google.common.collect.ImmutableClassToInstanceMap.getInstance
(ImmutableClassToInstanceMap.java:150)
        at com.mysema.query.util.ConstructorUtils
$PrimitiveAwareVarArgsTransformer.<init>(ConstructorUtils.java:269)
        at com.mysema.query.util.ConstructorUtils.getTransformers
(ConstructorUtils.java:128)
        at com.mysema.query.types.ConstructorExpression.newInstance
(ConstructorExpression.java:128)
        at com.mysema.query.jpa.FactoryExpressionTransformer.transformTuple
(FactoryExpressionTransformer.java:50)
        at org.hibernate.hql.internal.HolderInstantiator.instantiate
(HolderInstantiator.java:95)
        at org.hibernate.loader.hql.QueryLoader.getResultList
(QueryLoader.java:464)
        at org.hibernate.loader.Loader.listIgnoreQueryCache
(Loader.java:2369)
        at org.hibernate.loader.Loader.list(Loader.java:2364)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496)
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list
(QueryTranslatorImpl.java:387)
        at org.hibernate.engine.query.spi.HQLQueryPlan.performList
(HQLQueryPlan.java:231)
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1264)
        at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103)
        at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573)
        at org.hibernate.jpa.internal.QueryImpl.getResultList
(QueryImpl.java:449)
        at com.mysema.query.jpa.impl.AbstractJPAQuery.getResultList
(AbstractJPAQuery.java:195)
        at com.mysema.query.jpa.impl.AbstractJPAQuery.list
(AbstractJPAQuery.java:243)
@timowest
Copy link
Member

@timowest timowest commented May 24, 2014

@Shredder121 Could you take a look?

@timowest timowest added the bug label May 24, 2014
@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

Yes I will look into this

@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

I found the problem, after guava 13.0.1 they added a not null precondition, so that's the problem.
I comitted a solution that evades the lookup, but am wondering, @timowest how easy can querydsl upgrade it's guava version?

@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

see pull request #773

@timowest
Copy link
Member

@timowest timowest commented May 24, 2014

@Shredder121 So this Exception appears if Querydsl's own guava dependency is replaced with a newer one?

@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

Our compile time dependency is 13.0.1, but if there is a different version on the classpath, our transitive dependency is replaced by the newer version.

@timowest
Copy link
Member

@timowest timowest commented May 24, 2014

@Mahamoti1129 Could you confirm that you use a newer Guava version? Does it come bundled with another framework you use? I am trying to figure out how critical this issue is.

@Mahamoti1129
Copy link
Author

@Mahamoti1129 Mahamoti1129 commented May 24, 2014

It sounds like you guys are on the right track. We use guava in our projects as well, and are on the current release, 17.0. The combination of guava 17.0 and querydsl 3.3.3 works, though, which is why I thought the issue was in querydsl.

@Shredder121
Copy link
Member

@Shredder121 Shredder121 commented May 24, 2014

I made changes that uses a ClassToInstanceMap, in 13 apparently you can use null keys, whereas after 13 and onward they added a notnull precondition.

So in querydsl 3.3.3 it works in every way, but 3.3.4 would only work with guava 13, unfortunately.

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

@luisfpg luisfpg commented Jun 6, 2014

Just saw this as well...
Reverting to Querydsl 3.3.3

@timowest
Copy link
Member

@timowest timowest commented Jun 9, 2014

Released in 3.4.0

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
4 participants
You can’t perform that action at this time.