Skip to content

Commit

Permalink
Merge pull request wildfly#7778 from bstansberry/pullRequest7370
Browse files Browse the repository at this point in the history
Static analysis fixes
  • Loading branch information
bstansberry committed Jul 17, 2015
2 parents 0bb9dcf + 84ccbe9 commit eac370a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public int hashCode() {

@Override
public boolean equals(Object object) {
if ((object != null) && !(object instanceof HashableMarshalledValue)) {
if (object instanceof HashableMarshalledValue) {
HashableMarshalledValue<?> value = (HashableMarshalledValue<?>) object;
return (this.hashCode == value.hashCode()) && super.equals(object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,22 +201,19 @@ protected synchronized void stopService() {
BootstrapContextCoordinator.getInstance().removeBootstrapContext(deploymentMD.getBootstrapContextIdentifier());
}


}

if (deploymentMD.getDataSources() != null && managementRepositoryValue.getValue() != null) {
for (org.jboss.jca.core.api.management.DataSource mgtDs : deploymentMD.getDataSources()) {
managementRepositoryValue.getValue().getDataSources().remove(mgtDs);
if (deploymentMD.getDataSources() != null && managementRepositoryValue.getValue() != null) {
for (org.jboss.jca.core.api.management.DataSource mgtDs : deploymentMD.getDataSources()) {
managementRepositoryValue.getValue().getDataSources().remove(mgtDs);
}
}
}

if (deploymentMD.getConnectionManagers() != null) {
for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
cm.shutdown();
if (deploymentMD.getConnectionManagers() != null) {
for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
cm.shutdown();
}
}
}


sqlDataSource = null;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

package org.jboss.as.jpa.processor;

import static org.jboss.as.jpa.messages.JpaLogger.ROOT_LOGGER;
import static org.jboss.as.server.Services.addServerExecutorDependency;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
Expand Down Expand Up @@ -106,10 +109,6 @@
import org.jipijapa.plugin.spi.Platform;
import org.jipijapa.plugin.spi.TwoPhaseBootstrapCapable;


import static org.jboss.as.jpa.messages.JpaLogger.ROOT_LOGGER;
import static org.jboss.as.server.Services.addServerExecutorDependency;

/**
* Handle the installation of the Persistence Unit service
*
Expand Down Expand Up @@ -170,12 +169,14 @@ private static void handleWarDeployment(DeploymentPhaseContext phaseContext, boo
PersistenceUnitMetadataHolder holder;
ArrayList<PersistenceUnitMetadataHolder> puList = new ArrayList<PersistenceUnitMetadataHolder>(1);

String deploymentRootName = null;
// handle persistence.xml definition in the root of the war
if (deploymentRoot != null &&
(holder = deploymentRoot.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS)) != null &&
holder.getPersistenceUnits().size() > 0) {
// assemble and install the PU service
puList.add(holder);
deploymentRootName = deploymentRoot.getRootName();
}

// look for persistence.xml in war files in the META-INF/persistence.xml directory
Expand All @@ -195,7 +196,7 @@ private static void handleWarDeployment(DeploymentPhaseContext phaseContext, boo
deploymentUnit.addToAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS, new WebNonTxEmCloserAction());
}

ROOT_LOGGER.tracef("install persistence unit definitions for war %s", deploymentRoot.getRootName());
ROOT_LOGGER.tracef("install persistence unit definitions for war %s", deploymentRootName);
addPuService(phaseContext, puList, startEarly, platform);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public enum BindingType {
}

public static BindingType forName(String localName) {
final BindingType directoryGrouping = localName != null ? MAP.get(localName.toLowerCase()) : null;
if (localName == null) return null;
final BindingType directoryGrouping = MAP.get(localName.toLowerCase());
return directoryGrouping == null ? BindingType.valueOf(localName.toUpperCase()) : directoryGrouping;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public InMemoryDirectoryServiceFactory(DirectoryService directoryService, Partit
* {@inheritDoc}
*/
public void init(String name) throws Exception {
if ((directoryService != null) && directoryService.isStarted()) {
if ((directoryService == null) || directoryService.isStarted()) {
return;
}

Expand Down

0 comments on commit eac370a

Please sign in to comment.