clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minto van der Sluis <mi...@xup.nl>
Subject Re: ERROR: Quad: object cannot be null
Date Sun, 14 Jul 2013 09:58:17 GMT
Hi Reto,

If I am correct the NPE I discovered will always happens for fastlaned
queries on Jena TDB based TcProviders due to the following line present
in BaseTdbTcProvider.java:

    getDataset().setDefaultModel(null);

The NPE can be clearly seen in DatasetImpl if model is null:

    @Override
    public void setDefaultModel(Model model)
    {
        // Assumes single writer.
        removeFromCache(dsg.getDefaultGraph()) ;
        addToCache(model) ;
        dsg.setDefaultGraph(model.getGraph()) ;
    }

Did you have anything special in mind when you added the null model?

Regards,

Minto

Op 12-7-2013 23:50, Reto Bachmann-Gmür schreef:
> Thanks Minto. I would rather not withdraw the release candidate but
> have a new release very soon (max a couple of weeks).
>
> Reto
>
> On Fri, Jul 12, 2013 at 10:48 PM, Minto van der Sluis <minto@xup.nl> wrote:
>> Fixed this with commit r1502677 (CLEREZZA-802)
>>
>> Please have a close look. Might need to be part of the pending release
>> as well.
>>
>> Regards,
>>
>> Minto
>>
>> Op 12-7-2013 18:14, Minto van der Sluis schreef:
>>> This time I end up with an NPE, see stack below.
>>>
>>> My changes resulted in the following
>>>
>>>     public Object executeSparqlQuery(String query, TripleCollection
>>> defaultGraph, boolean forceFastlane) throws ParseException {
>>>         TcProvider singleTargetTcProvider = null;
>>>         if (forceFastlane) {
>>>             singleTargetTcProvider = getSingleTargetTcProvider();
>>>         } else {
>>>             final UriRef defaultGraphName = new
>>> UriRef("urn:x-temp:/kjsfadfhfasdffds");
>>>             SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
>>>             final Set<UriRef> referencedGraphs =
>>> sparqlPreParser.getReferredGraphs(query, defaultGraphName);
>>>             if ((referencedGraphs != null) &&
>>> (!referencedGraphs.contains(defaultGraphName))) {
>>>                 singleTargetTcProvider =
>>> getSingleTargetTcProvider(referencedGraphs);
>>>             }
>>>         }
>>>
>>>         if ((singleTargetTcProvider != null) && (singleTargetTcProvider
>>> instanceof QueryableTcProvider)) {
>>>             return
>>> ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query,
>>> null);
>>>         }
>>>         final QueryEngine queryEngine = this.queryEngine;
>>>         if (queryEngine != null) {
>>>             return queryEngine.execute(this, defaultGraph, query);
>>>         } else {
>>>             throw new NoQueryEngineException();
>>>         }
>>>     }
>>>
>>>    private TcProvider getSingleTargetTcProvider() {
>>>         return providerList.first();
>>>     }
>>>
>>> I guess the following like in BaseTdbTcProvider.executeSparqlQuery() is
>>> the culprit:
>>>
>>>        getDataset().setDefaultModel(null);
>>>
>>> Stacktrace:
>>>
>>> java.lang.NullPointerException
>>>     at
>>> com.hp.hpl.jena.sparql.core.DatasetImpl.addToCache(DatasetImpl.java:259)
>>>     at
>>> com.hp.hpl.jena.sparql.core.DatasetImpl.setDefaultModel(DatasetImpl.java:214)
>>>     at
>>> org.apache.clerezza.rdf.jena.tdb.storage.BaseTdbTcProvider.executeSparqlQuery(BaseTdbTcProvider.java:39)
>>>     at
>>> org.apache.clerezza.rdf.jena.tdb.storage.ScalableSingleTdbDatasetTcProvider.executeSparqlQuery(ScalableSingleTdbDatasetTcProvider.java:81)
>>>     at
>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcManager.java:310)
>>>     at
>>> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcManager.java:282)
>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)[:1.7.0_17]
>>>     at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_17]
>>>     at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_17]
>>>     at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17]
>>>     at
>>> org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)[12:org.apache.aries.proxy.impl:1.0.0]
>>>     at
>>> org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)[12:org.apache.aries.proxy.impl:1.0.0]
>>>     at
>>> org.apache.clerezza.rdf.core.access.$TcManager10360330.executeSparqlQuery(Unknown
>>> Source)[181:org.apache.clerezza.rdf.core:0.13.0.SNAPSHOT]
>>>     at
>>> nl.overheid.stelsel.digimelding.astore.storage.clerezza.ClerezzaStorageProvider.query(ClerezzaStorageProvider.java:250)[209:astore-storage-clerezza:0.7.0.SNAPSHOT]
>>>
>>
>> --
>> ir. ing. Minto van der Sluis
>> Software innovator / renovator
>> Xup BV
>>
>> Mobiel: +31 (0) 626 014541
>>
>


-- 
ir. ing. Minto van der Sluis
Software innovator / renovator
Xup BV

Mobiel: +31 (0) 626 014541


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message