Commit d6f830537b54d5f5d5ef2a88ee22b39a74cb9754
1 parent
05dc0b84
Exists in
master
Mudança no log que indica que a chave não foi encontrada
Showing
2 changed files
with
8 additions
and
25 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
| @@ -118,11 +118,9 @@ public class ConfigurationLoader implements Serializable { | @@ -118,11 +118,9 @@ public class ConfigurationLoader implements Serializable { | ||
| 118 | 118 | ||
| 119 | if (config != null) { | 119 | if (config != null) { |
| 120 | Key key = new Key(field, clazz, config); | 120 | Key key = new Key(field, clazz, config); |
| 121 | - if(validateKey(resource, key, type, config)){ | ||
| 122 | - Object value = getValue(key, field, config); | ||
| 123 | - validate(field, key, value, resource); | ||
| 124 | - setValue(field, key, object, value); | ||
| 125 | - } | 121 | + Object value = getValue(key, field, config); |
| 122 | + validate(field, key, value, resource); | ||
| 123 | + setValue(field, key, object, value); | ||
| 126 | } | 124 | } |
| 127 | } | 125 | } |
| 128 | } | 126 | } |
| @@ -142,24 +140,6 @@ public class ConfigurationLoader implements Serializable { | @@ -142,24 +140,6 @@ public class ConfigurationLoader implements Serializable { | ||
| 142 | } | 140 | } |
| 143 | } | 141 | } |
| 144 | 142 | ||
| 145 | - private boolean validateKey(String resource, Key key, ConfigType type, org.apache.commons.configuration.Configuration config){ | ||
| 146 | - if(!config.containsKey(key.toString())){ | ||
| 147 | - if(type.toString().equals("PROPERTIES")){ | ||
| 148 | - getLogger().info(getBundle().getString("key-not-found-in-file", key, resource + ".properties")); | ||
| 149 | - }else{ | ||
| 150 | - if(type.toString().equals("XML")){ | ||
| 151 | - getLogger().info(getBundle().getString("key-not-found-in-file", key, resource + ".xml")); | ||
| 152 | - }else{ | ||
| 153 | - if(type.toString().equals("SYSTEM")){ | ||
| 154 | - getLogger().info(getBundle().getString("key-not-found-in-system", key)); | ||
| 155 | - } | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | - return false; | ||
| 159 | - } | ||
| 160 | - return true; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | /** | 143 | /** |
| 164 | * Returns the configuration class according to specified resource name and configuration type. | 144 | * Returns the configuration class according to specified resource name and configuration type. |
| 165 | * | 145 | * |
| @@ -468,6 +448,10 @@ public class ConfigurationLoader implements Serializable { | @@ -468,6 +448,10 @@ public class ConfigurationLoader implements Serializable { | ||
| 468 | } | 448 | } |
| 469 | 449 | ||
| 470 | this.key = this.prefix + this.name; | 450 | this.key = this.prefix + this.name; |
| 451 | + | ||
| 452 | + if(!config.containsKey(key.toString())){ | ||
| 453 | + getLogger().debug(getBundle().getString("key-not-found", key)); | ||
| 454 | + } | ||
| 471 | } | 455 | } |
| 472 | 456 | ||
| 473 | private String getNameByAnnotation(Field field) { | 457 | private String getNameByAnnotation(Field field) { |
impl/core/src/main/resources/demoiselle-core-bundle.properties
| @@ -35,8 +35,7 @@ | @@ -35,8 +35,7 @@ | ||
| 35 | 35 | ||
| 36 | engine-on=Ligando os motores do Demoiselle ${project.version} | 36 | engine-on=Ligando os motores do Demoiselle ${project.version} |
| 37 | resource-not-found=Arquivo {0} n\u00E3o foi encontrado | 37 | resource-not-found=Arquivo {0} n\u00E3o foi encontrado |
| 38 | -key-not-found-in-file=A chave {0} n\u00E3o foi encontrada no arquivo {1} | ||
| 39 | -key-not-found-in-system=A vari\u00E1vel de ambiente {0} n\u00E3o foi encontrada no sistema | 38 | +key-not-found=A chave {0} n\u00E3o foi encontrada |
| 40 | ambiguous-strategy-resolution=Foi detectada ambiguidade da interface "{0}" com as seguintes implementa\u00E7\u00F5es\: "{1}". Para resolver o conflito, defina explicitamente a implementa\u00E7\u00E3o no demoiselle.properties. | 39 | ambiguous-strategy-resolution=Foi detectada ambiguidade da interface "{0}" com as seguintes implementa\u00E7\u00F5es\: "{1}". Para resolver o conflito, defina explicitamente a implementa\u00E7\u00E3o no demoiselle.properties. |
| 41 | bean-not-found=Voc\u00EA est\u00E1 tentando obter um objeto n\u00E3o reconhecido pelo CDI via Beans.getReference({0}) | 40 | bean-not-found=Voc\u00EA est\u00E1 tentando obter um objeto n\u00E3o reconhecido pelo CDI via Beans.getReference({0}) |
| 42 | more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00E9todo na classe {0} para tratar a exce\u00E7\u00E3o {1} | 41 | more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00E9todo na classe {0} para tratar a exce\u00E7\u00E3o {1} |