private void setTimeZone(String line) throws JBookTraderException { String timeZone = line.substring(line.indexOf('=') + 1); TimeZone tz = TimeZone.getTimeZone(timeZone); if (!tz.getID().equals(timeZone)) { String msg = "The specified time zone " + "\"" + timeZone + "\"" + " does not exist." + LINE_SEP; msg += "Examples of valid time zones: " + " America/New_York, Europe/London, Asia/Singapore."; throw new JBookTraderException(msg); } sdf = new SimpleDateFormat("MMddyyHHmmss"); // Enforce strict interpretation of date and time formats sdf.setLenient(false); sdf.setTimeZone(tz); }