/**
* Makes sure an {@link OutOfMemoryError} isn't swallowed.
*/
public void testOutOfMemoryError() throws Exception {
pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
public Object makeObject() throws Exception {
throw new OutOfMemoryError();
}
});
try {
pool.borrowObject();
fail("Expected out of memory.");
}
catch (OutOfMemoryError ex) {
// expected
}
pool.close();
pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
public Object makeObject() throws Exception {
return new Object();
}
public boolean validateObject(Object obj) {
throw new OutOfMemoryError();
}
});
try {
pool.borrowObject();
fail("Expected out of memory.");
}
catch (OutOfMemoryError ex) {
// expected
}
pool.close();
pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
public Object makeObject() throws Exception {
return new Object();
}
public boolean validateObject(Object obj) {