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

EntityManager.isInferred throws NullPointerException when LazyLoadingProxy is passed to it #252

Closed
ledsoft opened this issue Jun 20, 2024 · 1 comment · Fixed by #253
Closed
Labels
Milestone

Comments

@ledsoft
Copy link
Contributor

ledsoft commented Jun 20, 2024

When I want to check whether a value is inferred, but the value is a EntityLazyLoadingProxy instance, it causes a NPX, because the value is translated to NullValue. See the following stacktrace segment:

Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "value" is null
    at cz.cvut.kbss.ontodriver.rdf4j.util.Rdf4jUtils.createLiteral(Rdf4jUtils.java:142)
    at cz.cvut.kbss.ontodriver.rdf4j.Rdf4jAdapter.axiomObjectToRdf4jValue(Rdf4jAdapter.java:181)
    at cz.cvut.kbss.ontodriver.rdf4j.Rdf4jAdapter.isInferred(Rdf4jAdapter.java:188)
    at cz.cvut.kbss.ontodriver.rdf4j.Rdf4jConnection.isInferred(Rdf4jConnection.java:181)
    at cz.cvut.kbss.jopa.oom.ObjectOntologyMapperImpl.lambda$isInferred$0(ObjectOntologyMapperImpl.java:388)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.Collections$2.tryAdvance(Collections.java:4853)
    at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4861)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657)
    at cz.cvut.kbss.jopa.oom.ObjectOntologyMapperImpl.isInferred(ObjectOntologyMapperImpl.java:392)
    at cz.cvut.kbss.jopa.sessions.ConnectionWrapper.isInferred(ConnectionWrapper.java:97)
    at cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork.isInferred(AbstractUnitOfWork.java:876)
    at cz.cvut.kbss.jopa.model.EntityManagerImpl.isInferred(EntityManagerImpl.java:544)
@ledsoft ledsoft added the bug label Jun 20, 2024
@ledsoft
Copy link
Contributor Author

ledsoft commented Jun 20, 2024

Note that it seems to happen only for singular values (EntityLazyLoadingProxy), not for collection proxies.

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

Successfully merging a pull request may close this issue.

1 participant