use of java.sql.DataTruncation in project jdk8u_jdk by JetBrains.
the class DataTruncationTests method test5.
/**
* Serialize a DataTruncation and make sure you can read it back properly
*/
@Test
public void test5() throws Exception {
DataTruncation e = new DataTruncation(index, parameter, onRead, dataSize, transferSize);
DataTruncation ex1 = createSerializedException(e);
assertTrue(e.getMessage().equals(dtReason) && e.getSQLState().equals(READ_TRUNCATION) && e.getCause() == null && e.getErrorCode() == dterrorCode && e.getParameter() == parameter && e.getRead() == onRead && e.getDataSize() == dataSize && e.getTransferSize() == transferSize && e.getIndex() == index);
}
use of java.sql.DataTruncation in project jdk8u_jdk by JetBrains.
the class DataTruncationTests method test2.
/**
* Create DataTruncation object indicating a truncation on read with a
* Throwable
*/
@Test
public void test2() {
onRead = true;
DataTruncation e = new DataTruncation(index, parameter, onRead, dataSize, transferSize, t);
assertTrue(e.getMessage().equals(dtReason) && e.getSQLState().equals(READ_TRUNCATION) && cause.equals(e.getCause().toString()) && e.getErrorCode() == dterrorCode && e.getParameter() == parameter && e.getRead() == onRead && e.getDataSize() == dataSize && e.getTransferSize() == transferSize && e.getIndex() == index);
}
use of java.sql.DataTruncation in project jdk8u_jdk by JetBrains.
the class DataTruncationTests method test3.
/**
* Create DataTruncation object indicating a truncation on read with null
* specified for the Throwable
*/
@Test
public void test3() {
onRead = true;
;
DataTruncation e = new DataTruncation(index, parameter, onRead, dataSize, transferSize, null);
assertTrue(e.getMessage().equals(dtReason) && e.getSQLState().equals(READ_TRUNCATION) && e.getCause() == null && e.getErrorCode() == dterrorCode && e.getParameter() == parameter && e.getRead() == onRead && e.getDataSize() == dataSize && e.getTransferSize() == transferSize && e.getIndex() == index);
}
use of java.sql.DataTruncation in project jdk8u_jdk by JetBrains.
the class DataTruncationTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct using
* traditional while loop
*/
@Test
public void test12() {
DataTruncation ex = new DataTruncation(index, parameter, onRead, dataSize, transferSize, t1);
DataTruncation ex1 = new DataTruncation(index, parameter, onRead, dataSize, transferSize);
DataTruncation ex2 = new DataTruncation(index, parameter, onRead, dataSize, transferSize, t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
SQLException sqe = ex;
while (sqe != null) {
assertTrue(dtmsgs[num++].equals(sqe.getMessage()));
Throwable c = sqe.getCause();
while (c != null) {
assertTrue(dtmsgs[num++].equals(c.getMessage()));
c = c.getCause();
}
sqe = sqe.getNextException();
}
}
use of java.sql.DataTruncation in project symmetric-ds by JumpMind.
the class DataService method insertCreateEvent.
public void insertCreateEvent(ISqlTransaction transaction, Node targetNode, TriggerHistory triggerHistory, String routerId, boolean isLoad, long loadId, String createBy) {
Trigger trigger = engine.getTriggerRouterService().getTriggerById(triggerHistory.getTriggerId(), false);
String reloadChannelId = getReloadChannelIdForTrigger(trigger, engine.getConfigurationService().getChannels(false));
Data data = new Data(triggerHistory.getSourceTableName(), DataEventType.CREATE, null, null, triggerHistory, isLoad ? reloadChannelId : Constants.CHANNEL_CONFIG, null, null);
data.setNodeList(targetNode.getNodeId());
try {
if (isLoad) {
insertDataAndDataEventAndOutgoingBatch(transaction, data, targetNode.getNodeId(), routerId, isLoad, loadId, createBy, Status.NE);
} else {
insertData(transaction, data);
}
} catch (UniqueKeyException e) {
if (e.getRootCause() != null && e.getRootCause() instanceof DataTruncation) {
log.error("Table data definition XML was too large and failed. The feature to send table creates during the initial load may be limited on your platform. You may need to set the initial.load.create.first parameter to false.");
}
throw e;
}
}
Aggregations