mirror of https://github.com/apache/archiva.git
close StringReader
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1228022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bcf944afb6
commit
d5461dcc53
|
@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -124,18 +123,34 @@ public class DefaultCommonServices
|
|||
String redbackProps = utilServices.getI18nResources( locale );
|
||||
String archivaProps = getI18nResources( locale );
|
||||
Properties properties = new Properties();
|
||||
properties.load( new StringReader( redbackProps ) );
|
||||
properties.load( new StringReader( archivaProps ) );
|
||||
loadFromString( redbackProps, properties );
|
||||
loadFromString( archivaProps, properties );
|
||||
return fromProperties( properties );
|
||||
}
|
||||
catch ( RedbackServiceException e )
|
||||
{
|
||||
throw new ArchivaRestServiceException( e.getMessage(), e.getHttpErrorCode() );
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFromString( String propsStr, Properties properties )
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
|
||||
StringReader stringReader = null;
|
||||
try
|
||||
{
|
||||
stringReader = new StringReader( propsStr );
|
||||
properties.load( stringReader );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ArchivaRestServiceException( e.getMessage(),
|
||||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( stringReader );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue