Rainy icon indicating copy to clipboard operation
Rainy copied to clipboard

Rainy shoud accept DateTime.Min (1970/1/1) as valid date

Open j-4 opened this issue 12 years ago • 6 comments

Do you have an idea what goes wrong here?

80 [DEBUG] Logsystem->SetupLogging - logsystem initialized 100 [DEBUG] Logsystem->SetupLogging - Writing all log messages to file: debug.log 409 [DEBUG] Rainy.RainyStandaloneServer->Start - starting http listener at: http://*:8080/ Press RETURN to stop Rainy 5577 [DEBUG] Rainy.WebService.RequestLogFilterAttribute->RequestFilter - Received request at: /api/1.0/jango Data received: { Username: jango } 5598 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - trying to acquire authorization 5599 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - Received headers:[ Authorization, Host, Connection, User-Agent ] 5635 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - authorization granted for user jango 5688 [DEBUG] Rainy.WebService.ResponseLogFilterAttribute->ResponseFilter - Sending response: { user-name: jango, first-name: Not, last-name: Important, notes-ref: { api-ref: "http://192.168.1.104:8080//api/1.0/jango/notes", href: "http://192.168.1.104:8080//api/1.0/jango/notes" }, latest-sync-revision: 1, current-sync-guid: 62fed4c3-be59-407c-86df-a9ac34db863f } 5836 [DEBUG] Rainy.WebService.RequestLogFilterAttribute->RequestFilter - Received request at: //api/1.0/jango/notes Data received: { Username: jango } 5836 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - trying to acquire authorization 5836 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - Received headers:[ Authorization, Host, Connection, User-Agent ] 5845 [DEBUG] Rainy.WebService.OAuth.OAuthRequiredAttribute->RequestFilter - authorization granted for user jango 5941 [DEBUG] Rainy.WebService.NotesService->Get - CAUGHT EXCEPTION: Argument is out of range. at System.DateTime.op_Subtraction (DateTime d, TimeSpan t) [0x00000] in :0 at System.DateTime._DoParse (System.String s, System.String firstPart, System.String secondPart, Boolean exact, System.DateTime& result, System.DateTimeOffset& dto, System.Globalization.DateTimeFormatInfo dfi, DateTimeStyles style, Boolean firstPartIsDate, System.Boolean& incompleteFormat, System.Boolean& longYear) [0x00000] in :0 at System.DateTime.CoreParse (System.String s, IFormatProvider provider, DateTimeStyles styles, System.DateTime& result, System.DateTimeOffset& dto, Boolean setExceptionOnError, System.Exception& exception) [0x00000] in :0 at System.DateTime.Parse (System.String s, IFormatProvider provider, DateTimeStyles styles) [0x00000] in :0 at System.DateTime.Parse (System.String s, IFormatProvider provider) [0x00000] in :0 at System.DateTime.Parse (System.String s) [0x00000] in :0 at Tomboy.Sync.DTO.NoteConverter.ToTomboyNote (Tomboy.Sync.DTO.DTONote dto_note) [0x00000] in :0 at Rainy.Db.DbStorage.<GetNotes>m__B (Rainy.Db.DBNote n) [0x00000] in :0 at System.Linq.Enumerable.ToDictionary[DBNote,String,Note](IEnumerable1 source, System.Func2 keySelector, System.Func2 elementSelector, IEqualityComparer1 comparer) [0x00000] in :0 at System.Linq.Enumerable.ToDictionary[DBNote,String,Note](IEnumerable1 source, System.Func2 keySelector, System.Func`2 elementSelector) [0x00000] in :0 at Rainy.Db.DbStorage.GetNotes () [0x00000] in :0 at Tomboy.Engine.GetNotes () [0x00000] in :0 at Rainy.WebService.NotesService.GetStoredNotes (INoteRepository note_repo) [0x00000] in :0 at Rainy.WebService.NotesService.Get (Rainy.WebService.GetNotesRequest request) [0x00000] in :0

