[JBoss JIRA] (ELY-1618) TLS with BCJSSE Provider does not work
by Martin Choma (JIRA)
[ https://issues.jboss.org/browse/ELY-1618?page=com.atlassian.jira.plugin.s... ]
Martin Choma commented on ELY-1618:
-----------------------------------
[~fjuma] [~dlofthouse] FYI
> TLS with BCJSSE Provider does not work
> --------------------------------------
>
> Key: ELY-1618
> URL: https://issues.jboss.org/browse/ELY-1618
> Project: WildFly Elytron
> Issue Type: Bug
> Components: SSL
> Affects Versions: 1.4.0.Final
> Reporter: Martin Choma
> Priority: Blocker
>
> When I configure BouncyCastleJsseProvider to by only possible provider providing TLS TLS does not work with exception
> {code}
> 14:07:53,905 TRACE [org.wildfly.security] (MSC service thread 1-4) No SSLContext provided by providers in SSLUtils: [BCFIPS version 1.01, BCJSSE version 1.0005, SUN version 1.8, ApacheXMLDSig version 2.11, SunJCE version 1.8, TLSP version 1.0, WildFlyElytron version 1.0]
> 14:07:53,906 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service org.wildfly.security.ssl-context.test-server-ssl-context: org.jboss.msc.service.StartException in service org.wildfly.security.ssl-context.test-server-ssl-context: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:926)
> at org.wildfly.extension.elytron.TrivialService.start(TrivialService.java:53)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
> at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
> at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> at org.wildfly.security.ssl.SSLUtils.throwIt(SSLUtils.java:142)
> at org.wildfly.security.ssl.SSLContextBuilder.lambda$build$0(SSLContextBuilder.java:340)
> at org.wildfly.security.OneTimeSecurityFactory.create(OneTimeSecurityFactory.java:53)
> at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:924)
> ... 9 more
> 14:07:53,910 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("add") failed - address: ([
> ("subsystem" => "elytron"),
> ("server-ssl-context" => "test-server-ssl-context")
> ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.security.ssl-context.test-server-ssl-context" => "java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria"}}
> {code}
> After debugging it seems problem is this:
> Supported protocols resolved from BCJSSE version 1.0005 are [TLS, TLSV1, TLSV1.2, DEFAULT, TLSV1.1]
> Whereas Elytron class org.wildfly.security.ssl.Protocol use constants TLSv1, TLSv1.1, TLSv1.2, ... It means lower case "v"
> And thus ProtocolSelector.evaluate does return empty set.
> Possible solution to this particular problem will be make Protocol case insensitive. It means define enum constants in upper case and adjust methods to use .toUpperCase(). But I am probably not aware of all consequences of such change.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months
[JBoss JIRA] (ELY-1618) TLS with BCJSSE Provider does not work
by Martin Choma (JIRA)
Martin Choma created ELY-1618:
---------------------------------
Summary: TLS with BCJSSE Provider does not work
Key: ELY-1618
URL: https://issues.jboss.org/browse/ELY-1618
Project: WildFly Elytron
Issue Type: Bug
Components: SSL
Affects Versions: 1.4.0.Final
Reporter: Martin Choma
Priority: Blocker
When I configure BouncyCastleJsseProvider to by only possible provider providing TLS TLS does not work with exception
{code}
14:07:53,905 TRACE [org.wildfly.security] (MSC service thread 1-4) No SSLContext provided by providers in SSLUtils: [BCFIPS version 1.01, BCJSSE version 1.0005, SUN version 1.8, ApacheXMLDSig version 2.11, SunJCE version 1.8, TLSP version 1.0, WildFlyElytron version 1.0]
14:07:53,906 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service org.wildfly.security.ssl-context.test-server-ssl-context: org.jboss.msc.service.StartException in service org.wildfly.security.ssl-context.test-server-ssl-context: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:926)
at org.wildfly.extension.elytron.TrivialService.start(TrivialService.java:53)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
at org.wildfly.security.ssl.SSLUtils.throwIt(SSLUtils.java:142)
at org.wildfly.security.ssl.SSLContextBuilder.lambda$build$0(SSLContextBuilder.java:340)
at org.wildfly.security.OneTimeSecurityFactory.create(OneTimeSecurityFactory.java:53)
at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:924)
... 9 more
14:07:53,910 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "elytron"),
("server-ssl-context" => "test-server-ssl-context")
]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.security.ssl-context.test-server-ssl-context" => "java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria"}}
{code}
After debugging it seems problem is this:
Supported protocols resolved from BCJSSE version 1.0005 are [TLS, TLSV1, TLSV1.2, DEFAULT, TLSV1.1]
Whereas Elytron class org.wildfly.security.ssl.Protocol use constants TLSv1, TLSv1.1, TLSv1.2, ... It means lower case "v"
And thus ProtocolSelector.evaluate does return empty set.
Possible solution to this particular problem will be make Protocol case insensitive. It means define enum constants in upper case and adjust methods to use .toUpperCase(). But I am probably not aware of all consequences of such change.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months
[JBoss JIRA] (ELY-1618) TLS with BCJSSE Provider does not work
by Martin Choma (JIRA)
[ https://issues.jboss.org/browse/ELY-1618?page=com.atlassian.jira.plugin.s... ]
Martin Choma updated ELY-1618:
------------------------------
Steps to Reproduce:
* install bc fips in java.security
security.provider.1=org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider fips:BCFIPS
security.provider.3=sun.security.provider.Sun
* remove openssl provider from standalone.xml
* try TLS
was:
* install bc fips in java.security
security.provider.1=org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider fips:BCFIPS
security.provider.3=sun.security.provider.Sun
* remove openssl provider from standalone.xml
> TLS with BCJSSE Provider does not work
> --------------------------------------
>
> Key: ELY-1618
> URL: https://issues.jboss.org/browse/ELY-1618
> Project: WildFly Elytron
> Issue Type: Bug
> Components: SSL
> Affects Versions: 1.4.0.Final
> Reporter: Martin Choma
> Priority: Blocker
>
> When I configure BouncyCastleJsseProvider to by only possible provider providing TLS TLS does not work with exception
> {code}
> 14:07:53,905 TRACE [org.wildfly.security] (MSC service thread 1-4) No SSLContext provided by providers in SSLUtils: [BCFIPS version 1.01, BCJSSE version 1.0005, SUN version 1.8, ApacheXMLDSig version 2.11, SunJCE version 1.8, TLSP version 1.0, WildFlyElytron version 1.0]
> 14:07:53,906 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service org.wildfly.security.ssl-context.test-server-ssl-context: org.jboss.msc.service.StartException in service org.wildfly.security.ssl-context.test-server-ssl-context: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:926)
> at org.wildfly.extension.elytron.TrivialService.start(TrivialService.java:53)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
> at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
> at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> at org.wildfly.security.ssl.SSLUtils.throwIt(SSLUtils.java:142)
> at org.wildfly.security.ssl.SSLContextBuilder.lambda$build$0(SSLContextBuilder.java:340)
> at org.wildfly.security.OneTimeSecurityFactory.create(OneTimeSecurityFactory.java:53)
> at org.wildfly.extension.elytron.SSLDefinitions$6.lambda$getValueSupplier$1(SSLDefinitions.java:924)
> ... 9 more
> 14:07:53,910 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("add") failed - address: ([
> ("subsystem" => "elytron"),
> ("server-ssl-context" => "test-server-ssl-context")
> ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.security.ssl-context.test-server-ssl-context" => "java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria
> Caused by: java.security.NoSuchAlgorithmException: ELY04001: No algorithm found matching TLS/SSL protocol selection criteria"}}
> {code}
> After debugging it seems problem is this:
> Supported protocols resolved from BCJSSE version 1.0005 are [TLS, TLSV1, TLSV1.2, DEFAULT, TLSV1.1]
> Whereas Elytron class org.wildfly.security.ssl.Protocol use constants TLSv1, TLSv1.1, TLSv1.2, ... It means lower case "v"
> And thus ProtocolSelector.evaluate does return empty set.
> Possible solution to this particular problem will be make Protocol case insensitive. It means define enum constants in upper case and adjust methods to use .toUpperCase(). But I am probably not aware of all consequences of such change.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months
[JBoss JIRA] (DROOLS-2564) [DMN Designer] Data-types: Grid: General
by Michael Anstis (JIRA)
[ https://issues.jboss.org/browse/DROOLS-2564?page=com.atlassian.jira.plugi... ]
Michael Anstis edited comment on DROOLS-2564 at 7/27/18 8:53 AM:
-----------------------------------------------------------------
*_General_*
- (x) {{<< Back to XXX}} does not update if name changed in Properties panel
- (/) "TypeRef" on Properties panel should show "Output Data Type"
was (Author: manstis):
*_General_*
- (x) {{<< Back to XXX}} does not update if name changed in Properties panel
- (x) "TypeRef" on Properties panel should show "Output Data Type"
> [DMN Designer] Data-types: Grid: General
> ----------------------------------------
>
> Key: DROOLS-2564
> URL: https://issues.jboss.org/browse/DROOLS-2564
> Project: Drools
> Issue Type: Feature Request
> Components: DMN Editor
> Reporter: Michael Anstis
> Assignee: Michael Anstis
>
> Different types of Expression (the grid-view) should support defining the input and output data-types. I am leaving implementation of this until the ability to use and define data-types at the graph-view is fully complete; as the scenarios required by this JIRA will re-use the same components.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months
[JBoss JIRA] (WFLY-10752) [WFLY13] NPE on deploy, when Email validation annotation present
by d3coder d3coder (JIRA)
[ https://issues.jboss.org/browse/WFLY-10752?page=com.atlassian.jira.plugin... ]
d3coder d3coder updated WFLY-10752:
-----------------------------------
Description:
I'm making simple app. In one of my DTO's i have field with `javax.validation.constraints.Email` annotation. When this annotation present, wildfly fails to deploy my app with this exception:
https://gist.github.com/XakepSDK/daa2531203b365ad1969e01b4466b8a1
My DTO class:
https://gist.github.com/XakepSDK/a78245b262315437d2800be524018d2e
CrossField annotation:
https://gist.github.com/XakepSDK/a78245b262315437d2800be524018d2e
CrossField validator:
https://gist.github.com/XakepSDK/391783e3b79f839a93a8f45c886b38e0
was:
I'm making simple app. In one of my DTO's i have field with `javax.validation.constraints.Email` annotation. When this annotation present, wildfly fails to deploy my app with this exception:
```
java.lang.NullPointerException
at sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
at sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.<init>(AnnotatedTypeFactory.java:139)
at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
at java.lang.reflect.Field.getAnnotatedType(Field.java:1170)
at org.hibernate.validator.internal.metadata.provider.TypeAnnotationAwareMetaDataProvider.findTypeAnnotationConstraintsForMember(TypeAnnotationAwareMetaDataProvider.java:65)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.findPropertyMetaData(AnnotationMetaDataProvider.java:244)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getFieldMetaData(AnnotationMetaDataProvider.java:227)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.retrieveBeanConfiguration(AnnotationMetaDataProvider.java:137)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfiguration(AnnotationMetaDataProvider.java:125)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfigurationForHierarchy(AnnotationMetaDataProvider.java:108)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.createBeanMetaData(BeanMetaDataManager.java:203)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getOrCreateBeanMetaData(BeanMetaDataManager.java:231)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getBeanMetaData(BeanMetaDataManager.java:178)
at org.hibernate.validator.internal.engine.ValidatorImpl.getConstraintsForClass(ValidatorImpl.java:327)
at org.hibernate.validator.internal.cdi.ValidationExtension.determineConstrainedCallables(ValidationExtension.java:241)
at org.hibernate.validator.internal.cdi.ValidationExtension.processAnnotatedType(ValidationExtension.java:228)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85)
at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
at org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.fireProcessAnnotatedType(ContainerLifecycleEvents.java:203)
at org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.fireProcessAnnotatedType(ContainerLifecycleEvents.java:174)
at org.jboss.weld.bootstrap.BeanDeployer.processAnnotatedTypes(BeanDeployer.java:166)
at org.jboss.weld.bootstrap.BeanDeployment.createTypes(BeanDeployment.java:219)
at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:415)
at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:79)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
```
My DTO class:
```java
package dk.xakeps.truestarter.server.dto.request;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import dk.xakeps.truestarter.server.validator.CrossField;
import javax.annotation.Nonnull;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@CrossField(fields = {"password", "passwordRetry"})
public class RegisterRequest {
@NotNull
@Email
@Size(max = 150)
private final String email;
@NotNull
@Size(min = 3, max = 16)
private final String username;
@NotNull
@Size(min = 6, max = 32)
private final String password;
@NotNull
@Size(min = 6, max = 32)
private final String passwordRetry;
@JsonCreator
public RegisterRequest(@Nonnull @JsonProperty("email") String email,
@Nonnull @JsonProperty("username") String username,
@Nonnull @JsonProperty("password") String password,
@Nonnull @JsonProperty("passwordRetry") String passwordRetry) {
this.email = email;
this.username = username;
this.password = password;
this.passwordRetry = passwordRetry;
}
public String getEmail() {
return email;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getPasswordRetry() {
return passwordRetry;
}
}
```
CrossField annotation:
```java
package dk.xakeps.truestarter.server.validator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = CrossFieldValidator.class)
public @interface CrossField {
String message() default "{CrossField.message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
String[] fields();
}
```
CrossField validator:
```java
*package dk.xakeps.truestarter.server.validator;
import org.apache.commons.beanutils.PropertyUtils;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.ValidationException;
import java.lang.reflect.InvocationTargetException;
public class CrossFieldValidator implements ConstraintValidator<CrossField, Object> {
private String[] fields;
@Override
public void initialize(CrossField constraintAnnotation) {
this.fields = constraintAnnotation.fields();
}
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
Object prevFieldValue = null;
int i = 0;
for (String field : fields) {
try {
Object property = PropertyUtils.getProperty(value, field);
if (i == 0) {
prevFieldValue = property;
i++;
continue;
}
if (!prevFieldValue.equals(property)) {
return false;
}
prevFieldValue = property;
i++;
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new ValidationException("Failed validating bean", e);
}
}
return true;
}
}
```
> [WFLY13] NPE on deploy, when Email validation annotation present
> ----------------------------------------------------------------
>
> Key: WFLY-10752
> URL: https://issues.jboss.org/browse/WFLY-10752
> Project: WildFly
> Issue Type: Bug
> Environment: Arch linux, openjdk 8, Wildfly 13.0.0.Final
> Reporter: d3coder d3coder
> Assignee: Jason Greene
>
> I'm making simple app. In one of my DTO's i have field with `javax.validation.constraints.Email` annotation. When this annotation present, wildfly fails to deploy my app with this exception:
> https://gist.github.com/XakepSDK/daa2531203b365ad1969e01b4466b8a1
> My DTO class:
> https://gist.github.com/XakepSDK/a78245b262315437d2800be524018d2e
> CrossField annotation:
> https://gist.github.com/XakepSDK/a78245b262315437d2800be524018d2e
> CrossField validator:
> https://gist.github.com/XakepSDK/391783e3b79f839a93a8f45c886b38e0
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months
[JBoss JIRA] (WFLY-10752) [WFLY13] NPE on deploy, when Email validation annotation present
by d3coder d3coder (JIRA)
d3coder d3coder created WFLY-10752:
--------------------------------------
Summary: [WFLY13] NPE on deploy, when Email validation annotation present
Key: WFLY-10752
URL: https://issues.jboss.org/browse/WFLY-10752
Project: WildFly
Issue Type: Bug
Environment: Arch linux, openjdk 8, Wildfly 13.0.0.Final
Reporter: d3coder d3coder
Assignee: Jason Greene
I'm making simple app. In one of my DTO's i have field with `javax.validation.constraints.Email` annotation. When this annotation present, wildfly fails to deploy my app with this exception:
```
java.lang.NullPointerException
at sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
at sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.<init>(AnnotatedTypeFactory.java:139)
at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
at java.lang.reflect.Field.getAnnotatedType(Field.java:1170)
at org.hibernate.validator.internal.metadata.provider.TypeAnnotationAwareMetaDataProvider.findTypeAnnotationConstraintsForMember(TypeAnnotationAwareMetaDataProvider.java:65)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.findPropertyMetaData(AnnotationMetaDataProvider.java:244)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getFieldMetaData(AnnotationMetaDataProvider.java:227)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.retrieveBeanConfiguration(AnnotationMetaDataProvider.java:137)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfiguration(AnnotationMetaDataProvider.java:125)
at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfigurationForHierarchy(AnnotationMetaDataProvider.java:108)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.createBeanMetaData(BeanMetaDataManager.java:203)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getOrCreateBeanMetaData(BeanMetaDataManager.java:231)
at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getBeanMetaData(BeanMetaDataManager.java:178)
at org.hibernate.validator.internal.engine.ValidatorImpl.getConstraintsForClass(ValidatorImpl.java:327)
at org.hibernate.validator.internal.cdi.ValidationExtension.determineConstrainedCallables(ValidationExtension.java:241)
at org.hibernate.validator.internal.cdi.ValidationExtension.processAnnotatedType(ValidationExtension.java:228)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85)
at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
at org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.fireProcessAnnotatedType(ContainerLifecycleEvents.java:203)
at org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.fireProcessAnnotatedType(ContainerLifecycleEvents.java:174)
at org.jboss.weld.bootstrap.BeanDeployer.processAnnotatedTypes(BeanDeployer.java:166)
at org.jboss.weld.bootstrap.BeanDeployment.createTypes(BeanDeployment.java:219)
at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:415)
at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:79)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
```
My DTO class:
```java
package dk.xakeps.truestarter.server.dto.request;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import dk.xakeps.truestarter.server.validator.CrossField;
import javax.annotation.Nonnull;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@CrossField(fields = {"password", "passwordRetry"})
public class RegisterRequest {
@NotNull
@Email
@Size(max = 150)
private final String email;
@NotNull
@Size(min = 3, max = 16)
private final String username;
@NotNull
@Size(min = 6, max = 32)
private final String password;
@NotNull
@Size(min = 6, max = 32)
private final String passwordRetry;
@JsonCreator
public RegisterRequest(@Nonnull @JsonProperty("email") String email,
@Nonnull @JsonProperty("username") String username,
@Nonnull @JsonProperty("password") String password,
@Nonnull @JsonProperty("passwordRetry") String passwordRetry) {
this.email = email;
this.username = username;
this.password = password;
this.passwordRetry = passwordRetry;
}
public String getEmail() {
return email;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getPasswordRetry() {
return passwordRetry;
}
}
```
CrossField annotation:
```java
package dk.xakeps.truestarter.server.validator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = CrossFieldValidator.class)
public @interface CrossField {
String message() default "{CrossField.message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
String[] fields();
}
```
CrossField validator:
```java
*package dk.xakeps.truestarter.server.validator;
import org.apache.commons.beanutils.PropertyUtils;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.ValidationException;
import java.lang.reflect.InvocationTargetException;
public class CrossFieldValidator implements ConstraintValidator<CrossField, Object> {
private String[] fields;
@Override
public void initialize(CrossField constraintAnnotation) {
this.fields = constraintAnnotation.fields();
}
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
Object prevFieldValue = null;
int i = 0;
for (String field : fields) {
try {
Object property = PropertyUtils.getProperty(value, field);
if (i == 0) {
prevFieldValue = property;
i++;
continue;
}
if (!prevFieldValue.equals(property)) {
return false;
}
prevFieldValue = property;
i++;
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new ValidationException("Failed validating bean", e);
}
}
return true;
}
}
```
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
7 years, 9 months