laito / cleartk

Automatically exported from code.google.com/p/cleartk
0 stars 0 forks source link

Losing cause exception stack traces #398

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is a stack trace I've got:

SEVERE: Error while training classifier model 9
org.cleartk.classifier.encoder.CleartkEncoderException: Invalid value in 
feature vector 9:?
        at org.cleartk.classifier.encoder.CleartkEncoderException.invalidFeatureVectorValue(CleartkEncoderException.java:45)
        at org.cleartk.classifier.encoder.features.FeatureVectorFeaturesEncoder.encodeAll(FeatureVectorFeaturesEncoder.java:101)
        at org.cleartk.classifier.encoder.features.FeatureVectorFeaturesEncoder.encodeAll(FeatureVectorFeaturesEncoder.java:50)
        at org.cleartk.classifier.jar.DataWriter_ImplBase.write(DataWriter_ImplBase.java:57)
        at com.voigy.uima.analyzer.annotators.query_classifier.ClassificationEvaluation.train(ClassificationEvaluation.java:269)
        at com.voigy.uima.analyzer.impl.AnalyzerImpl.learnClassifiersLocked(AnalyzerImpl.java:419)
        at com.voigy.uima.analyzer.impl.AnalyzerImpl.startLearningClassifiers(AnalyzerImpl.java:366)
        at com.voigy.uima.analyzer.impl.AnalyzerImpl$5.run(AnalyzerImpl.java:134)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

Looking at line 101 of FeatureVectorFeaturesEncoder.java, I see 

catch (InvalidFeatureVectorValueException e) {
        throw CleartkEncoderException.invalidFeatureVectorValue(e.getIndex(), e.getValue());
      }

So there was an exception which caused this, but I don't have its stack trace! 
I suggest that static methods in CleartkProcessingException and 
CleartkEncoderException should all take Throwable cause as an argument.

Original issue reported on code.google.com by alexey.v...@gmail.com on 16 Jan 2014 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by phi...@ogren.info on 15 Mar 2014 at 6:06

GoogleCodeExporter commented 9 years ago
Alexey, thank you for filing the issue and for identifying the fix.  This seems 
like a very straightforward and sensible suggestion.  Apologies for the delay 
in getting it fixed.  

Original comment by phi...@ogren.info on 12 Apr 2014 at 4:22

GoogleCodeExporter commented 9 years ago
CleartkEncoderException.invalidFeatureVectorValue has two signatures now - one 
that now takes a throwable.  This will help debugging when 
FeatureVectorFeaturesEncoder.encodeAll throws it (it now passes the cause).  
This handles the complaint that initiated this issue.
CleartkProcessingException.unsupportedOperationSetParameter now takes a 
Throwable param.  The only caller of this method was inside a catch block.
I left CleartkProcessingException.noInstanceOutcome alone because no callers of 
the method were catching another exception - i.e. the method was not being 
called in a catch block
I also stumbled on a bug in a CleartkEncoderException constructor in which the 
parameters were in the wrong order

Original comment by phi...@ogren.info on 12 Apr 2014 at 5:16