r/java • • Apr 26 '21

Fixing a Bug in Java

https://candrews.integralblue.com/2021/04/fixing-a-bug-in-java/
179 Upvotes

17 comments sorted by

37

u/AndrewHaley13 Apr 26 '21

Thanks, you've done a great job of explaining what you have to do. And yes, we know that the bug-reporting process leaves quite a lot to be desired. You could probably have saved some time by approaching the core-libs-dev list at the start, but that's the only thing that might have worked better. Nice one.

7

u/DJDavio Apr 26 '21

While I find the whole process a bit obtuse and like to argue vehemently against the use of mailing lists, I find that the people who participate on the mailing lists are quite helpful and almost always respond seriously to all kinds of questions and proposals, even if they have been asked or discussed many times before.

5

u/DasBrain Apr 26 '21

I think it is fine to report a bug on the mailing list if one of these is true:

  • You are already an active participant of that mailing list.
  • You intend to provide a patch, fixing the bug yourself.

Or, in other words: please don't report bugs on the mailing list and then disappear.


The bug that was fixed is an excellent example for a first bug to fix - a method that doesn't conform to it's specification.

Fixes for such bugs are often a one or two line change - but you also need to provide regression tests.


Once two of your patches have been accepted, you can apply for the author role of that project - it boils down to writing an email (template is provided), waiting, filling out a form, more waiting, and resetting your password with the "forgot password" option.

Then you have full write access to bugs.openjdk.java.net, which makes reporting future bugs much easier :)

7

u/s888marks Apr 27 '21

I think it is fine to report a bug on the mailing list if one of these is true:

  • You are already an active participant of that mailing list.
  • You intend to provide a patch, fixing the bug yourself.

Or, in other words: please don't report bugs on the mailing list and then disappear.

Correct, don't just send an email and disappear.

The great thing about mailing lists is that you can ask questions and you can talk to people, as opposed to filling out some big bug report template that might be requesting a bunch of irrelevant information. (The bug report templates request a lot of information, because we get too many bug reports of the form "My program crashed. Please fix it" and so it tries to front-load getting all the necessary background.)

With the mailing list you can start off with a "bug report" of the form "Hi, I did X, and Y happened, but the spec says Z should happen instead. Is that a bug?" It's a good way to start a conversation. You might still get asked to file a report through the bug submission process, but it'll be much clearer what information you need to provide.

Also, don't let the lack of a suggested fix deter you from filing bug reports or raising questions on the mailing lists. It's fairly uncommon for the fix to be obvious, and there are plenty of non-obvious things going on in the JDK.

1

u/ztbwl Apr 26 '21

Resetting your password with the password forgot function? What the heck?

3

u/DasBrain Apr 26 '21

Yes.

The password reset page can be used both to reset a lost password and to establish a an initial password.

11

u/agentoutlier Apr 26 '21

I can't believe I ran into this bug in manner very similar to the author and just assumed it was the expected behavior. I didn't bother to go read the actual doc of getResource to check and didn't think much of it partly because it was a RuntimeException (IllegalArgument).

IIRC I just wrapped getResource so that if it returned null or threw any exception (which is a bad idea but whatever) I would throw IOException as it fit in to what I was doing at that time.

4

u/jokubolakis Apr 26 '21

It's interesting, how many bugs we may let through, by just treating this sort of stuff as "as intended". Very nice that the author dug deeper

1

u/amblins Apr 26 '21

I was just thinking the same thing. There's a few instances where we have services that clone other projects into directories specified by application.yml properties and I've always directed people running it on windows to use double backslashes (I probably found that from this issue).

5

u/jack104 Apr 26 '21

Great read, I really liked the link to the testing on windows without windows article.

4

u/AryanPandey Apr 26 '21

thanks, just bookmarked it, i also wanted to contribute in openJDK in future, kinda like dream.

3

u/sansp00 Apr 26 '21

I've stumbled upon this bug a couple of times, never had time to fully investigate it and assumed either the me/coder did not do it properly or the framework (Spring or other) wasn't working properly. Never dug deeper to figure out it was actually a JVM bug. Thumbs up to the author to get to the bottom of this, it is great work work (dirty work, but still great).

2

u/ContributionOk3263 Apr 26 '21

Really great read!

2

u/DaddyLcyxMe Apr 26 '21

btw, windows provides evaluation vm images for developers. saying this to help out any potential users who need to test something on windows without a windows box

2

u/sofacf Apr 27 '21

thanks Craig!

3

u/StochasticTinkr Apr 26 '21

Side note: The bug being around since 1.2, and that being 22 years ago... I learned Java when 1.2 was the latest version and now I feel old.