com.mysql.cj.exceptions.DataReadException Java Examples
The following examples show how to use
com.mysql.cj.exceptions.DataReadException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlDateValueFactory.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public Date createFromDate(int year, int month, int day) { synchronized (this.cal) { try { if (year == 0 && month == 0 && day == 0) { throw new DataReadException(Messages.getString("ResultSet.InvalidZeroDate")); } this.cal.clear(); this.cal.set(year, month - 1, day); long ms = this.cal.getTimeInMillis(); return new Date(ms); } catch (IllegalArgumentException e) { throw ExceptionFactory.createException(WrongArgumentException.class, e.getMessage(), e); } } }
Example #2
Source File: SqlTimeValueFactory.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public Time createFromTime(int hours, int minutes, int seconds, int nanos) { if (hours < 0 || hours >= 24) { throw new DataReadException(Messages.getString("ResultSet.InvalidTimeValue", new Object[] { "" + hours + ":" + minutes + ":" + seconds })); } synchronized (this.cal) { try { // c.f. java.sql.Time "The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed." this.cal.set(1970, 0, 1, hours, minutes, seconds); this.cal.set(Calendar.MILLISECOND, 0); long ms = (nanos / 1000000) + this.cal.getTimeInMillis(); return new Time(ms); } catch (IllegalArgumentException e) { throw ExceptionFactory.createException(WrongArgumentException.class, e.getMessage(), e); } } }
Example #3
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public <T> T decodeSet(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { CodedInputStream inputStream = CodedInputStream.newInstance(bytes, offset, length); StringBuilder vals = new StringBuilder(); while (inputStream.getBytesUntilLimit() > 0) { if (vals.length() > 0) { vals.append(","); } long valLen = inputStream.readUInt64(); // TODO: charset vals.append(new String(inputStream.readRawBytes((int) valLen))); } // TODO: charset mess here byte[] buf = vals.toString().getBytes(); return vf.createFromBytes(buf, 0, buf.length); } catch (IOException e) { throw new DataReadException(e); } }
Example #4
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
public <T> T decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT8) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "LONG" })); } // don't use BigInteger unless sign bit is used if ((bytes[offset + 7] & 0x80) == 0) { return this.decodeInt8(bytes, offset, length, vf); } // first byte is 0 to indicate sign byte[] bigEndian = new byte[] { 0, bytes[offset + 7], bytes[offset + 6], bytes[offset + 5], bytes[offset + 4], bytes[offset + 3], bytes[offset + 2], bytes[offset + 1], bytes[offset] }; BigInteger bigInt = new BigInteger(bigEndian); return vf.createFromBigInteger(bigInt); }
Example #5
Source File: MysqlBinaryValueDecoder.java From lams with GNU General Public License v2.0 | 6 votes |
public <T> T decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT8) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "LONG" })); } // don't use BigInteger unless sign bit is used if ((bytes[offset + 7] & 0x80) == 0) { return this.decodeInt8(bytes, offset, length, vf); } // first byte is 0 to indicate sign byte[] bigEndian = new byte[] { 0, bytes[offset + 7], bytes[offset + 6], bytes[offset + 5], bytes[offset + 4], bytes[offset + 3], bytes[offset + 2], bytes[offset + 1], bytes[offset] }; BigInteger bigInt = new BigInteger(bigEndian); return vf.createFromBigInteger(bigInt); }
Example #6
Source File: SqlTimestampValueFactory.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public Timestamp createFromTimestamp(int year, int month, int day, int hours, int minutes, int seconds, int nanos) { if (year == 0 && month == 0 && day == 0) { throw new DataReadException(Messages.getString("ResultSet.InvalidZeroDate")); } synchronized (this.cal) { try { // this method is HUGEly faster than Java 8's Calendar.Builder() this.cal.set(year, month - 1, day, hours, minutes, seconds); Timestamp ts = new Timestamp(this.cal.getTimeInMillis()); ts.setNanos(nanos); return ts; } catch (IllegalArgumentException e) { throw ExceptionFactory.createException(WrongArgumentException.class, e.getMessage(), e); } } }
Example #7
Source File: XProtocolDecoder.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public <T> T decodeSet(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { CodedInputStream inputStream = CodedInputStream.newInstance(bytes, offset, length); StringBuilder vals = new StringBuilder(); while (inputStream.getBytesUntilLimit() > 0) { if (vals.length() > 0) { vals.append(","); } long valLen = inputStream.readUInt64(); // TODO: charset vals.append(new String(inputStream.readRawBytes((int) valLen))); } // TODO: charset mess here byte[] buf = vals.toString().getBytes(); return vf.createFromBytes(buf, 0, buf.length); } catch (IOException e) { throw new DataReadException(e); } }
Example #8
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeFloat(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_FLOAT) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "FLOAT" })); } int asInt = (bytes[offset] & 0xff) | ((bytes[offset + 1] & 0xff) << 8) | ((bytes[offset + 2] & 0xff) << 16) | ((bytes[offset + 3] & 0xff) << 24); return vf.createFromDouble(Float.intBitsToFloat(asInt)); }
Example #9
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT2) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "SHORT" })); } short asShort = (short) ((bytes[offset] & 0xff) | ((bytes[offset + 1] & 0xff) << 8)); return vf.createFromLong(asShort); }
Example #10
Source File: MysqlTextValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeDate(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != DATE_BUF_LEN) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "DATE" })); } int year = StringUtils.getInt(bytes, offset, offset + 4); int month = StringUtils.getInt(bytes, offset + 5, offset + 7); int day = StringUtils.getInt(bytes, offset + 8, offset + 10); return vf.createFromDate(year, month, day); }
Example #11
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeDouble(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_DOUBLE) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "DOUBLE" })); } long valueAsLong = (bytes[offset + 0] & 0xff) | ((long) (bytes[offset + 1] & 0xff) << 8) | ((long) (bytes[offset + 2] & 0xff) << 16) | ((long) (bytes[offset + 3] & 0xff) << 24) | ((long) (bytes[offset + 4] & 0xff) << 32) | ((long) (bytes[offset + 5] & 0xff) << 40) | ((long) (bytes[offset + 6] & 0xff) << 48) | ((long) (bytes[offset + 7] & 0xff) << 56); return vf.createFromDouble(Double.longBitsToDouble(valueAsLong)); }
Example #12
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeDate(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length == 0) { return vf.createFromDate(0, 0, 0); } else if (length != NativeConstants.BIN_LEN_DATE) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "DATE" })); } int year = (bytes[offset] & 0xff) | ((bytes[offset + 1] & 0xff) << 8); int month = bytes[offset + 2]; int day = bytes[offset + 3]; return vf.createFromDate(year, month, day); }
Example #13
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT8) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "LONG" })); } long asLong = (bytes[offset] & 0xff) | ((long) (bytes[offset + 1] & 0xff) << 8) | ((long) (bytes[offset + 2] & 0xff) << 16) | ((long) (bytes[offset + 3] & 0xff) << 24) | ((long) (bytes[offset + 4] & 0xff) << 32) | ((long) (bytes[offset + 5] & 0xff) << 40) | ((long) (bytes[offset + 6] & 0xff) << 48) | ((long) (bytes[offset + 7] & 0xff) << 56); return vf.createFromLong(asLong); }
Example #14
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT4) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "SHORT" })); } int asInt = (bytes[offset] & 0xff) | ((bytes[offset + 1] & 0xff) << 8) | ((bytes[offset + 2] & 0xff) << 16) | ((bytes[offset + 3] & 0xff) << 24); return vf.createFromLong(asInt); }
Example #15
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeUInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length != NativeConstants.BIN_LEN_INT4) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "INT" })); } long asLong = (bytes[offset] & 0xff) | ((bytes[offset + 1] & 0xff) << 8) | ((bytes[offset + 2] & 0xff) << 16) | ((long) (bytes[offset + 3] & 0xff) << 24); return vf.createFromLong(asLong); }
Example #16
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeTimestamp(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length == 0) { return vf.createFromTimestamp(0, 0, 0, 0, 0, 0, 0); } else if (length != NativeConstants.BIN_LEN_DATE && length != NativeConstants.BIN_LEN_TIMESTAMP && length != NativeConstants.BIN_LEN_TIMESTAMP_NO_US) { // the value can be any of these lengths (check protocol docs) throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "TIMESTAMP" })); } int year = 0; int month = 0; int day = 0; int hours = 0; int minutes = 0; int seconds = 0; int nanos = 0; year = (bytes[offset + 0] & 0xff) | ((bytes[offset + 1] & 0xff) << 8); month = bytes[offset + 2]; day = bytes[offset + 3]; if (length > NativeConstants.BIN_LEN_DATE) { hours = bytes[offset + 4]; minutes = bytes[offset + 5]; seconds = bytes[offset + 6]; } if (length > NativeConstants.BIN_LEN_TIMESTAMP_NO_US) { // MySQL PS protocol uses microseconds nanos = 1000 * ((bytes[offset + 7] & 0xff) | ((bytes[offset + 8] & 0xff) << 8) | ((bytes[offset + 9] & 0xff) << 16) | ((bytes[offset + 10] & 0xff) << 24)); } return vf.createFromTimestamp(year, month, day, hours, minutes, seconds, nanos); }
Example #17
Source File: MysqlBinaryValueDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public <T> T decodeTime(byte[] bytes, int offset, int length, ValueFactory<T> vf) { if (length == 0) { return vf.createFromTime(0, 0, 0, 0); } else if (length != NativeConstants.BIN_LEN_TIME && length != NativeConstants.BIN_LEN_TIME_NO_US) { throw new DataReadException(Messages.getString("ResultSet.InvalidLengthForType", new Object[] { length, "TIME" })); } int days = 0; int hours = 0; int minutes = 0; int seconds = 0; int nanos = 0; boolean negative = bytes[offset] == 1; days = (bytes[offset + 1] & 0xff) | ((bytes[offset + 2] & 0xff) << 8) | ((bytes[offset + 3] & 0xff) << 16) | ((bytes[offset + 4] & 0xff) << 24); hours = bytes[offset + 5]; minutes = bytes[offset + 6]; seconds = bytes[offset + 7]; if (negative) { days *= -1; } if (length > NativeConstants.BIN_LEN_TIMESTAMP_NO_US) { // MySQL PS protocol uses microseconds nanos = 1000 * (bytes[offset + 1] & 0xff) | ((bytes[offset + 2] & 0xff) << 8) | ((bytes[offset + 3] & 0xff) << 16) | ((bytes[offset + 4] & 0xff) << 24); } return vf.createFromTime(days * 24 + hours, minutes, seconds, nanos); }
Example #18
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeBit(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { // protobuf stores an unsigned 64bit int into a java long with the highest bit as the sign, we re-interpret it using ByteBuffer (with a prepended // 0-byte to avoid negative) byte[] buf = ByteBuffer.allocate(Long.BYTES + 1).put((byte) 0).putLong(CodedInputStream.newInstance(bytes, offset, length).readUInt64()).array(); return vf.createFromBit(buf, 0, Long.BYTES + 1); } catch (IOException e) { throw new DataReadException(e); } }
Example #19
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeDouble(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { return vf.createFromDouble(CodedInputStream.newInstance(bytes, offset, length).readDouble()); } catch (IOException e) { throw new DataReadException(e); } }
Example #20
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeFloat(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { return vf.createFromDouble(CodedInputStream.newInstance(bytes, offset, length).readFloat()); } catch (IOException e) { throw new DataReadException(e); } }
Example #21
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { // protobuf stores an unsigned 64bit int into a java long with the highest bit as the sign, we re-interpret it using ByteBuffer (with a prepended // 0-byte to avoid negative) BigInteger v = new BigInteger( ByteBuffer.allocate(9).put((byte) 0).putLong(CodedInputStream.newInstance(bytes, offset, length).readUInt64()).array()); return vf.createFromBigInteger(v); } catch (IOException e) { throw new DataReadException(e); } }
Example #22
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { return vf.createFromLong(CodedInputStream.newInstance(bytes, offset, length).readSInt64()); } catch (IOException e) { throw new DataReadException(e); } }
Example #23
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeTimestamp(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { CodedInputStream inputStream = CodedInputStream.newInstance(bytes, offset, length); int year = (int) inputStream.readUInt64(); int month = (int) inputStream.readUInt64(); int day = (int) inputStream.readUInt64(); // do we have a time too? if (inputStream.getBytesUntilLimit() > 0) { int hours = 0; int minutes = 0; int seconds = 0; int nanos = 0; if (!inputStream.isAtEnd()) { hours = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { minutes = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { seconds = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { nanos = 1000 * (int) inputStream.readInt64(); } } } } return vf.createFromTimestamp(year, month, day, hours, minutes, seconds, nanos); } return vf.createFromDate(year, month, day); } catch (IOException e) { throw new DataReadException(e); } }
Example #24
Source File: XProtocolDecoder.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public <T> T decodeTime(byte[] bytes, int offset, int length, ValueFactory<T> vf) { try { CodedInputStream inputStream = CodedInputStream.newInstance(bytes, offset, length); boolean negative = inputStream.readRawByte() > 0; int hours = 0; int minutes = 0; int seconds = 0; int nanos = 0; if (!inputStream.isAtEnd()) { hours = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { minutes = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { seconds = (int) inputStream.readInt64(); if (!inputStream.isAtEnd()) { nanos = 1000 * (int) inputStream.readInt64(); } } } } return vf.createFromTime(negative ? -1 * hours : hours, minutes, seconds, nanos); } catch (IOException e) { throw new DataReadException(e); } }
Example #25
Source File: SqlTimestampValueFactory.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
/** * Create a Timestamp from a TIME value. * * @return a timestamp at the given time on 1970 Jan 1. */ @Override public Timestamp createFromTime(int hours, int minutes, int seconds, int nanos) { if (hours < 0 || hours >= 24) { throw new DataReadException(Messages.getString("ResultSet.InvalidTimeValue", new Object[] { "" + hours + ":" + minutes + ":" + seconds })); } return createFromTimestamp(1970, 1, 1, hours, minutes, seconds, nanos); }
Example #26
Source File: MySQLJDBCReflections.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep void registerExceptionsForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJCommunicationsException.class.getName())); reflectiveClass .produce(new ReflectiveClassBuildItem(false, false, CJConnectionFeatureNotAvailableException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJTimeoutException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJPacketTooBigException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, AssertionFailedException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ClosedOnExpiredPasswordException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ConnectionIsClosedException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataConversionException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataReadException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataTruncationException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DeadlockTimeoutRollbackMarker.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, FeatureNotAvailableException.class.getName())); reflectiveClass .produce(new ReflectiveClassBuildItem(false, false, InvalidConnectionAttributeException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NumberOutOfRange.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, OperationCancelledException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PasswordExpiredException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PropertyNotModifiableException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, RSAException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, SSLParamsException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StatementIsClosedException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StreamingNotifiable.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, UnableToConnectException.class.getName())); reflectiveClass .produce(new ReflectiveClassBuildItem(false, false, UnsupportedConnectionStringException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, WrongArgumentException.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, "com.mysql.cj.jdbc.MysqlXAException")); reflectiveClass .produce(new ReflectiveClassBuildItem(false, false, StandardLoadBalanceExceptionChecker.class.getName())); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NdbLoadBalanceExceptionChecker.class.getName())); }
Example #27
Source File: LocalTimeValueFactory.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public LocalTime createFromTime(int hours, int minutes, int seconds, int nanos) { if (hours < 0 || hours >= 24) { throw new DataReadException(Messages.getString("ResultSet.InvalidTimeValue", new Object[] { "" + hours + ":" + minutes + ":" + seconds })); } return LocalTime.of(hours, minutes, seconds, nanos); }
Example #28
Source File: LocalDateValueFactory.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public LocalDate createFromDate(int year, int month, int day) { if (year == 0 && month == 0 && day == 0) { throw new DataReadException(Messages.getString("ResultSet.InvalidZeroDate")); } return LocalDate.of(year, month, day); }
Example #29
Source File: SqlTimeValueFactory.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Time createFromTime(int hours, int minutes, int seconds, int nanos) { if (hours < 0 || hours >= 24) { throw new DataReadException(Messages.getString("ResultSet.InvalidTimeValue", new Object[] { "" + hours + ":" + minutes + ":" + seconds })); } synchronized (this.cal) { // c.f. java.sql.Time "The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed." this.cal.set(1970, 0, 1, hours, minutes, seconds); this.cal.set(Calendar.MILLISECOND, 0); long ms = (nanos / 1000000) + this.cal.getTimeInMillis(); return new Time(ms); } }
Example #30
Source File: LocalDateTimeValueFactory.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public LocalDateTime createFromTimestamp(int year, int month, int day, int hours, int minutes, int seconds, int nanos) { if (year == 0 && month == 0 && day == 0) { throw new DataReadException(Messages.getString("ResultSet.InvalidZeroDate")); } return LocalDateTime.of(year, month, day, hours, minutes, seconds, nanos); }