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

PAYARA-2056 NPE at PoolManagerImpl.handleLazilyAssociatedConnectionPools() #2006

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -609,32 +609,44 @@ private void handleLazilyAssociatedConnectionPools(Object comp, ComponentInvocat
return;
}

if (list.size() == 0) return;
if (list.isEmpty()) return;

ResourceHandle[] handles = new ResourceHandle[list.size()];
handles = (ResourceHandle[]) list.toArray(handles);
for (ResourceHandle h : handles) {
if (h == null) {
_logger.log(Level.WARNING, "lazy_association.lazy_association_resource_handle");
continue;
}
ResourceSpec spec = h.getResourceSpec();
if (spec == null) {
_logger.log(Level.WARNING, "lazy_association.lazy_association_resource_spec");
continue;
}
if (spec.isLazyAssociatable()) {
//In this case we are assured that the managedConnection is
//of type DissociatableManagedConnection
javax.resource.spi.DissociatableManagedConnection mc =
(javax.resource.spi.DissociatableManagedConnection) h.getResource();
if (h.isEnlisted()) {
getResourceManager(spec).delistResource(
h, XAResource.TMSUCCESS);
}
try {
mc.dissociateConnections();
} catch (ResourceException re) {
InvocationException ie = new InvocationException(
re.getMessage());
ie.initCause(re);
throw ie;
} finally {
if (h.getResourceState().isBusy()) {
putbackDirectToPool(h, spec.getPoolInfo());
if (h.getResource() != null) {
javax.resource.spi.DissociatableManagedConnection mc
= (javax.resource.spi.DissociatableManagedConnection) h.getResource();
if (h.isEnlisted()) {
getResourceManager(spec).delistResource(
h, XAResource.TMSUCCESS);
}
try {
mc.dissociateConnections();
} catch (ResourceException re) {
InvocationException ie = new InvocationException(
re.getMessage());
ie.initCause(re);
throw ie;
} finally {
if (h.getResourceState().isBusy()) {
putbackDirectToPool(h, spec.getPoolInfo());
}
}
} else {
_logger.log(Level.WARNING, "lazy_association.lazy_association_resource");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ rardeployment.resource_jndi_bind_failure=RAR8072 : Failed to publish resource {0
RAR8072.diag.check.1=Check whether the connection pool exists.
RAR8072.diag.check.2=Check whether the connection pool configuration is valid.
RAR8072.diag.check.3=Check whether the resource configuration is valid.
lazy_association.lazy_association_resource_handle=RAR8075: Skipping lazy connection disassociation due to Resource Handle: null
RAR8075.diag.cause.1=Resource Handle Held by the Component is Null.
lazy_association.lazy_association_resource_spec=RAR8076: Skipping lazy connection disassociation due to Resource Spec: null
RAR8076.diag.cause.1=Resource Spec from Resource Handle is Null.
lazy_association.lazy_association_resource=RAR8077: Skipping lazy connection disassociation due to Resource: null
RAR8077.diag.cause.1=Resource from Resource Handle is Null.
#------------------------------------------------------------------------------------------------------
#RAR8010 till RAR8500 reserved for connectors-runtime LogStrings.
#Please increment RAR IDs by one for any new additional messages added here.
Expand Down