Rob Spoor

+ Follow
since Oct 27, 2005
Rob likes ...
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads

Recent posts by Rob Spoor

If Lombok generates your equals and hashCode methods I personally wouldn't spend time testing it. They know what you're doing, and you'd be testing Lombok more than your own code.
If your IDE generates your equals and hashCode methods you need to test it thoroughly. Sure, what it has generated now will work just fine, but if you add a field and forget to update equals and/or hashCode, your method(s) may be broken.

I like to take control, so I write my own (parameterized) equals tests. What I basically do is create one instance, then compare it with:
* itself
* null
* a different type (usually a String)
* for each field, an object of the same type with just that field set differently

Because I always use Objects.equals for nullable fields I don't bother checking with null and non-null separately. If you'd do that, you get 4 tests for each field for the null / non-null combinations (although you can combine a few).

As for hashCode, I don't really test that as well. I do test that the object's hashCode is the same when called twice, and that it's the same as an equal object. If fields are not used in hashCode you'd need to test with objects with different values for these fields as well.
18 hours ago

Gourav Das wrote:

The NumberFormatException tells you what the input was. In this case it was null, which simply means that the "name" parameter was not sent correctly. This probably occurs because the first time you go to this URL, you don't pass the "name" parameter yet.
1 day ago
With all those duplicate calls to get, I just have to improve it...

2 days ago
Java looks at the declared type, not the actual type, when determining which methods can be called. The declared type is not your anonymous inner class' type, but Main. Since that has no init method, you can't call it.
3 days ago
Get the Location header, then extract the number from that.
3 days ago

Jack Tauson wrote:Also, in the above lines, where is an empty line? Thanks

It's not there, Ron forgot it.
6 days ago
Line 8 is also interesting. Since you do the splitting on tabs yourself, what does it now do?
6 days ago

Ron McLeod wrote:Would create a request which would look like this:

There will be an empty line (\r\n) between the Host header line and the body. That's how HTTP determines where headers end and the body begins.
1 week ago
@Eleni, if it still does not work, can you show the results of adding the following inside your loop?
1 week ago
If you're seeing that output, then you have a List<List<String[]>>. I don't see that in the code you've provided, so it's somewhere in the code you haven't shown us.
1 week ago
Another issue may be SSL certificates. Those may not be available for a wildcard domain, and not every company feels comfortable using Let's Encrypt.
1 week ago
That latter is expected, because (unfortunately) arrays inherit their toString (and equals and hashCode) implementations from Object. That means they get something that looks very cryptic. In this case, the [ indicates it's an array; the Ljava.lang.String; is the array's component type (so it's a String[]), and then come the @ and the system hash code in HEX.
1 week ago
You can (probably) also do this with one host. Just use a <Location> (or <LocationMatch>) element in your Apache configuration, and define the custom routing there. Note that the location matters, at least if you're using multiple <Location> and/or <LocationMatch> elements - as far as I know, they are evaluated from top to bottom.
1 week ago
To control over how errors are handled, I suggest you take a look at

However, I'd say the more pressing concern is the actual error. There's apparently something going wrong in your 'add-customer.htm' Thymeleaf template, on line 39, column 52. The logs should show you more information, but that's where you now need to focus on first.
1 week ago
nextLine still needs to be split. You had that part before, so why did you remove it?

Also, there's no need to turn a List (or Set, or any Collection) into an array before iterating over it. You can simply replace tempsArray with temps in your loop.
1 week ago