Update to Java 7: Multi-catch exception handling

The newest upcoming release of Brigade will require Java 7 on the client side, and Java 8 on the server side.  I have spent considerable time lately combing through the code base and optimizing to use the new features in these updated Java versions.

One of my favorites has been the exception “multi-catch” feature added in Java 7.  This allows multiple exception types to be caught and handled using pretty much identical code.  When exceptions of multiple types are possible, pre-Java 7 you would be forced to write “catch” blocks of code to handle each type independently.  Typically, however, there is a lot of similarity in how these exceptions are handled.  After all, whatever you were trying to do failed, and that is the bottom line.  Most common handling involves logging the exception, and maybe displaying a message to the user to indicate that something went wrong.  In switching over to the new multi-catch features, this can be done succinctly in just a couple of lines.

In online game development, there is a lot that can go wrong, typically involving I/O, network, and socket exceptions, let alone game state & database exceptions.  Handling each of these individually was painful and resulted in a lot of needless code bloat, so it is definitely nice to streamline things using this new feature.

If you want to see more detail about the new multi-catch feature, there are some more complete descriptions here and here.

VT-x Not Available in VirtualBox

I was doing some work today in VirtualBox, with a 64-bit Fedora virtual machine that I have used many times in the past, and I was getting a strange error at start up similar to this one:

No virtualization support
VT-x is not available.

A quick search brings up hits that all indicate you need to enable virtualization in your BIOS, and then this problem will be resolved.  However, I hadn’t changed the BIOS and this had worked before, so … was that really the explanation?  I rebooted and checked the BIOS, and sure enough virtualization was enabled, so it was something else.

Strangely enough, it turns out the issue ended up being that VirtualBox for whatever reason does not detect CPU virtualization technology correctly if a feature called Hyper-V is turned on in Windows.  At some point, I imagine I must have enabled this feature for whatever reason.

Drop Hyper-V if you want to run VirtualBox.
Drop Hyper-V if you want to run VirtualBox.

You can get rid of Hyper-V in Windows 8/8.1 by going to Control Panel -> Programs -> Programs and Features -> Turn Windows features on or off and un-checking the top level Hyper-V checkbox shown in the screenshot above.  You will need to click OK a few times and likely reboot, but after that, your 64-bit VirtualBox virtual machines should be back to running good as new.

It would be really nice if this is a bug if the Oracle VirtualBox team would fix the issue, or if it is a known limitation, to at least make the error message a little more accurate to indicate what the problem really is.