Closed jamesweakley closed 6 years ago
In case the error wasn't obvious, 10/3/10 2:00
is the instant that Daylight Savings begins in NSW, Australia so JodaTime doesn't like it.
I looked at a couple of options to automatically force a specific default timezone setting for test runs, but they relied on the use of either maven, gradle, or a specific IDE as the test executor. There's no way to do something like this globally with junit.
So instead, I looked at why the error wasn't failing the test case and realised it was happening silently in a Layer thread. So I figured this probably wasn't desirable anyway, and added an UncaughtExceptionHandler to pass it on to the existing notifier mechanism. NOTE: This part is a production change, not just test case behaviour
This change caused a test case failure that I could then fix by forcing a default timezone change for that test class.
Due to data in /htm.java/src/main/java/org/numenta/nupic/datagen/rec-center-hourly.csv being in local time, the following error is appearing in the console:
Exception in thread "Sensor Layer [r1:1] Thread" java.lang.IllegalStateException: org.joda.time.IllegalInstantException: Cannot parse "10/3/10 2:00": Illegal instant due to time zone offset transition (Australia/Sydney) at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:105) at org.numenta.nupic.encoders.Encoder.encode(Encoder.java:625) at org.numenta.nupic.network.sensor.HTMSensor.input(HTMSensor.java:429) at org.numenta.nupic.network.sensor.HTMSensor.lambda$0(HTMSensor.java:362) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812) at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294) at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169) at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300) at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) at org.numenta.nupic.network.sensor.HTMSensor$Copy.hasNext(HTMSensor.java:280) at java.util.Iterator.forEachRemaining(Iterator.java:115) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at org.numenta.nupic.network.Layer$5.run(Layer.java:2036) Caused by: org.joda.time.IllegalInstantException: Cannot parse "10/3/10 2:00": Illegal instant due to time zone offset transition (Australia/Sydney) at org.joda.time.format.DateTimeParserBucket.computeMillis(DateTimeParserBucket.java:471) at org.joda.time.format.DateTimeParserBucket.computeMillis(DateTimeParserBucket.java:411) at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:882) at org.numenta.nupic.encoders.DateEncoder.parse(DateEncoder.java:446) at org.numenta.nupic.FieldMetaType.decodeType(FieldMetaType.java:98) at org.numenta.nupic.network.sensor.HTMSensor$InputMap.get(HTMSensor.java:306) at org.numenta.nupic.encoders.Encoder.getInputValue(Encoder.java:699) at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:102) ... 20 more