use of javax.sql.rowset.serial.SerialException in project jdk8u_jdk by JetBrains.
the class SerialExceptionTests method test05.
/*
* Serialize a SerialException and make sure you can read it back properly
*/
@Test
public void test05() throws Exception {
SerialException e = new SerialException(reason);
SerialException ex1 = createSerializedException(e);
assertTrue(ex1.getMessage().equals(reason) && ex1.getSQLState() == null && ex1.getCause() == null && ex1.getErrorCode() == 0);
;
}
use of javax.sql.rowset.serial.SerialException in project jdk8u_jdk by JetBrains.
the class SerialJavaObjectTests method test02.
/*
* Validate that an getFields()s returns the same Field[] for the object
* used to create the SerialJavaObject
*/
@Test
public void test02() throws Exception {
SerialException e = new SerialException();
SerialJavaObject sjo = new SerialJavaObject(e);
Field[] f = e.getClass().getFields();
assertTrue(Arrays.equals(f, sjo.getFields()));
assertFalse(Arrays.equals("hello".getClass().getFields(), sjo.getFields()));
}
use of javax.sql.rowset.serial.SerialException in project teiid by teiid.
the class TestClobValue method testReferencePersistenceError.
@SuppressWarnings("serial")
@Test
public void testReferencePersistenceError() throws Exception {
// $NON-NLS-1$
String testString = "this is test clob";
SerialClob clob = new SerialClob(testString.toCharArray()) {
@Override
public Reader getCharacterStream() throws SerialException {
throw new SerialException();
}
};
ClobType cv = new ClobType(clob);
cv.setReferenceStreamId(null);
// now force to serialize
ClobType read = UnitTestUtil.helpSerialize(cv);
assertTrue(read.length() > 0);
assertNotNull(read.getReferenceStreamId());
assertNull(read.getReference());
}
use of javax.sql.rowset.serial.SerialException in project open-kilda by telstra.
the class SamlConversionUtil method toUpdateSamlConfigEntity.
/**
* To update saml config entity.
*
* @param samlConfigEntity the saml config entity
* @param roleEntities the role entities
* @param file the metadata file
* @param name the provider name
* @param url the metadata url
* @param entityId the entityId
* @param status the provider status
* @param userCreation the userCreation
* @param attribute the attribute
* @return the requireManagerUpdateStatus
*/
public static boolean toUpdateSamlConfigEntity(SamlConfigEntity samlConfigEntity, Set<RoleEntity> roleEntities, MultipartFile file, String name, String url, String entityId, boolean status, boolean userCreation, String attribute) {
Blob blob = null;
boolean requireManagerUpdate = false;
try {
if (file != null) {
byte[] bytes = file.getBytes();
try {
blob = new SerialBlob(bytes);
} catch (SerialException e) {
LOGGER.error("Error occurred while updating saml provider" + e);
} catch (SQLException e) {
LOGGER.error("Error occurred while updating saml provider" + e);
}
samlConfigEntity.setMetadata(blob);
samlConfigEntity.setType(IConstants.ProviderType.FILE);
requireManagerUpdate = true;
samlConfigEntity.setUrl(null);
} else if (url != null) {
samlConfigEntity.setUrl(url);
samlConfigEntity.setType(IConstants.ProviderType.URL);
requireManagerUpdate = true;
samlConfigEntity.setMetadata(null);
}
samlConfigEntity.setEntityId(entityId);
if (userCreation) {
samlConfigEntity.setUserCreation(true);
if (!samlConfigEntity.getRoles().isEmpty()) {
samlConfigEntity.getRoles().clear();
}
samlConfigEntity.getRoles().addAll(roleEntities);
} else {
samlConfigEntity.setRoles(null);
}
samlConfigEntity.setName(name);
samlConfigEntity.setUserCreation(userCreation);
samlConfigEntity.setAttribute(attribute);
samlConfigEntity.setStatus(status);
} catch (RequestValidationException e) {
throw new RequestValidationException(e.getMessage());
} catch (FileNotFoundException e) {
LOGGER.error("Error occurred while updating saml provider" + e);
} catch (IOException e) {
LOGGER.error("Error occurred while updating saml provider" + e);
}
return requireManagerUpdate;
}
use of javax.sql.rowset.serial.SerialException in project jdk8u_jdk by JetBrains.
the class SerialExceptionTests method test03.
/*
* Validate that the ordering of the returned Exceptions is correct using
* for-each loop
*/
@Test
public void test03() {
SerialException ex = new SerialException("Exception 1");
ex.initCause(t1);
SerialException ex1 = new SerialException("Exception 2");
SerialException ex2 = new SerialException("Exception 3");
ex2.initCause(t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
Aggregations