clarin-eric / resource-availability-status-api

0 stars 1 forks source link

unchecked exception while getting checked link resource #15

Closed twagoo closed 3 years ago

twagoo commented 3 years ago

This unchecked exception breaks the updating of resource availabiltiy status of records with the AvailabilityStatusUpdater (VLO v4.9.3-beta1; RASA v3.0.9)

Exception in thread "main" java.lang.NullPointerException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
    at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678)
    at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:737)

    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:661)
    at eu.clarin.cmdi.vlo.importer.linkcheck.AvailabilityStatusUpdater.lambda$run$1(AvailabilityStatusUpdater.java:127)
    at eu.clarin.cmdi.vlo.importer.linkcheck.AvailabilityStatusUpdater.queryAndProcess(AvailabilityStatusUpdater.java:160)
    at eu.clarin.cmdi.vlo.importer.linkcheck.AvailabilityStatusUpdater.run(AvailabilityStatusUpdater.java:119)
Caused by: java.lang.NullPointerException: Name is null
    at java.base/java.lang.Enum.valueOf(Enum.java:271)
    at eu.clarin.cmdi.rasa.DAO.CheckedLink.<init>(CheckedLink.java:80)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at eu.clarin.cmdi.rasa.linkResources.impl.ACDHCheckedLinkResource.get(ACDHCheckedLinkResource.java:201)
    at eu.clarin.cmdi.vlo.importer.linkcheck.RasaResourceAvailabilityStatusChecker.getLinkStatusForRefs(RasaResourceAvailabilityStatusChecker.java:47)
    at eu.clarin.cmdi.vlo.importer.linkcheck.AvailabilityStatusUpdater.checkAndUpdateRecord(AvailabilityStatusUpdater.java:194)
    at eu.clarin.cmdi.vlo.importer.linkcheck.AvailabilityStatusUpdater.lambda$run$0(AvailabilityStatusUpdater.java:129)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1624)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
    at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
wowasa commented 3 years ago

actually the NPE is the result of a couple of bugs:

Since I'm currently working at a new database design which has impacts on RASA and linkchecker, I just corrected the null-values in the database and made the field category not nullable

twagoo commented 3 years ago

Since the conversion from records to objects happens in streams, and unchecked exceptions are thrown on error, I think it would be good to produce some log output. For a suggestion, see f453c101447209477ad8615bc49fddf604815a9e.

wowasa commented 3 years ago

in fact it was fixed already when we made the category field not nullable which is also the case in the new db design