Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static boolean parseBool(String bool, boolean def) { if (bool == null || bool.equals("")) { return def; } else { return Boolean.valueOf(bool); } //else //else // throw new SAXException("Expected a boolean, got'"+bool+"'"); } }