20

Recently I made an edit to this question because the previous edit fixed a bug in the question's code, which resulted in the question's output not matching what the code actually outputted anymore. This edit was rejected, but I feel like it should not have been.

Originally, the question's code looked like this:

String date_s = " 2011-01-18 00:00:00.0"; 
SimpleDateFormat dt = new SimpleDateFormat("yyyyy-mm-dd hh:mm:ss"); 
Date date = dt.parse(date_s); 
SimpleDateFormat dt1 = new SimpleDateFormat("yyyyy-mm-dd");
System.out.println(dt1.format(date));

Following the code, the question says:

But it outputs: 02011-00-1 instead of the desired 2011-01-18.

Notice how there are five y's, and also notice that the five y's results in five digits in the outputted year: 02011.

The previous edit changed the code so that there were only four y's. Here's the new, "corrected" code from that edit:

String date_s = " 2011-01-18 00:00:00.0"; 
SimpleDateFormat dt = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); 
Date date = dt.parse(date_s); 
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-mm-dd");
System.out.println(dt1.format(date));

The problem is that when running this code, the output is now 2011-00-18, not 02011-00-1 as stated in the question.

My edit added the fifth y back into the question, where it should stay, because not only does the question's output depend on it, but so do many answers and even the highest rated comment.

Some examples of answers that mention the five y's include:

https://stackoverflow.com/a/4772461/2364405

Also, years exist of four digits, not five.

https://stackoverflow.com/a/4772431/2364405

Also, yyyyy is not the same as yyyy

https://stackoverflow.com/a/18953213/2364405

remove one y form SimpleDateFormat dt1 = new SimpleDateFormat("yyyyy-mm-dd");

So, why was my edit rejected? Clearly, it makes more sense to leave the five y's in than out.

7
  • 3
    You seem to have done the right thing, including explaining the edit in the summary, and two reviewers agreed with you. Unfortunately, any suggested edit to code will attract robo-rejections because so many of them (suggested edits, and reviewers) are bad. You can ping editors in comments (@Maksim ...), so you could try getting the previous editor to roll back. Dec 25, 2015 at 7:57
  • 1
    @Blastfurnace I agree, they weren't an improvement, but I was unable to get my edit past the minimum changed characters count without making some other edits. I felt that the minor text changes were negligible in the sense that the code change was too small to be passed alone, but was important enough to be corrected. Forgive me for that. Dec 25, 2015 at 8:33
  • The reviewers were clearly in the wrong. The worst thing is that this isn't even the first time this mistaken code-fixing has happened to this question! Last time it did, however, a suggested edit broke it and a 2ker fixed it, the reverse of this situation. Dec 25, 2015 at 9:13
  • 3
    @Blastfurnace: Rollbacks are not available to those without edit privileges. Dec 25, 2015 at 9:14
  • 1
    @NathanTuggy Exactly, at the time of writing I only have 405 reputation, so I had no option to do a rollback. Dec 25, 2015 at 9:16
  • Those extra changes to get past the minimum may have worked against you. Purely stylistic changes like that can come across as rude or even insulting. You would have been better off coming straight to Meta with this, I think. It was definitely worth the trouble.
    – Alan Moore
    Dec 26, 2015 at 20:44
  • @AlanMoore Duly noted. Thanks for the advice! Dec 26, 2015 at 21:13

1 Answer 1

19

I was one of the reviewers that rejected the edit. I went to the question to look at it more closely and I could not tell where the typo came from. It appears in revision 4 and that was a from a user other than the OP adding code to the answer. Since there is no edit comment it is hard to tell where that code could have come from.

It appears though that I did not spend enough time as the OP made a comment on the second highest answer that has the typo in the code.

I am sorry for the incorrect rejection and hopefully nothing untoward happened. Unfortunately it was tied at 2 and 2 and my vote put it over the edge. I am not what you would call robo reviewer and this was just a bad call on my part. I hope you can forgive the mistake.

1
  • 12
    Totally forgiven, no worries :) I was simply unsure why I was rejected given all the reasons that I thought the edit was valid Dec 25, 2015 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .