Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
-
021baffa
by Tony CHEMIT at 2018-02-19T09:15:21+01:00
1 changed file:
Changes:
| ... | ... | @@ -24,6 +24,10 @@ import com.opensymphony.xwork2.validator.ValidationException; |
| 24 | 24 |
import fr.ird.t3.entities.T3EntityHelper;
|
| 25 | 25 |
import fr.ird.t3.entities.user.JdbcConfiguration;
|
| 26 | 26 |
|
| 27 |
+import java.nio.charset.StandardCharsets;
|
|
| 28 |
+ |
|
| 29 |
+import static org.nuiton.i18n.I18n.t;
|
|
| 30 |
+ |
|
| 27 | 31 |
/**
|
| 28 | 32 |
* Check the incoming jdbc configuration connection.
|
| 29 | 33 |
*
|
| ... | ... | @@ -38,20 +42,14 @@ public class CheckJdbcConnectionValidator extends T3BaseFieldValidatorSupport { |
| 38 | 42 |
if (!getValidatorContext().hasFieldErrors()) {
|
| 39 | 43 |
|
| 40 | 44 |
String fieldName = getFieldName();
|
| 41 |
- JdbcConfiguration db =
|
|
| 42 |
- (JdbcConfiguration) getFieldValue(fieldName, object);
|
|
| 43 |
- |
|
| 44 |
- // check jdbc connection
|
|
| 45 |
+ JdbcConfiguration db = (JdbcConfiguration) getFieldValue(fieldName, object);
|
|
| 45 | 46 |
|
| 46 | 47 |
try {
|
| 47 |
- |
|
| 48 | 48 |
T3EntityHelper.checkJDBCConnection(db);
|
| 49 |
- |
|
| 50 | 49 |
} catch (Exception e) {
|
| 51 | 50 |
// can not connect to database
|
| 52 |
- addFieldError(
|
|
| 53 |
- "database.url",
|
|
| 54 |
- _("t3.error.invalid.jdbc.connexion", e.getMessage()));
|
|
| 51 |
+ String errorMessage = new String(e.getMessage().getBytes(), StandardCharsets.UTF_8);
|
|
| 52 |
+ addFieldError("database.url", t("t3.error.invalid.jdbc.connexion", errorMessage));
|
|
| 55 | 53 |
}
|
| 56 | 54 |
}
|
| 57 | 55 |
}
|