improve exception handling

This commit is contained in:
Sebastian Sdorra
2011-05-12 19:36:10 +02:00
parent 8c2a383b2b
commit 883b9f1a3c
15 changed files with 486 additions and 146 deletions

View File

@@ -95,12 +95,10 @@ public class JerseyClientProvider implements ScmClientProvider
*
* @return
*
* @throws ScmClientException
*/
@Override
public JerseyClientSession createSession(String url, String username,
String password)
throws ScmClientException
{
AssertUtil.assertIsNotEmpty(url);
@@ -153,24 +151,7 @@ public class JerseyClientProvider implements ScmClientProvider
response = resource.get(ClientResponse.class);
}
if (response.getStatus() != 200)
{
String msg =
"server returned ".concat(String.valueOf(response.getStatus()));
if (logger.isWarnEnabled())
{
logger.warn(msg);
}
if (logger.isTraceEnabled())
{
logger.trace("server returned content: {}",
response.getEntity(String.class));
}
throw new ScmClientException(msg);
}
ClientUtil.checkResponse(response);
ScmState state = response.getEntity(ScmState.class);