Commit 405830abde6d8002452e4a397ad255a90e03d5a3
1 parent
2dce4597
Exists in
master
Resolvido problema de null pointer ao usar Beans.getReference para
injetar instâncias.
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
impl/extension/jpa/src/main/java/br/gov/frameworkdemoiselle/internal/producer/EntityManagerProducer.java
... | ... | @@ -125,7 +125,9 @@ public class EntityManagerProducer implements Serializable { |
125 | 125 | private String getPersistenceUnit(InjectionPoint ip, EntityManagerConfig config) { |
126 | 126 | String persistenceUnitName; |
127 | 127 | |
128 | - if (ip != null && ip.getAnnotated().isAnnotationPresent(Name.class)) { | |
128 | + if (ip != null && ip.getAnnotated()!=null && ip.getAnnotated().isAnnotationPresent(Name.class)) { | |
129 | + //Quando o comando Beans.getReference é usado para simular injeção, não existe | |
130 | + //anotação @Inject então precisamos testar se #getAnnotated() retorna nulo aqui. | |
129 | 131 | persistenceUnitName = ip.getAnnotated().getAnnotation(Name.class).value(); |
130 | 132 | |
131 | 133 | } else { | ... | ... |