Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[AS7-3175] NPE in <recovery>

  • Loading branch information...
commit 3510dcf28be8fa769651e3cd559302703e41c43b 1 parent 1bee6b2
Jesper Pedersen authored stuartwdouglas committed
View
16 connector/src/main/java/org/jboss/as/connector/subsystems/datasources/DataSourceModelNodeUtil.java
@@ -271,13 +271,19 @@ static ModifiableXaDataSource xaFrom(final OperationContext operationContext, fi
final String recoveryUsername = getStringIfSetOrGetDefault(dataSourceNode, RECOVERY_USERNAME, null);
final String recoveryPassword = getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_PASSWORD, null);
final String recoverySecurityDomain = getStringIfSetOrGetDefault(dataSourceNode, RECOVERY_SECURITY_DOMAIN, null);
- final Boolean noRecovery = getBooleanIfSetOrGetDefault(dataSourceNode, NO_RECOVERY, null);
+ Boolean noRecovery = getBooleanIfSetOrGetDefault(dataSourceNode, NO_RECOVERY, null);
Recovery recovery = null;
- if (recoveryUsername != null || recoveryPassword != null || recoverySecurityDomain != null ||
- (noRecovery != null && noRecovery.booleanValue())) {
- final Credential credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoverySecurityDomain);
- final Extension recoverPlugin = extractExtension(dataSourceNode, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES);
+ if ((recoveryUsername != null && recoveryPassword != null) || recoverySecurityDomain != null || noRecovery != null) {
+ Credential credential = null;
+
+ if ((recoveryUsername != null && recoveryPassword != null) || recoverySecurityDomain != null)
+ credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoverySecurityDomain);
+
+ Extension recoverPlugin = extractExtension(dataSourceNode, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES);
+
+ if (noRecovery == null)
+ noRecovery = Boolean.FALSE;
recovery = new Recovery(credential, recoverPlugin, noRecovery);
}
View
18 connector/src/main/java/org/jboss/as/connector/subsystems/resourceadapters/RaOperationUtil.java
@@ -164,15 +164,21 @@ public static ModifiableConnDef buildConnectionDefinitionObject(final OperationC
//TODO This will be cleaned up once it uses attribute definitions
String recoveryPassword = getResolvedStringIfSetOrGetDefault(context, operation, RECOVERY_PASSWORD.getName(), null);
final String recoverySecurityDomain = getStringIfSetOrGetDefault(operation, RECOVERY_SECURITY_DOMAIN.getName(), null);
- final Boolean noRecovery = getBooleanIfSetOrGetDefault(operation, NO_RECOVERY.getName(), null);
+ Boolean noRecovery = getBooleanIfSetOrGetDefault(operation, NO_RECOVERY.getName(), null);
Recovery recovery = null;
- if (recoveryUsername != null || recoveryPassword != null || recoverySecurityDomain != null ||
- (noRecovery != null && noRecovery.booleanValue())) {
- final Credential credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoverySecurityDomain);
+ if ((recoveryUsername != null && recoveryPassword != null) || recoverySecurityDomain != null || noRecovery != null) {
+ Credential credential = null;
- final Extension recoverPlugin = extractExtension(operation, RECOVERLUGIN_CLASSNAME.getName(), RECOVERLUGIN_PROPERTIES.getName());
- recovery = new Recovery(credential, recoverPlugin, noRecovery);
+ if ((recoveryUsername != null && recoveryPassword != null) || recoverySecurityDomain != null)
+ credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoverySecurityDomain);
+
+ Extension recoverPlugin = extractExtension(operation, RECOVERLUGIN_CLASSNAME.getName(), RECOVERLUGIN_PROPERTIES.getName());
+
+ if (noRecovery == null)
+ noRecovery = Boolean.FALSE;
+
+ recovery = new Recovery(credential, recoverPlugin, noRecovery);
}
ModifiableConnDef connectionDefinition = new ModifiableConnDef(configProperties, className, jndiName, poolName,
enabled, useJavaContext, useCcm, pool, timeOut, validation, security, recovery);
Please sign in to comment.
Something went wrong with that request. Please try again.