Buggy code:
public class JPADependencyProcessor implements DeploymentUnitProcessor { private static final ModuleIdentifier JAVAX_PERSISTENCE_API_ID = ModuleIdentifier . create ( "javax.persistence.api" ) ; private static final ModuleIdentifier JAVAEE_API_ID = ModuleIdentifier . create ( "javaee.api" ) ; private static final ModuleIdentifier JBOSS_AS_JPA_ID = ModuleIdentifier . create ( "org.jboss.as.jpa" ) ; private static final ModuleIdentifier JBOSS_AS_JPA_SPI_ID = ModuleIdentifier . create ( "org.jboss.as.jpa.spi" ) ; private static final ModuleIdentifier JAVASSIST_ID = ModuleIdentifier . create ( "org.javassist" ) ; private static final ModuleIdentifier HIBERNATE_3_PROVIDER = ModuleIdentifier . create ( "org.jboss.as.jpa.hibernate" , "3" ) ; private static final String HIBERNATE3_PROVIDER_ADAPTOR = "org.jboss.as.jpa.hibernate3.HibernatePersistenceProviderAdaptor" ; private static final ModuleIdentifier HIBERNATE_ENVERS_ID = ModuleIdentifier . create ( "org.hibernate.envers" ) ; private static final ModuleIdentifier JBOSS_AS_NAMING_ID = ModuleIdentifier . create ( "org.jboss.as.naming" ) ; private static final ModuleIdentifier JBOSS_JANDEX_ID = ModuleIdentifier . create ( "org.jboss.jandex" ) ; public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void addDependency ( ModuleSpecification moduleSpecification , ModuleLoader moduleLoader , ModuleIdentifier moduleIdentifier ) { } @ Override public void undeploy ( DeploymentUnit context ) { } private void addPersistenceProviderModuleDependencies ( DeploymentPhaseContext phaseContext , ModuleSpecification moduleSpecification , ModuleLoader moduleLoader ) throws DeploymentUnitProcessingException { } private int loadPersistenceUnits ( final ModuleLoader moduleLoader , final DeploymentUnit deploymentUnit , final Set < String > moduleDependencies , final PersistenceUnitMetadataHolder holder ) throws DeploymentUnitProcessingException { int defaultProviderCount = 0 ; if ( holder != null ) { for ( PersistenceUnitMetadata pu : holder . getPersistenceUnits ( ) ) { String providerModule = pu . getProperties ( ) . getProperty ( PROVIDER_MODULE ) ; String adapterModule = pu . getProperties ( ) . getProperty ( ADAPTER_MODULE ) ; String adapterClass = pu . getProperties ( ) . getProperty ( ADAPTER_CLASS ) ; if ( providerModule != null ) { if ( providerModule . equals ( PROVIDER_MODULE_HIBERNATE3_BUNDLED ) ) { adapterClass = JPADependencyProcessor . HIBERNATE3_PROVIDER_ADAPTOR ; pu . getProperties ( ) . put ( ADAPTER_CLASS , adapterClass ) ; pu . getProperties ( ) . put ( PROVIDER_MODULE , PROVIDER_MODULE_APPLICATION_SUPPLIED ) ; pu . getProperties ( ) . remove ( ADAPTER_MODULE ) ; addHibernate3AdaptorToDeployment ( moduleLoader , deploymentUnit ) ; } else if ( providerModule . equals ( PROVIDER_MODULE_HIBERNATE3 ) ) { if ( adapterModule == null ) { adapterModule = Configuration . ADAPTER_MODULE_HIBERNATE3 ; pu . getProperties ( ) . put ( ADAPTER_MODULE , adapterModule ) ; } } } if ( adapterModule != null ) { JpaLogger . ROOT_LOGGER . debugf ( "%s<seq2seq4repair_space>is<seq2seq4repair_space>configured<seq2seq4repair_space>to<seq2seq4repair_space>use<seq2seq4repair_space>adapter<seq2seq4repair_space>module<seq2seq4repair_space>'%s'" , pu . getPersistenceUnitName ( ) , adapterModule ) ; moduleDependencies . add ( adapterModule ) ; } deploymentUnit . putAttachment ( ADAPTOR_CLASS_NAME , adapterClass ) ; String provider = pu . getProperties ( ) . getProperty ( PROVIDER_MODULE ) ; if ( provider != null ) { if ( provider . equals ( PROVIDER_MODULE_APPLICATION_SUPPLIED ) ) { JpaLogger . ROOT_LOGGER . debugf ( "%s<seq2seq4repair_space>is<seq2seq4repair_space>configured<seq2seq4repair_space>to<seq2seq4repair_space>use<seq2seq4repair_space>application<seq2seq4repair_space>supplied<seq2seq4repair_space>persistence<seq2seq4repair_space>provider" , pu . getPersistenceUnitName ( ) ) ; } else { moduleDependencies . add ( provider ) ; } } else <START_BUG> if ( ( ( pu . getPersistenceProviderClassName ( ) ) == null ) || ( pu . getPersistenceProviderClassName ( ) . equals ( ADAPTER_MODULE_DEFAULT ) ) ) { <END_BUG> defaultProviderCount ++ ; } } } return defaultProviderCount ; } private void addHibernate3AdaptorToDeployment ( final ModuleLoader moduleLoader , final DeploymentUnit deploymentUnit ) { } }

Fix:
if ( PROVIDER_CLASS_DEFAULT . equals ( pu . getPersistenceProviderClassName ( ) ) ) {