From 32edddb11bcc204628fbdaddf3b0d0e86530f6f8 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Wed, 08 Jun 2016 15:18:05 +0000
Subject: [PATCH] OPENDJ-2955 Use i18n in rest2ldap
---
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/authz/AuthzIdTemplate.java | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/authz/AuthzIdTemplate.java b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/authz/AuthzIdTemplate.java
index 589bb5b..096ad78 100644
--- a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/authz/AuthzIdTemplate.java
+++ b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/authz/AuthzIdTemplate.java
@@ -15,6 +15,8 @@
*/
package org.forgerock.opendj.rest2ldap.authz;
+import static org.forgerock.opendj.rest2ldap.Rest2ldapMessages.*;
+import static org.forgerock.opendj.rest2ldap.authz.Utils.newIllegalArgumentException;
import static org.forgerock.util.Utils.joinAsString;
import java.util.ArrayList;
@@ -87,8 +89,8 @@
return type;
}
}
- throw new IllegalArgumentException("Invalid authorization ID template: '" + template + "'. Templates must "
- + "start with one of the following elements: " + joinAsString(",", getSupportedStartKeys()));
+ throw newIllegalArgumentException(
+ ERR_CONFIG_INVALID_AUTHZID_TEMPLATE.get(template, joinAsString(",", getSupportedStartKeys())));
}
private static List<String> getSupportedStartKeys() {
@@ -162,16 +164,12 @@
final String key = keys.get(i);
final JsonValue value = principals.get(new JsonPointer(key));
if (value == null) {
- throw new IllegalArgumentException(String.format(
- "The request could not be authorized because the required "
- + "security principal '%s' could not be determined", key));
+ throw newIllegalArgumentException(ERR_AUTHZID_DECODER_PRINCIPAL_CANNOT_BE_DETERMINED.get(key));
}
final Object object = value.getObject();
if (!isJSONPrimitive(object)) {
- throw new IllegalArgumentException(String.format(
- "The request could not be authorized because the required "
- + "security principal '%s' had an invalid data type", key));
+ throw newIllegalArgumentException(ERR_AUTHZID_DECODER_PRINCIPAL_INVALID_DATA_TYPE.get(key));
}
values[i] = String.valueOf(object);
}
--
Gitblit v1.10.0