Illegal instant due to time zone offset transition
-
Hey, hopefully this is a quick question. I'm trying to run a Data File CSV importer. I am importing data to a single point and it's all hourly data. When I tried to run the simple imported against my CSV I got this error
org.joda.time.IllegalInstantException: Cannot parse "11-Mar-18 2": Illegal instant due to time zone offset transition (America/Toronto)
I've googled around and I'm not quite sure I understand what the error is. Is it because 2am does not exist on that day due to time change? Hmm. If that's the case can I just have this thing skip it somehow?
-
@psysak said in Illegal instant due to time zone offset transition:
Is it because 2am does not exist on that day due to time change?
Correct. There is no 2am on the 11th. It jumps straight to 3am.
@psysak said in Illegal instant due to time zone offset transition:
If that's the case can I just have this thing skip it somehow?
I dont think so. Can you delete it from the CSV?
-
You can easily skip it if you can modify the CSV importer, you would just put the call to the DateTimeFormat inside a try / catch instead of letting it get through, i.e.
long time; try { time = dtf.parseDateTime(row[0]).getMillis(); } catch(IllegalInstantException e) { return; //Don't let the exception escape }
-
@phildunlap Nice!
-
Interesting, can't compile cause it doesn't seem to understand IllegalInstantException
-
Did you put
import org.joda.time.IllegalInstantException;
around the other import statements at the top of the class?
-
................ yes?....
Thank you :)
I got around it by putting IllegalArgumentException since Instant extends it, but I will do it properly now