Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for intermittent failures in JUnit tests - LobsTest #827

Merged
merged 6 commits into from
Oct 26, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ private void testInvalidLobs(Class lobClass, boolean isResultSet) throws SQLExce
datasize = packetSize;
break;
case 1:
datasize = packetSize + ThreadLocalRandom.current().nextInt(packetSize) + 1;
//NClobs are always 2 bytes per character, generate an even number only
datasize = packetSize + (ThreadLocalRandom.current().nextInt(packetSize/2) * 2);
break;
default:
datasize = packetSize - ThreadLocalRandom.current().nextInt(packetSize);
Expand Down Expand Up @@ -207,11 +208,7 @@ else if (lobClass == Blob.class)
}
if (!verified) {
// Odd CharacterStream length will throw this exception
if (!e.getMessage().contains(TestResource.getResource("R_badStreamLength")))

{
if (lobClass == DBCharacterStream.class || lobClass == DBBinaryStream.class)
assertTrue(e.getSQLState() != null, TestResource.getResource("R_SQLStateNull"));
if (!e.getMessage().contains(TestResource.getResource("R_badStreamLength"))) {
assertTrue(e.getMessage().contains(TestResource.getResource("R_streamReadError")));
}

Expand Down