Search in sources :

Example 1 with RedbackServiceException

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);
    }
}
Also used : RedbackServiceException(org.apache.archiva.redback.rest.api.services.RedbackServiceException) ArchivaRestServiceException(org.apache.archiva.rest.api.services.ArchivaRestServiceException) IOException(java.io.IOException) Properties(java.util.Properties)

Aggregations

IOException (java.io.IOException)1 Properties (java.util.Properties)1 RedbackServiceException (org.apache.archiva.redback.rest.api.services.RedbackServiceException)1 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)1