paul paul -4 years ago 151
Scala Question

delete this please

This question is not longer valid and because seems people getting annoying, it would be good if can be deleted

Answer Source

Can val jsonAlbum= new JSONObject(json.asInstanceOf[Map[String, Any]]) throw NoSuchElementException? If not, just declare jsonAlbum before that try/catch block. If yes, you wouldn't see correct value of jsonAlbum in catch block anyway, because it's creation failed.

Note that you can use something like

val a = try { ... } catch { ... }

if you want to keep visibility without code garbage.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download