Let ParserUtils.parseBodyStream throw an exception on error.

Before, ParserUtils.parseBodyStream swallowed parser exceptions
and printed a stacktrace. Such an exception is not at all uncommon
because it can happen when the server sends an unexpected/erroneous
response.

Now any parsing error gets propagated to the caller, because
within the method we cannot properly handle it.

Also adjust all uses of the method, to handle the exception
and rethrow it appropriately.

Signed-off-by: Thomas Haller <thom311@gmail.com>
add method SUSEStudio.importRepository

Signed-off-by: Thomas Haller <thom311@gmail.com>
add method SUSEStudio.refreshRepository

Add parameter ignoreResult to StudioConnection.request.
This is for requests that do not return anything of where
the response should be ignored.

Signed-off-by: Thomas Haller <thom311@gmail.com>
fixup! add method SUSEStudio.importRepository

Use StringBuilder to construct the URI.
fixup! add method SUSEStudio.refreshRepository

Use StringBuilder to construct the URI.
fixup! Let ParserUtils.parseBodyStream throw an exception on error.

ParserUtils.parseBodyStream should throw a SUSEStudioException instead
of a generic Exception.
squash! add method SUSEStudio.refreshRepository

refreshRepository now also expects a <success> response.
Apparantly, the server currently returns an empty response
but that will be fixed.

Signed-off-by: Thomas Haller <thom311@gmail.com>
Add method SUSEStudio.getRepository

Signed-off-by: Thomas Haller <thom311@gmail.com>
Add test for reading <repository> element

Signed-off-by: Thomas Haller <thom311@gmail.com>
fixup! Let ParserUtils.parseBodyStream throw an exception on error.

Don't set the error code of the SUSEStudioException in ParserUtils.

Signed-off-by: Thomas Haller <thom311@gmail.com>
fixup! Let ParserUtils.parseBodyStream throw an exception on error.

Do not use the constructor overload of SUSEStudioException that
sets the cause.

If you don't like the additional constructor overload,
please drop commit
  f50ee0b - add constructer overload to SUSEStudioException
using git-rebase --interactive.

Signed-off-by: Thomas Haller <thom311@gmail.com>
fixup! Let ParserUtils.parseBodyStream throw an exception on error.

Add IOUtils.closeQuietly() to avoid nested try/catch blocks in
StudioConnection.

Signed-off-by: Thomas Haller <thom311@gmail.com>
Specifically catch SUSEStudioException here
Fix class comment

I will probably merge IOUtils with URLUtils into a more generic
utilities class, so this comment should be suitable eventually.
Just wrap the exception we are catching