#6491 extract common parseAndFillForContent method

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-07-27 11:55:03 +02:00
parent bd11d6f682
commit 73ab70d174
1 changed files with 14 additions and 16 deletions

View File

@ -90,14 +90,7 @@ public class HttpChannelOverHttp extends HttpChannel implements HttpParser.Reque
LOG.debug("needContent has content immediately available: {}", _content);
return true;
}
try
{
_httpConnection.parseAndFillForContent();
}
catch (Throwable x)
{
_content = new HttpInput.ErrorContent(x);
}
parseAndFillForContent();
if (_content != null)
{
if (LOG.isDebugEnabled())
@ -118,14 +111,7 @@ public class HttpChannelOverHttp extends HttpChannel implements HttpParser.Reque
{
if (LOG.isDebugEnabled())
LOG.debug("produceContent has no content, parsing and filling");
try
{
_httpConnection.parseAndFillForContent();
}
catch (Throwable x)
{
_content = new HttpInput.ErrorContent(x);
}
parseAndFillForContent();
}
HttpInput.Content result = _content;
if (result != null && !result.isSpecial())
@ -135,6 +121,18 @@ public class HttpChannelOverHttp extends HttpChannel implements HttpParser.Reque
return result;
}
private void parseAndFillForContent()
{
try
{
_httpConnection.parseAndFillForContent();
}
catch (Throwable x)
{
_content = new HttpInput.ErrorContent(x);
}
}
@Override
public boolean failAllContent(Throwable failure)
{