Commit d757db67c3927b26ae0b6af186fbfc242d6a66de
1 parent
5fefbbf2
Exists in
master
Exceção de conversão de tipo
Showing
3 changed files
with
8 additions
and
5 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java
| ... | ... | @@ -53,6 +53,7 @@ import javax.validation.Validator; |
| 53 | 53 | import javax.validation.ValidatorFactory; |
| 54 | 54 | |
| 55 | 55 | import org.apache.commons.configuration.AbstractConfiguration; |
| 56 | +import org.apache.commons.configuration.ConversionException; | |
| 56 | 57 | import org.apache.commons.configuration.FileConfiguration; |
| 57 | 58 | import org.apache.commons.configuration.PropertiesConfiguration; |
| 58 | 59 | import org.apache.commons.configuration.SystemConfiguration; |
| ... | ... | @@ -241,7 +242,11 @@ public class ConfigurationLoader implements Serializable { |
| 241 | 242 | } catch (ConfigurationException cause) { |
| 242 | 243 | throw cause; |
| 243 | 244 | |
| 244 | - } catch (Exception cause) { | |
| 245 | + } catch (ConversionException cause) { | |
| 246 | + throw new ConfigurationException(getBundle().getString("configuration-not-conversion" , this.prefix + getKey(field), field.getType().toString()) , cause); | |
| 247 | + } | |
| 248 | + | |
| 249 | + catch (Exception cause) { | |
| 245 | 250 | // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal. |
| 246 | 251 | throw new ConfigurationException("", cause); |
| 247 | 252 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationMapValueExtractor.java
| ... | ... | @@ -74,10 +74,7 @@ public class ConfigurationMapValueExtractor implements ConfigurationValueExtract |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | String mapKey = matcher.group(3) == null ? "default" : matcher.group(3); |
| 77 | - Object mapValue = configuration.getString(confKey); | |
| 78 | - if (!Strings.isEmpty((String) mapValue)){ | |
| 79 | - value.put(mapKey, mapValue); | |
| 80 | - } | |
| 77 | + value.put(mapKey, configuration.getString(confKey)); | |
| 81 | 78 | } |
| 82 | 79 | } |
| 83 | 80 | ... | ... |
impl/core/src/main/resources/demoiselle-core-bundle.properties
| ... | ... | @@ -60,6 +60,7 @@ configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat |
| 60 | 60 | configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o Name n\u00E3o pode estar em branco |
| 61 | 61 | configuration-key-not-found=Chave de configura\u00E7\u00E3o {0} n\u00E3o encontrada |
| 62 | 62 | configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. |
| 63 | +configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1} | |
| 63 | 64 | |
| 64 | 65 | transaction-not-defined=Nenhuma transa\u00E7\u00E3o foi definida. Para utilizar @{0} \u00E9 preciso definir a propriedade frameworkdemoiselle.transaction.class com a estrat\u00E9gia de transa\u00E7\u00E3o desejada no arquivo demoiselle.properties |
| 65 | 66 | executing-all=Executando todos os \: {0} | ... | ... |