use of org.apache.archiva.redback.rest.api.services.RedbackServiceException in project archiva by apache.
the class DefaultCommonServices method getAllI18nResources.
@Override
public String getAllI18nResources(String locale) throws ArchivaRestServiceException {
String cachedi18n = cachei18n.get(StringUtils.isEmpty(locale) ? "en" : StringUtils.lowerCase(locale));
if (cachedi18n != null) {
return cachedi18n;
}
try {
Properties all = utilServices.getI18nProperties(locale);
StringBuilder resourceName = new StringBuilder(RESOURCE_NAME);
loadResource(all, resourceName, locale);
String i18n = fromProperties(all);
cachei18n.put(StringUtils.isEmpty(locale) ? "en" : StringUtils.lowerCase(locale), i18n);
return i18n;
} catch (IOException e) {
throw new ArchivaRestServiceException(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e);
} catch (RedbackServiceException e) {
throw new ArchivaRestServiceException(e.getMessage(), e.getHttpErrorCode(), e);
}
}
Aggregations