Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(694)

Issue 13080044: stricter adherence to RFC3339 standards for date/time parsing (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years ago by mnrubin
Modified:
11 years, 11 months ago
Reviewers:
yanivi
CC:
ngmiceli, peleyal
Base URL:
https://code.google.com/p/google-http-java-client/
Visibility:
Public.

Description

1. Restricted milliseconds to 3 digits which wasn't consistent with RFC3339 standards, e.g. "1937-01-01T12:00:27.87+00:20" was not parsed as it should have been. 2. Wasn't strict enough with formatting: A. Negative values allowed, e.g. "1937--3-55T12:00:27+00:20" was parsed with a month value of -3. B. Didn't throw exceptions when it could parse a portion but not all of the user's input, e.g. "2013-01-01 09:00:02" was parsed as "2013-01-01" (date only).

Patch Set 1 #

Patch Set 2 : fixed a little formatting #

Total comments: 12

Patch Set 3 : fixed formatting based on Eyal's comments #

Total comments: 20

Patch Set 4 : fixed Yaniv's comments and title/description #

Patch Set 5 : changed javadoc on parseRfc3339() to reference throwing an IllegalArgumentException instead #

Total comments: 8

Patch Set 6 : fixed Yaniv's 2nd set of comments #

Total comments: 6

Patch Set 7 : changes based on Nick's comments #

Total comments: 32

Patch Set 8 : changed javadoc/comments according to nick's suggestion #

Patch Set 9 : fixed Yaniv's comments #

Total comments: 10

Patch Set 10 : removed TODO #

Patch Set 11 : fixed Yaniv's final comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+110 lines, -47 lines) Patch
M google-http-client/src/main/java/com/google/api/client/util/DateTime.java View 1 2 3 4 5 6 7 8 9 10 4 chunks +82 lines, -47 lines 0 comments Download
M google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java View 1 2 3 4 5 6 7 8 9 10 4 chunks +28 lines, -0 lines 0 comments Download

Messages

Total messages: 16
mnrubin
12 years ago (2013-08-23 21:35:53 UTC) #1
peleyal
First review... I didn't check the logic, I did check only the style. Feel free ...
12 years ago (2013-08-24 17:04:41 UTC) #2
mnrubin
Fixed re: Eyal's style comments https://codereview.appspot.com/13080044/diff/3001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/3001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode250 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:250: * @author mnrubin Parses ...
12 years ago (2013-08-26 14:56:36 UTC) #3
yanivi
Please fix the title and description of this changeset. Title should be a single short ...
12 years ago (2013-08-27 21:21:40 UTC) #4
mnrubin
> Please fix the title and description of this changeset. > Title should be a ...
12 years ago (2013-08-27 22:32:50 UTC) #5
yanivi
I don't have time for a more thorough review before I go on vacation. I'll ...
12 years ago (2013-08-27 22:39:21 UTC) #6
mnrubin
https://codereview.appspot.com/13080044/diff/19001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/19001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode39 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:39: private static final long SERIAL_VERSION_UID = 1L; On 2013/08/27 ...
12 years ago (2013-08-28 14:22:20 UTC) #7
ngmiceli
Note the details on correctly running mvn tests. https://codereview.appspot.com/13080044/diff/24001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/24001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode273 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:273: public ...
12 years ago (2013-08-29 15:08:28 UTC) #8
mnrubin
https://codereview.appspot.com/13080044/diff/24001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/24001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode273 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:273: public static DateTime parseRfc3339(String str) throws IllegalArgumentException { On ...
12 years ago (2013-08-29 22:25:56 UTC) #9
ngmiceli
https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode260 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:260: * Upgrade warning: the parsing has become more strict ...
11 years, 12 months ago (2013-09-03 22:08:57 UTC) #10
mnrubin
https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode260 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:260: * Upgrade warning: the parsing has become more strict ...
11 years, 11 months ago (2013-09-04 14:02:25 UTC) #11
yanivi
https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/30001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode43 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:43: /** Regular expression for parsing RFC3339 date/times */ google-http-client/src/main/java/com/google/api/client/util/DateTime.java:43: ...
11 years, 11 months ago (2013-09-04 14:13:48 UTC) #12
mnrubin
(note: Yaniv submitted comments while I was fixing Nick's, so one may have to look ...
11 years, 11 months ago (2013-09-04 18:18:11 UTC) #13
mnrubin
removed TODO
11 years, 11 months ago (2013-09-04 20:32:22 UTC) #14
yanivi
LGTM (but please fix the minor issues below first) https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java File google-http-client/src/main/java/com/google/api/client/util/DateTime.java (right): https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/main/java/com/google/api/client/util/DateTime.java#newcode45 google-http-client/src/main/java/com/google/api/client/util/DateTime.java:45: ...
11 years, 11 months ago (2013-09-04 20:47:52 UTC) #15
mnrubin
11 years, 11 months ago (2013-09-04 21:05:21 UTC) #16
committing

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/mai...
File google-http-client/src/main/java/com/google/api/client/util/DateTime.java
(right):

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/mai...
google-http-client/src/main/java/com/google/api/client/util/DateTime.java:45:
"^([\\d]{4})-([\\d]{2})-([\\d]{2})" // yyyy-MM-dd
On 2013/09/04 20:47:53, yanivi wrote:
> remove the brackets from "\\d", e.g.:
>       "^(\\d{4})-(\\d{2})-(\\d{2})" // yyyy-MM-dd

Done.

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/mai...
google-http-client/src/main/java/com/google/api/client/util/DateTime.java:288:
if (str == null || !matcher.matches()) {
On 2013/09/04 20:47:53, yanivi wrote:
> remove str == null part since NullPointerException is expected, which
hopefully
> matches already does

Done.

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/tes...
File
google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java
(right):

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/tes...
google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java:29:
TimeZone defaultTimeZone;
On 2013/09/04 20:47:53, yanivi wrote:
> private

Done.

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/tes...
google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java:29:
TimeZone defaultTimeZone;
On 2013/09/04 20:47:53, yanivi wrote:
> use the word "original" to make it more clear, e.g. "orignalTimeZone"

Done.

https://codereview.appspot.com/13080044/diff/40001/google-http-client/src/tes...
google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java:38:
/* (non-Javadoc)
On 2013/09/04 20:47:53, yanivi wrote:
> remove noisy and unhelpful lines 38-40
> 
> similarly below for tearDown

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b