method.setRequestEntity(new StringRequestEntity(encoder.encode(form), null, null));
method.setRequestHeader("Checkin-Comment", form.getDocumentation());
helper.setAuth(client, method);
client.executeMethod(method);
if (!"OK".equalsIgnoreCase(method.getResponseBodyAsString())) {
throw new FormServiceException("Remote guvnor error: " + method.getResponseBodyAsString());
}
return form.getName();
} catch (IOException e) {
throw new FormServiceException(e);
} catch (FormEncodingException e) {
throw new FormServiceException(e);
} catch (Exception e) {
if (e instanceof FormServiceException) {
throw (FormServiceException) e;
}
throw new FormServiceException("Unexpected error", e);
} finally {
if (method != null) {
method.releaseConnection();
}
}