Commit fbd040d4481cefb747516cc36af20369f5c696da
1 parent
2374298d
Exists in
master
Resolvido bug que derrubava o contexto que cuida do ViewScope no momento
errado.
Showing
3 changed files
with
8 additions
and
6 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/context/CustomContext.java
| @@ -51,7 +51,8 @@ public interface CustomContext extends Context { | @@ -51,7 +51,8 @@ public interface CustomContext extends Context { | ||
| 51 | * Activates a custom context | 51 | * Activates a custom context |
| 52 | * | 52 | * |
| 53 | * @return <code>true</code> if context was activated, <code>false</code> if there was already another active | 53 | * @return <code>true</code> if context was activated, <code>false</code> if there was already another active |
| 54 | - * context for the same scope and the activation of this scope failed. | 54 | + * context for the same scope and the activation of this scope failed, or if it was already activated before |
| 55 | + * this call. | ||
| 55 | */ | 56 | */ |
| 56 | boolean activate(); | 57 | boolean activate(); |
| 57 | 58 |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/AbstractCustomContext.java
| @@ -113,6 +113,8 @@ public abstract class AbstractCustomContext implements CustomContext { | @@ -113,6 +113,8 @@ public abstract class AbstractCustomContext implements CustomContext { | ||
| 113 | 113 | ||
| 114 | @Override | 114 | @Override |
| 115 | public boolean activate() { | 115 | public boolean activate() { |
| 116 | + boolean success = false; | ||
| 117 | + | ||
| 116 | if (!this.active){ | 118 | if (!this.active){ |
| 117 | BeanManager beanManager = Beans.getBeanManager(); | 119 | BeanManager beanManager = Beans.getBeanManager(); |
| 118 | if (beanManager!=null){ | 120 | if (beanManager!=null){ |
| @@ -123,17 +125,17 @@ public abstract class AbstractCustomContext implements CustomContext { | @@ -123,17 +125,17 @@ public abstract class AbstractCustomContext implements CustomContext { | ||
| 123 | } | 125 | } |
| 124 | } | 126 | } |
| 125 | catch(ContextNotActiveException ce){ | 127 | catch(ContextNotActiveException ce){ |
| 126 | - this.active = true; | 128 | + success = this.active = true; |
| 127 | getLogger().debug( getBundle().getString("custom-context-was-activated" , this.getClass().getCanonicalName() , this.getScope().getSimpleName() ) ); | 129 | getLogger().debug( getBundle().getString("custom-context-was-activated" , this.getClass().getCanonicalName() , this.getScope().getSimpleName() ) ); |
| 128 | } | 130 | } |
| 129 | } | 131 | } |
| 130 | else{ | 132 | else{ |
| 131 | - this.active = true; | 133 | + success = this.active = true; |
| 132 | getLogger().debug( getBundle().getString("custom-context-was-activated" , this.getClass().getCanonicalName() , this.getScope().getSimpleName() ) ); | 134 | getLogger().debug( getBundle().getString("custom-context-was-activated" , this.getClass().getCanonicalName() , this.getScope().getSimpleName() ) ); |
| 133 | } | 135 | } |
| 134 | } | 136 | } |
| 135 | 137 | ||
| 136 | - return this.active; | 138 | + return success; |
| 137 | } | 139 | } |
| 138 | 140 | ||
| 139 | @Override | 141 | @Override |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrap.java
| @@ -66,8 +66,7 @@ public class JsfBootstrap implements Extension { | @@ -66,8 +66,7 @@ public class JsfBootstrap implements Extension { | ||
| 66 | 66 | ||
| 67 | //Ativa o ViewContext | 67 | //Ativa o ViewContext |
| 68 | if (!context.isActive()){ | 68 | if (!context.isActive()){ |
| 69 | - context.activate(); | ||
| 70 | - contextActivatedHere = true; | 69 | + contextActivatedHere = context.activate(); |
| 71 | } | 70 | } |
| 72 | else{ | 71 | else{ |
| 73 | contextActivatedHere = false; | 72 | contextActivatedHere = false; |