log from tomdroid 02-24 12:24:36.713: V/SnowySyncService(19888): contacting http://192.168.1.104:8080/api/1.0/jango 02-24 12:24:37.473: I/WebConnection(19888): Response status : HTTP/1.1 200 OK 02-24 12:24:37.473: I/WebConnection(19888): Received : {"user-name":"jango","first-name":"Not","last-name":"Important","notes-ref":{"api-ref":"http://192.168.1.104:8080//api/1.0/jango/notes","href":"http://192.168.1.104:8080//api/1.0/jango/notes"},"latest-sync-revision":1,"current-sync-guid":"62fed4c3-be59-407c-86df-a9ac34db863f"} 02-24 12:24:37.473: V/SyncService(19888): sync progress: 30 02-24 12:24:37.643: I/WebConnection(19888): Response status : HTTP/1.1 400 ArgumentOutOfRangeException 02-24 12:24:37.653: I/WebConnection(19888): Received : {"ResponseStatus":{"ErrorCode":"ArgumentOutOfRangeException","Message":"Argument is out of range.","Errors":[]}} 02-24 12:24:37.653: V/SyncService(19888): sync progress: 35 02-24 12:24:37.653: E/SnowySyncService(19888): Problem parsing the server response 02-24 12:24:37.653: E/SnowySyncService(19888): org.json.JSONException: No value for latest-sync-revision 02-24 12:24:37.653: E/SnowySyncService(19888): at org.json.JSONObject.get(JSONObject.java:354) 02-24 12:24:37.653: E/SnowySyncService(19888): at org.json.JSONObject.getLong(JSONObject.java:477) 02-24 12:24:37.653: E/SnowySyncService(19888): at org.tomdroid.sync.web.SnowySyncService$3.run(SnowySyncService.java:207) 02-24 12:24:37.653: E/SnowySyncService(19888): at org.tomdroid.sync.SyncService$1.run(SyncService.java:169) 02-24 12:24:37.653: E/SnowySyncService(19888): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 02-24 12:24:37.653: E/SnowySyncService(19888): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 02-24 12:24:37.653: E/SnowySyncService(19888): at java.lang.Thread.run(Thread.java:856) 02-24 12:24:37.653: V/SyncService(19888): sync progress: 100

j-4 avatar Feb 24 '13 11:02 j-4

Yes, something is wrong with a note Date format, the DateTime.Parse() in Rainy fails. That is weird, as the note is already in the database, and thus should be a valid DateTime field (no matter what was send by tomdroid).

Can you reproduce this error? It would be helpfull to get the date strings, both send by tomdroid and the ones stored in the sqlite database by rainy. To do this, use the commando: "sqlite3 rainy.db" to open the sqlite database, and then "select * from DBNote;" to get all notes.

I have seen a similiar bug in tomboy, when a note has DateTime of 1.1.1970 (so an epoch time of 0). If you can reproduce, try to see if thats the case for a note.

Dynalon avatar Feb 24 '13 12:02 Dynalon

I've just remembered, there is a limitation in Rainy (and in tomboy) that does not allow notes to have epoch dates of 0 (1.1.1970), in the unit tests i always add a few days, see https://github.com/Dynalon/tomboy-library/blob/sync_from_scratch/Tomboy-library/Tomboy-library-tests/SyncTests/AbstractSyncManagerTests.cs#L160

Dynalon avatar Feb 24 '13 12:02 Dynalon

oh... i have 1.1.1970 as creation date, but i am on my way to change this! then all rainy related bugs should be fixed in my build... lets see! I will try to use 2.1.1970 as a first fix...

j-4 avatar Feb 24 '13 16:02 j-4

Great! I will leave this issue open as it is valid, even if it is a minor one. Rainy should one day accept 1.1.1970 as date, but I remember this was non trivial as there were problems with tomboy, too. Will take a look at this when I find the time.

Dynalon avatar Feb 24 '13 17:02 Dynalon

I think I fixed that, but maybe it didn't make that in the Master or do you mean in tomdroid On Feb 24, 2013 10:28 AM, "Stefan Hammer" [email protected] wrote:

oh... i have 1.1.1970 as creation date, but i am on my way to change this! then all rainy related bugs should be fixed in my build... lets see! I will try to use 2.1.1970 as a first fix...

— Reply to this email directly or view it on GitHubhttps://github.com/Dynalon/Rainy/issues/3#issuecomment-14010993.

trepidity avatar Feb 24 '13 20:02 trepidity

Ok... 1.1.2000 fixed this one. However, i am now working on saving the creation date in our database! However, I don't think anyone will ever create create or modify a date on 1.1.1970 ,-)

j-4 avatar Feb 24 '13 20:02 j-4