Serious threats and "joke" threats are not always easy to tell apart. And dismissing serious threats as "it's probably a joke" can be very dangerous. Of course you shouldn't be imprisoned for a stupid joke, but any threat that looks serious has to be investigated.
And people shouldn't assume they can do stupid things with impunity just because they _meant_ it as a joke. Some stupid jokes are far more stupid than people realize, and can really hurt people, directly or indirectly.
This wasn't a specifically targeted threat, but some "joke" threats are targeted, and the target can't always tell whether it's serious or a stupid joke. And assuming all threats are jokes means that the serious ones get ignored. And sometimes some real bastards hide behind "it's just a joke. Can't you take a joke?" while they're threatening and intimidating people.
And considering how easy it is to simply not make "joke" threats, I'd rather see threats taken too seriously than ignored.
Yes, the corruption and travesty of justice after the arrest is horrible, and (yet another) sign that something is really rotten in US law enforcement. But in principle, detaining someone who says he's going to shoot up a school is a sensible precaution. Don't want to be detained? Easy: don't say you're going to shoot people.