Package com.foundationdb.server.error

Examples of com.foundationdb.server.error.InvalidDateFormatException


        switch(type) {
            case DATE_ST:
            case DATETIME_ST:
                return encodeDate(dt);
        }
        throw new InvalidDateFormatException("date", input);
    }
View Full Code Here


    }

    /** Parse an *external* datetime long (e.g. YYYYMMDDHHMMSS => 20130130) into a array. */
    public static long[] parseDateTime(long val) {
        if((val != 0) && (val <= 100)) {
            throw new InvalidDateFormatException("date", Long.toString(val));
        }
        // Pad out HHMMSS if needed
        if(val < DATETIME_MONTH_SCALE) {
            val *= DATETIME_DATE_SCALE;
        }
        // External is same as internal, though a two-digit year may need converted
        long[] dt = decodeDateTime(val);
        if(val != 0) {
            dt[YEAR_INDEX] = adjustTwoDigitYear(dt[YEAR_INDEX]);
        }
        if(!isValidDateTime_Zeros(dt)) {
            throw new InvalidDateFormatException("date", Long.toString(val));
        }
        if(!isValidHrMinSec(dt, true, true)) {
            throw new InvalidDateFormatException("datetime", Long.toString(val));
        }
        return dt;
    }
View Full Code Here

        switch(type) {
            case DATE_ST:
            case DATETIME_ST:
                return encodeDateTime(dt);
        }
        throw new InvalidDateFormatException("datetime", input);
    }
View Full Code Here

                    break;
                }
                // fall
            break;
            default:
                throw new InvalidDateFormatException("TIME", string);

        }
        if(!isValidHrMinSec(dt, false, false)) {
            throw new InvalidDateFormatException("time", string);
        }
        return encodeTime(dt, context);
    }
View Full Code Here

            case DATE_ST:
            case DATETIME_ST:
                return encodeTimestamp(dt, tz, context);
            default:
                // e.g. SELECT UNIX_TIMESTAMP('1920-21-01 00:00:00') -> 0
                context.warnClient(new InvalidDateFormatException("timestamp", input));
                return 0;
        }
    }
View Full Code Here

                    tz = tz.toUpperCase();
                }
                return DateTimeZone.forID(tz);
            }
        } catch(IllegalArgumentException e) {
            throw new InvalidDateFormatException("timezone", tz);
        }
    }
View Full Code Here

        int date = inputs.get(0).getInt32();
        long ymd[] = MDateAndTime.decodeDate(date);
        int mode = getMode(context, inputs);
        if (!MDateAndTime.isValidDateTime(ymd, ZeroFlag.YEAR) || mode < 0)
        {
            context.warnClient(new InvalidDateFormatException("date", Integer.toString(date)));
            output.putNull();
        }
        else
        {
            output.putInt32(modes[(int) mode].getWeek(new MutableDateTime(DateTimeZone.forID(context.getCurrentTimezone())),
View Full Code Here

        ValueSource arg0 = inputs.get(pos0);
        long ymd[] = firstArg.decode(arg0, context);
        if (ymd == null)
        {
            output.putNull();
            context.warnClient(new InvalidDateFormatException("DATE", arg0.toString()));
        }
        else
        {
            MutableDateTime dt = MDateAndTime.toJodaDateTime(ymd, "UTC");    // calculations should be done
            helper.compute(dt, secondArg.toMillis(inputs.get(pos1)));      // in UTC (to avoid daylight-saving side effects)
View Full Code Here

            try
            {
                stType = MDateAndTime.parseDateOrTime(arg0, ymd);
                if (!MDateAndTime.isValidType(stType))
                {
                    context.warnClient(new InvalidDateFormatException(stType.name(), arg0));
                    output.putNull();
                    return;
                }
                millis = secondArg.toMillis(inputs.get(pos1));
            }
View Full Code Here

        int date = inputs.get(0).getInt32();
        long ymd[] = MDateAndTime.decodeDate(date);
        int mode = getMode(context, inputs);
        if (!MDateAndTime.isValidDateTime(ymd, ZeroFlag.YEAR) || mode < 0)
        {
            context.warnClient(new InvalidDateFormatException("Invalid DATE value " , date + ""));
            output.putNull();
        }
        else
        {
            output.putInt32(modes[(int) mode].getYearWeek(new MutableDateTime(DateTimeZone.forID(context.getCurrentTimezone())),
View Full Code Here

TOP

Related Classes of com.foundationdb.server.error.InvalidDateFormatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.