Code example for ParseException

0
    private final static int readSeconds(Calendar cal, String str, int off) throws ParseException {
        if (str.length() >= off + 2) {
            cal.set(Calendar.SECOND, Integer.parseInt(str.substring(off, off+2)));
            return off + 2;
        } 
        throw new ParseException("Invalid seconds in date '"+str+"'", off);
    } 
     
    /** 
     * Return -1 if no more content to read or the offset of the expected TZ 
     * @param cal 
     * @param str 
     * @param off 
     * @return 
     * @throws ParseException 
     */ 
    private final static int readMilliseconds(Calendar cal, String str, int off) throws ParseException {
        int e = str.indexOf('Z', off);
        if (e == -1) {
            e = str.indexOf('+', off);
            if (e == -1) {