Another thing to consider to be safe around batteries is this: Maybe the OP can say why it is the battery that exploded was removed from the car/truck or whatever it was being used in prior to it exploding?
I suspect that had the electrical system the battery was attached to been thoroughly examined it would likely have shown the charging system was OVERcharging it, to the point where when the charger was attached to it the critical point had been reached and it blew up.
For reference, most any system putting out more then 14.5 Volts while being tested is OVERcharging. When a system fails to control the voltage output back to the battery, because of a defective voltage regulator, whether built into the alternator or housed separately, the battery can, up to a point take an overcharge, until it can't, at which point it will explode or otherwise fail catastrophically.
A broken charging system can send overvoltage of 17+ Volts back to a battery, and boil it's internal fluids, which will create a very unstable battery that can/will explode without any warning.
Things like boiled out acid on the surfaces of a battery, along with being hooked to a shop charger can be all it takes for the acid mix and gasses produced by the overcharged battery to become a lethal combination. The acid mix can become the equivalent of putting a piece of metal like a wrench between the posts, causing a dead short and then boom. A spark is the most likely, BUT not the only condition necessary for an explosion to take place.
If there are any doubts AFTER performing an output voltage test on a battery- let it sit in the vehicle for several hours BEFORE removing it. ALWAYS disconnect ground cable first and hot cable last when removing a 12 Volt negative ground system. And when installing positive post first, ground cable last, with the ignition key off and removed from the ignition.