diff options
author | Olivier Lamy <olamy@apache.org> | 2012-01-23 12:31:59 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-01-23 12:31:59 +0000 |
commit | ac710a67b8ce9a2b2c64d92a8dd08fa188f8c5d5 (patch) | |
tree | 5f3a1c710256842980d919fb34b9f0f6f6720e31 /archiva-modules/archiva-web | |
parent | 6378412f5c184212f29a923c0dfa9f6fca507afb (diff) | |
download | archiva-ac710a67b8ce9a2b2c64d92a8dd08fa188f8c5d5.tar.gz archiva-ac710a67b8ce9a2b2c64d92a8dd08fa188f8c5d5.zip |
prevent doing to much String->Properties transformation for loading i18n
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1234762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r-- | archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java index 1a21588dd..33737feb5 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java @@ -22,7 +22,6 @@ import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.CommonServices; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.codehaus.plexus.util.StringInputStream; import org.codehaus.redback.rest.api.services.RedbackServiceException; import org.codehaus.redback.rest.api.services.UtilServices; import org.slf4j.Logger; @@ -34,7 +33,6 @@ import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.StringReader; import java.util.Map; import java.util.Properties; @@ -46,6 +44,8 @@ public class DefaultCommonServices implements CommonServices { + private static final String RESOURCE_NAME = "org/apache/archiva/i18n/default"; + private Logger log = LoggerFactory.getLogger( getClass() ); @Inject @@ -56,7 +56,7 @@ public class DefaultCommonServices { Properties properties = new Properties(); - StringBuilder resourceName = new StringBuilder( "org/apache/archiva/i18n/default" ); + StringBuilder resourceName = new StringBuilder( RESOURCE_NAME ); try { @@ -131,12 +131,17 @@ public class DefaultCommonServices { try { - String redbackProps = utilServices.getI18nResources( locale ); - String archivaProps = getI18nResources( locale ); - Properties properties = new Properties(); - loadFromString( redbackProps, properties ); - loadFromString( archivaProps, properties ); - return fromProperties( properties ); + + Properties all = utilServices.getI18nProperties( locale ); + StringBuilder resourceName = new StringBuilder( RESOURCE_NAME ); + loadResource( all, resourceName, locale ); + + return fromProperties( all ); + } + catch ( IOException e ) + { + throw new ArchivaRestServiceException( e.getMessage(), + Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); } catch ( RedbackServiceException e ) { |